clang-tools  9.0.0svn
Namespaces | Classes | Typedefs | Functions
clang::tidy::utils Namespace Reference

Namespaces

 decl_ref_expr
 
 fixit
 
 lexer
 
 options
 
 type_traits
 

Classes

class  ExceptionAnalyzer
 This class analysis if a FunctionDecl can in principle throw an exception, either directly or indirectly. More...
 
class  ExprSequence
 Provides information about the evaluation order of (sub-)expressions within a CFGBlock. More...
 
class  HeaderGuardCheck
 Finds and fixes header guards. More...
 
class  IncludeInserter
 Produces fixes to insert specified includes to source files, if not yet present. More...
 
class  IncludeInserterCallback
 
class  IncludeSorter
 Class used by IncludeInserterCallback to record the names of the inclusions in a given source file being processed and generate the necessary commands to sort the inclusions according to the precedence encoded in IncludeKinds. More...
 
class  NamespaceAliaser
 
class  StmtToBlockMap
 Maps Stmts to the CFGBlock that contains them. More...
 
class  TransformerClangTidyCheck
 
class  UsingInserter
 

Typedefs

typedef llvm::SmallSet< llvm::StringRef, 5 > HeaderFileExtensionsSet
 

Functions

const FunctionDecl * getSurroundingFunction (ASTContext &Context, const Stmt &Statement)
 
bool IsBinaryOrTernary (const Expr *E)
 
bool exprHasBitFlagWithSpelling (const Expr *Flags, const SourceManager &SM, const LangOptions &LangOpts, StringRef FlagName)
 Checks whether a macro flag is present in the given argument. More...
 
bool rangeIsEntirelyWithinMacroArgument (SourceRange Range, const SourceManager *SM)
 
bool rangeContainsMacroExpansion (SourceRange Range, const SourceManager *SM)
 
bool rangeCanBeFixed (SourceRange Range, const SourceManager *SM)
 
static bool isBaseOf (const Type *DerivedType, const Type *BaseType)
 
static SmallVector< const Stmt *, 1 > getParentStmts (const Stmt *S, ASTContext *Context)
 
bool isExpansionLocInHeaderFile (SourceLocation Loc, const SourceManager &SM, const HeaderFileExtensionsSet &HeaderFileExtensions)
 Checks whether expansion location of Loc is in header file. More...
 
bool isPresumedLocInHeaderFile (SourceLocation Loc, SourceManager &SM, const HeaderFileExtensionsSet &HeaderFileExtensions)
 Checks whether presumed location of Loc is in header file. More...
 
bool isSpellingLocInHeaderFile (SourceLocation Loc, SourceManager &SM, const HeaderFileExtensionsSet &HeaderFileExtensions)
 Checks whether spelling location of Loc is in header file. More...
 
bool parseHeaderFileExtensions (StringRef AllHeaderFileExtensions, HeaderFileExtensionsSet &HeaderFileExtensions, char delimiter)
 Parses header file extensions from a semicolon-separated list. More...
 
bool isHeaderFileExtension (StringRef FileName, const HeaderFileExtensionsSet &HeaderFileExtensions)
 Decides whether a file has a header file extension. More...
 
StringRef defaultHeaderFileExtensions ()
 Returns recommended default value for the list of header file extensions. More...
 
static std::string cleanPath (StringRef Path)
 canonicalize a path by removing ./ and ../ components. More...
 
 AST_MATCHER_P (NamespaceAliasDecl, hasTargetNamespace, ast_matchers::internal::Matcher< NamespaceDecl >, innerMatcher)
 
static StringRef getUnqualifiedName (StringRef QualifiedName)
 

Typedef Documentation

◆ HeaderFileExtensionsSet

typedef llvm::SmallSet<llvm::StringRef, 5> clang::tidy::utils::HeaderFileExtensionsSet

Definition at line 21 of file HeaderFileExtensionsUtils.h.

Function Documentation

◆ AST_MATCHER_P()

clang::tidy::utils::AST_MATCHER_P ( NamespaceAliasDecl  ,
hasTargetNamespace  ,
ast_matchers::internal::Matcher< NamespaceDecl >  ,
innerMatcher   
)

Definition at line 24 of file NamespaceAliaser.cpp.

◆ cleanPath()

static std::string clang::tidy::utils::cleanPath ( StringRef  Path)
static

canonicalize a path by removing ./ and ../ components.

Definition at line 21 of file HeaderGuard.cpp.

References Path, and Result.

◆ defaultHeaderFileExtensions()

StringRef clang::tidy::utils::defaultHeaderFileExtensions ( )
inline

Returns recommended default value for the list of header file extensions.

Definition at line 40 of file HeaderFileExtensionsUtils.h.

References FileName, isHeaderFileExtension(), and parseHeaderFileExtensions().

◆ exprHasBitFlagWithSpelling()

bool clang::tidy::utils::exprHasBitFlagWithSpelling ( const Expr *  Flags,
const SourceManager &  SM,
const LangOptions &  LangOpts,
StringRef  FlagName 
)

Checks whether a macro flag is present in the given argument.

Only considers cases of single match or match in a binary OR expression. For example, <needed-flag> or <flag> | <needed-flag> | ...

Definition at line 42 of file ASTUtils.cpp.

Referenced by clang::tidy::android::CloexecCheck::insertMacroFlag().

◆ getParentStmts()

static SmallVector<const Stmt *, 1> clang::tidy::utils::getParentStmts ( const Stmt *  S,
ASTContext *  Context 
)
static

◆ getSurroundingFunction()

const FunctionDecl * clang::tidy::utils::getSurroundingFunction ( ASTContext &  Context,
const Stmt &  Statement 
)

Definition at line 20 of file ASTUtils.cpp.

◆ getUnqualifiedName()

static StringRef clang::tidy::utils::getUnqualifiedName ( StringRef  QualifiedName)
static

Definition at line 22 of file UsingInserter.cpp.

◆ isBaseOf()

static bool clang::tidy::utils::isBaseOf ( const Type *  DerivedType,
const Type *  BaseType 
)
static

◆ IsBinaryOrTernary()

bool clang::tidy::utils::IsBinaryOrTernary ( const Expr *  E)

◆ isExpansionLocInHeaderFile()

bool clang::tidy::utils::isExpansionLocInHeaderFile ( SourceLocation  Loc,
const SourceManager &  SM,
const HeaderFileExtensionsSet HeaderFileExtensions 
)

Checks whether expansion location of Loc is in header file.

Definition at line 17 of file HeaderFileExtensionsUtils.cpp.

◆ isHeaderFileExtension()

bool clang::tidy::utils::isHeaderFileExtension ( StringRef  FileName,
const HeaderFileExtensionsSet HeaderFileExtensions 
)

◆ isPresumedLocInHeaderFile()

bool clang::tidy::utils::isPresumedLocInHeaderFile ( SourceLocation  Loc,
SourceManager &  SM,
const HeaderFileExtensionsSet HeaderFileExtensions 
)

Checks whether presumed location of Loc is in header file.

Definition at line 25 of file HeaderFileExtensionsUtils.cpp.

Referenced by clang::tidy::google::build::UnnamedNamespaceInHeaderCheck::check().

◆ isSpellingLocInHeaderFile()

bool clang::tidy::utils::isSpellingLocInHeaderFile ( SourceLocation  Loc,
SourceManager &  SM,
const HeaderFileExtensionsSet HeaderFileExtensions 
)

Checks whether spelling location of Loc is in header file.

Definition at line 33 of file HeaderFileExtensionsUtils.cpp.

Referenced by clang::tidy::google::readability::GlobalNamesInHeadersCheck::check().

◆ parseHeaderFileExtensions()

bool clang::tidy::utils::parseHeaderFileExtensions ( StringRef  AllHeaderFileExtensions,
HeaderFileExtensionsSet HeaderFileExtensions,
char  delimiter 
)

Parses header file extensions from a semicolon-separated list.

Definition at line 41 of file HeaderFileExtensionsUtils.cpp.

References Suffixes.

Referenced by defaultHeaderFileExtensions(), and clang::tidy::utils::HeaderGuardCheck::HeaderGuardCheck().

◆ rangeCanBeFixed()

bool clang::tidy::utils::rangeCanBeFixed ( SourceRange  Range,
const SourceManager *  SM 
)

Definition at line 90 of file ASTUtils.cpp.

◆ rangeContainsMacroExpansion()

bool clang::tidy::utils::rangeContainsMacroExpansion ( SourceRange  Range,
const SourceManager *  SM 
)

Definition at line 85 of file ASTUtils.cpp.

◆ rangeIsEntirelyWithinMacroArgument()

bool clang::tidy::utils::rangeIsEntirelyWithinMacroArgument ( SourceRange  Range,
const SourceManager *  SM 
)

Definition at line 69 of file ASTUtils.cpp.