clang-tools 6.0.0

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 | 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 | 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 | UniqueptrDeleteReleaseCheck
| Flags statements of the form `delete <unique_ptr expr>.release();` and replaces them with: `<unique_ptr expr> = nullptr;` 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 ClangTidyModuleRegistry::Add< ReadabilityModule > | X ("readability-module", "Adds readability-related checks.")
bool | containsBoolLiteral (const Expr *E)
static unsigned | getNameSpecifierNestingLevel (const QualType &QType)

## Variables
static StringRef const | StyleNames []

## Enumeration Type Documentation

## ◆ StyleKind

enum clang::tidy::readability::StyleKind

Enumerator
SK_Count |
SK_Invalid |

Definition at line 113 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

Definition at line 629 of file IdentifierNamingCheck.cpp.

Referenced by clang::tidy::readability::IdentifierNamingCheck::check(), clang::tidy::readability::IdentifierNamingCheck::expandMacro(), and clang::tidy::modernize::ForLoopIndexUseVisitor::getUsages().

## ◆ 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 677 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.

References File, and Info.

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

## ◆ containsBoolLiteral()

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

Definition at line 344 of file SimplifyBooleanExprCheck.cpp.

References Range.

## ◆ findStyleKind()

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

Definition at line 383 of file IdentifierNamingCheck.cpp.

References SK_Invalid.

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

## ◆ fixupWithCase()

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

Definition at line 276 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, and Name.

Referenced by clang::tidy::readability::IdentifierNamingCheck::check(), and fixupWithStyle().

## ◆ fixupWithStyle()

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

Definition at line 373 of file IdentifierNamingCheck.cpp.

References clang::tidy::readability::IdentifierNamingCheck::NamingStyle::Case, fixupWithCase(), clang::tidy::readability::IdentifierNamingCheck::NamingStyle::Prefix, and clang::tidy::readability::IdentifierNamingCheck::NamingStyle::Suffix.

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

## ◆ getNamespaceComment()

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

Definition at line 49 of file NamespaceCommentCheck.cpp.

References Fix().

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

## ◆ getNameSpecifierNestingLevel()

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

Definition at line 20 of file StaticAccessedThroughInstanceCheck.cpp.

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

## ◆ 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

Definition at line 43 of file NamespaceCommentCheck.cpp.

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

## ◆ matchesStyle()

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

Definition at line 242 of file IdentifierNamingCheck.cpp.

References clang::tidy::readability::IdentifierNamingCheck::NamingStyle::Case, clang::tidy::readability::IdentifierNamingCheck::NamingStyle::Prefix, and clang::tidy::readability::IdentifierNamingCheck::NamingStyle::Suffix.

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

## ◆ X()

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

Referenced by clang::tidy::readability::ReadabilityModule::addCheckFactories().

## Variable Documentation

## ◆ StyleNames

StringRef const clang::tidy::readability::StyleNames[]
| static

Initial value:
= {
#define STRINGIZE(v)
}

Definition at line 121 of file IdentifierNamingCheck.cpp.