clang-tools
3.9.0
Main Page
Namespaces
Classes
Files
File List
File Members
llvm.src
tools
clang
tools
extra
clang-tidy
readability
FunctionSizeCheck.h
Go to the documentation of this file.
1
//===--- FunctionSizeCheck.h - clang-tidy -----------------------*- C++ -*-===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_FUNCTIONSIZECHECK_H
11
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_FUNCTIONSIZECHECK_H
12
13
#include "../ClangTidy.h"
14
15
namespace
clang {
16
namespace
tidy {
17
namespace
readability {
18
19
/// Checks for large functions based on various metrics.
20
///
21
/// These options are supported:
22
///
23
/// * `LineThreshold` - flag functions exceeding this number of lines. The
24
/// default is `-1` (ignore the number of lines).
25
/// * `StatementThreshold` - flag functions exceeding this number of
26
/// statements. This may differ significantly from the number of lines for
27
/// macro-heavy code. The default is `800`.
28
/// * `BranchThreshold` - flag functions exceeding this number of control
29
/// statements. The default is `-1` (ignore the number of branches).
30
class
FunctionSizeCheck
:
public
ClangTidyCheck
{
31
public
:
32
FunctionSizeCheck
(StringRef
Name
,
ClangTidyContext
*
Context
);
33
34
void
storeOptions
(
ClangTidyOptions::OptionMap
&Opts)
override
;
35
void
registerMatchers
(ast_matchers::MatchFinder *
Finder
)
override
;
36
void
check
(
const
ast_matchers::MatchFinder::MatchResult &
Result
)
override
;
37
38
private
:
39
const
unsigned
LineThreshold;
40
const
unsigned
StatementThreshold;
41
const
unsigned
BranchThreshold;
42
};
43
44
}
// namespace readability
45
}
// namespace tidy
46
}
// namespace clang
47
48
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_FUNCTIONSIZECHECK_H
Name
const std::string Name
Definition:
USRFinder.cpp:140
Finder
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition:
ClangTidy.cpp:210
clang::tidy::readability::FunctionSizeCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition:
FunctionSizeCheck.cpp:77
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition:
ClangTidy.h:110
clang::tidy::readability::FunctionSizeCheck::FunctionSizeCheck
FunctionSizeCheck(StringRef Name, ClangTidyContext *Context)
Definition:
FunctionSizeCheck.cpp:71
clang::tidy::readability::FunctionSizeCheck
Checks for large functions based on various metrics.
Definition:
FunctionSizeCheck.h:30
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition:
ClangTidyOptions.h:85
Context
ClangTidyContext & Context
Definition:
ClangTidy.cpp:93
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition:
ClangTidyDiagnosticConsumer.h:135
clang::tidy::readability::FunctionSizeCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition:
FunctionSizeCheck.cpp:87
clang::tidy::readability::FunctionSizeCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition:
FunctionSizeCheck.cpp:83
Result
const NamedDecl * Result
Definition:
USRFinder.cpp:137
Generated on Wed Aug 31 2016 16:57:10 for clang-tools by
1.8.6