clang-tools  8.0.0svn
Classes | Enumerations | Functions | Variables
clang::tidy::readability Namespace Reference

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  ContainerSizeEmptyCheck
 Checks whether a call to the size() method can be replaced with a call to empty(). 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  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  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
 @brief 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 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 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< ReadabilityModuleX ("readability-module", "Adds readability-related checks.")
 
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
 

Enumeration Type Documentation

◆ StyleKind

Enumerator
SK_Count 
SK_Invalid 

Definition at line 121 of file IdentifierNamingCheck.cpp.

Function Documentation

◆ addUsage() [1/2]

static void clang::tidy::readability::addUsage ( IdentifierNamingCheck::NamingCheckFailureMap Failures,
const IdentifierNamingCheck::NamingCheckId Decl,
SourceRange  Range,
SourceManager *  SourceMgr = nullptr 
)
static

◆ addUsage() [2/2]

static void clang::tidy::readability::addUsage ( IdentifierNamingCheck::NamingCheckFailureMap Failures,
const NamedDecl *  Decl,
SourceRange  Range,
SourceManager *  SourceMgr = nullptr 
)
static

Convenience method when the usage to be added is a NamedDecl.

Definition at line 689 of file IdentifierNamingCheck.cpp.

◆ ConstTok()

static llvm::Optional<Token> clang::tidy::readability::ConstTok ( CharSourceRange  Range,
const MatchFinder::MatchResult &  Result 
)
static

Definition at line 51 of file AvoidConstParamsInDecls.cpp.

◆ containsBoolLiteral()

bool clang::tidy::readability::containsBoolLiteral ( const Expr *  E)

Definition at line 347 of file SimplifyBooleanExprCheck.cpp.

References Range, and Result.

◆ findStyleKind()

static StyleKind clang::tidy::readability::findStyleKind ( const NamedDecl *  D,
const std::vector< llvm::Optional< IdentifierNamingCheck::NamingStyle >> &  NamingStyles 
)
static

◆ fixupWithCase()

static std::string clang::tidy::readability::fixupWithCase ( StringRef  Name,
IdentifierNamingCheck::CaseType  Case 
)
static

◆ fixupWithStyle()

static std::string clang::tidy::readability::fixupWithStyle ( StringRef  Name,
const IdentifierNamingCheck::NamingStyle Style 
)
static

Definition at line 381 of file IdentifierNamingCheck.cpp.

◆ getNamespaceComment() [1/2]

static std::string clang::tidy::readability::getNamespaceComment ( const NamespaceDecl *  ND,
bool  InsertLineBreak 
)
static

Definition at line 49 of file NamespaceCommentCheck.cpp.

References Fix().

◆ getNamespaceComment() [2/2]

static std::string clang::tidy::readability::getNamespaceComment ( const std::string &  NameSpaceName,
bool  InsertLineBreak 
)
static

Definition at line 59 of file NamespaceCommentCheck.cpp.

References Fix().

◆ getNameSpecifierNestingLevel()

static unsigned clang::tidy::readability::getNameSpecifierNestingLevel ( const QualType &  QType)
static

◆ getPrecedingIf()

static const IfStmt* clang::tidy::readability::getPrecedingIf ( const SourceManager &  SM,
ASTContext *  Context,
const IfStmt *  If 
)
static

Definition at line 20 of file MisleadingIndentationCheck.cpp.

◆ locationsInSameFile()

static bool clang::tidy::readability::locationsInSameFile ( const SourceManager &  Sources,
SourceLocation  Loc1,
SourceLocation  Loc2 
)
static

◆ matchesStyle()

static bool clang::tidy::readability::matchesStyle ( StringRef  Name,
IdentifierNamingCheck::NamingStyle  Style 
)
static

Definition at line 250 of file IdentifierNamingCheck.cpp.

◆ X()

static ClangTidyModuleRegistry::Add<ReadabilityModule> clang::tidy::readability::X ( "readability-module"  ,
"Adds readability-related checks."   
)
static

Variable Documentation

◆ CompareMessage

const StringRef clang::tidy::readability::CompareMessage
static
Initial value:
= "do not use 'compare' to test equality "
"of strings; use the string equality "
"operator instead"

Definition at line 22 of file StringCompareCheck.cpp.

Referenced by clang::tidy::readability::StringCompareCheck::check().

◆ DefaultIgnoredFloatingPointValues

const char clang::tidy::readability::DefaultIgnoredFloatingPointValues[] = "1.0;100.0;"

Definition at line 54 of file MagicNumbersCheck.cpp.

◆ DefaultIgnoredIntegerValues

const char clang::tidy::readability::DefaultIgnoredIntegerValues[] = "1;2;3;4;"

Definition at line 53 of file MagicNumbersCheck.cpp.

◆ kDefaultTypes

const char clang::tidy::readability::kDefaultTypes[]
static
Initial value:
=
"::std::basic_string;::std::basic_string_view;::std::vector;::std::array"

Definition at line 21 of file SimplifySubscriptExprCheck.cpp.

◆ StyleNames

StringRef const clang::tidy::readability::StyleNames[]
static
Initial value:
= {
#define STRINGIZE(v)
}

Definition at line 129 of file IdentifierNamingCheck.cpp.