clang-tools
10.0.0svn
|
Classes | |
class | AvoidConstParamsInDecls |
class | BracesAroundStatementsCheck |
Checks that bodies of if statements and loops (for , range-for , do-while , and while ) are inside braces. More... | |
class | ConstReturnTypeCheck |
For any function whose return type is const-qualified, suggests removal of the const qualifier from that return type. More... | |
class | ContainerSizeEmptyCheck |
Checks whether a call to the size() method can be replaced with a call to empty() . More... | |
class | ConvertMemberFunctionsToStatic |
This check finds C++ class methods than can be made static because they don't use the 'this' pointer. More... | |
class | DeletedDefaultCheck |
Checks when a constructor or an assignment operator is marked as '= default' but is actually deleted by the compiler. More... | |
class | DeleteNullPointerCheck |
Check whether the 'if' statement is unnecessary before calling 'delete' on a pointer. More... | |
class | ElseAfterReturnCheck |
Flags the usages of else after return . More... | |
class | FunctionSizeCheck |
Checks for large functions based on various metrics. More... | |
class | IdentifierNamingCheck |
Checks for identifiers naming style mismatch. More... | |
class | ImplicitBoolConversionCheck |
Checks for use of implicit bool conversions in expressions. More... | |
class | InconsistentDeclarationParameterNameCheck |
Checks for declarations of functions which differ in parameter names. More... | |
class | IsolateDeclarationCheck |
This check diagnoses all DeclStmt's declaring more than one variable and tries to refactor the code to one statement per declaration. More... | |
class | MagicNumbersCheck |
Detects magic numbers, integer and floating point literals embedded in code. More... | |
class | MisleadingIndentationCheck |
Checks the code for dangling else, and possible misleading indentations due to missing braces. More... | |
class | MisplacedArrayIndexCheck |
Warn about unusual array index syntax (index[array] instead of array[index] ). More... | |
class | NamedParameterCheck |
Find functions with unnamed arguments. More... | |
class | NamespaceCommentCheck |
Checks that long namespaces have a closing comment. More... | |
class | NonConstParameterCheck |
Warn when a pointer function parameter can be const. More... | |
class | ReadabilityModule |
class | RedundantControlFlowCheck |
Eliminates redundant return statements at the end of a function that returns void . More... | |
class | RedundantDeclarationCheck |
Find redundant variable declarations. More... | |
class | RedundantFunctionPtrDereferenceCheck |
Eliminate redundant dereferences of a function pointer. More... | |
class | RedundantMemberInitCheck |
Finds member initializations that are unnecessary because the same default constructor would be called if they were not present. More... | |
class | RedundantPreprocessorCheck |
This check flags redundant preprocessor directives: nested directives with the same condition. More... | |
class | RedundantSmartptrGetCheck |
Find and remove redundant calls to smart pointer's .get() method. More... | |
class | RedundantStringCStrCheck |
Finds unnecessary calls to std::string::c_str() . More... | |
class | RedundantStringInitCheck |
Finds unnecessary string initializations. More... | |
class | SimplifyBooleanExprCheck |
Looks for boolean expressions involving boolean constants and simplifies them to use the appropriate boolean expression directly. More... | |
class | SimplifySubscriptExprCheck |
Simplifies subscript expressions. More... | |
class | StaticAccessedThroughInstanceCheck |
Checks for member expressions that access static members through instances and replaces them with uses of the appropriate qualified-id. More... | |
class | StaticDefinitionInAnonymousNamespaceCheck |
Finds static function and variable definitions in anonymous namespace. More... | |
class | StringCompareCheck |
This check flags all calls compare when used to check for string equality or inequality. More... | |
class | UniqueptrDeleteReleaseCheck |
Flags statements of the form delete <unique_ptr expr>.release(); and replaces them with: <unique_ptr expr> = nullptr; More... | |
class | UppercaseLiteralSuffixCheck |
Detects when the integral literal or floating point literal has non-uppercase suffix, and suggests to make the suffix uppercase. More... | |
Enumerations | |
enum | StyleKind { SK_Count, SK_Invalid } |
Functions | |
static llvm::Optional< Token > | ConstTok (CharSourceRange Range, const MatchFinder::MatchResult &Result) |
static llvm::Optional< Token > | findConstToRemove (const FunctionDecl *Def, const MatchFinder::MatchResult &Result) |
static CheckResult | checkDef (const clang::FunctionDecl *Def, const MatchFinder::MatchResult &MatchResult) |
AST_MATCHER (CXXMethodDecl, isStatic) | |
AST_MATCHER (CXXMethodDecl, hasTrivialBody) | |
AST_MATCHER (CXXMethodDecl, isOverloadedOperator) | |
AST_MATCHER (CXXRecordDecl, hasAnyDependentBases) | |
AST_MATCHER (CXXMethodDecl, isTemplate) | |
AST_MATCHER (CXXMethodDecl, isDependentContext) | |
AST_MATCHER (CXXMethodDecl, isInsideMacroDefinition) | |
AST_MATCHER_P (CXXMethodDecl, hasCanonicalDecl, ast_matchers::internal::Matcher< CXXMethodDecl >, InnerMatcher) | |
AST_MATCHER (CXXMethodDecl, usesThis) | |
static StringRef | getStringFromRange (SourceManager &SourceMgr, const LangOptions &LangOpts, SourceRange Range) |
Obtain the original source code text from a SourceRange. More... | |
static SourceRange | getLocationOfConst (const TypeSourceInfo *TSI, SourceManager &SourceMgr, const LangOptions &LangOpts) |
static bool | matchesStyle (StringRef Name, IdentifierNamingCheck::NamingStyle Style) |
static std::string | fixupWithCase (StringRef Name, IdentifierNamingCheck::CaseType Case) |
static std::string | fixupWithStyle (StringRef Name, const IdentifierNamingCheck::NamingStyle &Style) |
static StyleKind | findStyleKind (const NamedDecl *D, const std::vector< llvm::Optional< IdentifierNamingCheck::NamingStyle >> &NamingStyles) |
static void | addUsage (IdentifierNamingCheck::NamingCheckFailureMap &Failures, const IdentifierNamingCheck::NamingCheckId &Decl, SourceRange Range, SourceManager *SourceMgr=nullptr) |
static void | addUsage (IdentifierNamingCheck::NamingCheckFailureMap &Failures, const NamedDecl *Decl, SourceRange Range, SourceManager *SourceMgr=nullptr) |
Convenience method when the usage to be added is a NamedDecl. More... | |
static SourceLocation | findStartOfIndirection (SourceLocation Start, int Indirections, const SourceManager &SM, const LangOptions &LangOpts) |
static bool | isMacroID (SourceRange R) |
static int | countIndirections (const Type *T, int Indirections=0) |
This function counts the number of written indirections for the given Type T . More... | |
static bool | typeIsMemberPointer (const Type *T) |
static Optional< std::vector< SourceRange > > | declRanges (const DeclStmt *DS, const SourceManager &SM, const LangOptions &LangOpts) |
This function tries to extract the SourceRanges that make up all declarations in this DeclStmt . More... | |
static Optional< std::vector< StringRef > > | collectSourceRanges (llvm::ArrayRef< SourceRange > Ranges, const SourceManager &SM, const LangOptions &LangOpts) |
static std::vector< std::string > | createIsolatedDecls (llvm::ArrayRef< StringRef > Snippets) |
Expects a vector {TypeSnippet, Firstdecl, SecondDecl, ...}. More... | |
static const IfStmt * | getPrecedingIf (const SourceManager &SM, ASTContext *Context, const IfStmt *If) |
static bool | locationsInSameFile (const SourceManager &Sources, SourceLocation Loc1, SourceLocation Loc2) |
static std::string | getNamespaceComment (const NamespaceDecl *ND, bool InsertLineBreak) |
static std::string | getNamespaceComment (const std::string &NameSpaceName, bool InsertLineBreak) |
static ClangTidyModuleRegistry::Add< ReadabilityModule > | X ("readability-module", "Adds readability-related checks.") |
AST_MATCHER (FunctionDecl, doesDeclarationForceExternallyVisibleDefinition) | |
bool | containsBoolLiteral (const Expr *E) |
static unsigned | getNameSpecifierNestingLevel (const QualType &QType) |
Variables | |
static StringRef const | StyleNames [] |
const char | DefaultIgnoredIntegerValues [] = "1;2;3;4;" |
const char | DefaultIgnoredFloatingPointValues [] = "1.0;100.0;" |
static const char | kDefaultTypes [] |
static const StringRef | CompareMessage |
Enumerator | |
---|---|
SK_Count | |
SK_Invalid |
Definition at line 121 of file IdentifierNamingCheck.cpp.
|
static |
Definition at line 671 of file IdentifierNamingCheck.cpp.
Referenced by clang::tidy::modernize::ForLoopIndexUseVisitor::getUsages().
|
static |
Convenience method when the usage to be added is a NamedDecl.
Definition at line 701 of file IdentifierNamingCheck.cpp.
clang::tidy::readability::AST_MATCHER | ( | FunctionDecl | , |
doesDeclarationForceExternallyVisibleDefinition | |||
) |
Definition at line 20 of file RedundantDeclarationCheck.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
isStatic | |||
) |
Definition at line 23 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
hasTrivialBody | |||
) |
Definition at line 25 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
isOverloadedOperator | |||
) |
Definition at line 27 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXRecordDecl | , |
hasAnyDependentBases | |||
) |
Definition at line 31 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
isTemplate | |||
) |
Definition at line 35 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
isDependentContext | |||
) |
Definition at line 39 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
isInsideMacroDefinition | |||
) |
Definition at line 43 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER | ( | CXXMethodDecl | , |
usesThis | |||
) |
Definition at line 57 of file ConvertMemberFunctionsToStatic.cpp.
clang::tidy::readability::AST_MATCHER_P | ( | CXXMethodDecl | , |
hasCanonicalDecl | , | ||
ast_matchers::internal::Matcher< CXXMethodDecl > | , | ||
InnerMatcher | |||
) |
Definition at line 52 of file ConvertMemberFunctionsToStatic.cpp.
|
static |
Definition at line 70 of file ConstReturnTypeCheck.cpp.
|
static |
Definition at line 204 of file IsolateDeclarationCheck.cpp.
|
static |
Definition at line 50 of file AvoidConstParamsInDecls.cpp.
bool clang::tidy::readability::containsBoolLiteral | ( | const Expr * | E | ) |
Definition at line 344 of file SimplifyBooleanExprCheck.cpp.
|
static |
This function counts the number of written indirections for the given Type T
.
It does NOT resolve typedefs as it's a helper for lexing the source code.
Definition at line 60 of file IsolateDeclarationCheck.cpp.
|
static |
Expects a vector {TypeSnippet, Firstdecl, SecondDecl, ...}.
Definition at line 232 of file IsolateDeclarationCheck.cpp.
References Decls.
|
static |
This function tries to extract the SourceRanges that make up all declarations in this DeclStmt
.
The resulting vector has the structure {UnderlyingType, Decl1, Decl2, ...}. Each SourceRange
is of the form [Begin, End). If any of the create ranges is invalid or in a macro the result will be None
. If the DeclStmt
contains only one declaration, the result is None
. If the DeclStmt
contains declarations other than VarDecl
the result is None
.
VarDecl
. Definition at line 109 of file IsolateDeclarationCheck.cpp.
|
static |
Definition at line 28 of file ConstReturnTypeCheck.cpp.
|
static |
Definition at line 34 of file IsolateDeclarationCheck.cpp.
|
static |
Definition at line 394 of file IdentifierNamingCheck.cpp.
References SK_Invalid, and Type.
|
static |
Definition at line 287 of file IdentifierNamingCheck.cpp.
References clang::tidy::readability::IdentifierNamingCheck::CT_AnyCase, clang::tidy::readability::IdentifierNamingCheck::CT_CamelBack, clang::tidy::readability::IdentifierNamingCheck::CT_CamelCase, clang::tidy::readability::IdentifierNamingCheck::CT_CamelSnakeBack, clang::tidy::readability::IdentifierNamingCheck::CT_CamelSnakeCase, clang::tidy::readability::IdentifierNamingCheck::CT_LowerCase, clang::tidy::readability::IdentifierNamingCheck::CT_UpperCase, Name, and Word.
|
static |
Definition at line 384 of file IdentifierNamingCheck.cpp.
|
static |
Definition at line 106 of file ConvertMemberFunctionsToStatic.cpp.
|
static |
Definition at line 49 of file NamespaceCommentCheck.cpp.
References Fix().
|
static |
Definition at line 59 of file NamespaceCommentCheck.cpp.
References Fix().
|
static |
Definition at line 19 of file StaticAccessedThroughInstanceCheck.cpp.
|
static |
Definition at line 19 of file MisleadingIndentationCheck.cpp.
|
static |
Obtain the original source code text from a SourceRange.
Definition at line 95 of file ConvertMemberFunctionsToStatic.cpp.
|
static |
Definition at line 52 of file IsolateDeclarationCheck.cpp.
|
static |
Definition at line 43 of file NamespaceCommentCheck.cpp.
|
static |
Definition at line 253 of file IdentifierNamingCheck.cpp.
|
static |
Definition at line 81 of file IsolateDeclarationCheck.cpp.
|
static |
|
static |
Definition at line 21 of file StringCompareCheck.cpp.
const char clang::tidy::readability::DefaultIgnoredFloatingPointValues[] = "1.0;100.0;" |
Definition at line 53 of file MagicNumbersCheck.cpp.
const char clang::tidy::readability::DefaultIgnoredIntegerValues[] = "1;2;3;4;" |
Definition at line 52 of file MagicNumbersCheck.cpp.
|
static |
Definition at line 20 of file SimplifySubscriptExprCheck.cpp.
|
static |
Definition at line 129 of file IdentifierNamingCheck.cpp.