clang-tools 20.0.0git
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
clang::tidy Namespace Reference

Namespaces

namespace  abseil
 
namespace  altera
 
namespace  android
 
namespace  boost
 
namespace  bugprone
 
namespace  cert
 
namespace  concurrency
 
namespace  cppcoreguidelines
 
namespace  darwin
 
namespace  fuchsia
 
namespace  google
 
namespace  hicpp
 
namespace  linuxkernel
 
namespace  llvm_check
 
namespace  llvm_libc
 
namespace  matchers
 
namespace  misc
 
namespace  modernize
 
namespace  mpi
 
namespace  objc
 
namespace  openmp
 
namespace  performance
 
namespace  portability
 
namespace  readability
 
namespace  utils
 
namespace  zircon
 

Classes

class  CachedGlobList
 A GlobList that caches search results, so that search is performed only once for the same query. More...
 
class  ClangTidyASTConsumerFactory
 
class  ClangTidyCheck
 Base class for all clang-tidy checks. More...
 
class  ClangTidyCheckFactories
 A collection of ClangTidyCheckFactory instances. More...
 
class  ClangTidyContext
 Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context. More...
 
class  ClangTidyDiagnosticConsumer
 A diagnostic consumer that turns each Diagnostic into a SourceManager-independent ClangTidyError. More...
 
struct  ClangTidyError
 A detected error complete with information to display diagnostic and automatic fix. More...
 
struct  ClangTidyGlobalOptions
 Global options. More...
 
class  ClangTidyModule
 A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name. More...
 
struct  ClangTidyOptions
 Contains options for clang-tidy. More...
 
class  ClangTidyOptionsProvider
 Abstract interface for retrieving various ClangTidy options. More...
 
class  ClangTidyPluginAction
 The core clang tidy plugin action. More...
 
class  ClangTidyProfiling
 
struct  ClangTidyStats
 Contains displayed and ignored diagnostic counters for a ClangTidy run. More...
 
class  ConfigOptionsProvider
 Implementation of ClangTidyOptions interface, which is used for '-config' command-line option. More...
 
class  DefaultOptionsProvider
 Implementation of the ClangTidyOptionsProvider interface, which returns the same options for all files. More...
 
struct  FileFilter
 Contains a list of line ranges in a single file. More...
 
class  FileOptionsBaseProvider
 
class  FileOptionsProvider
 Implementation of the ClangTidyOptionsProvider interface, which tries to find a configuration file in the closest parent directory of each source file. More...
 
class  GlobList
 Read-only set of strings represented as a list of positive and negative globs. More...
 
struct  NamesAndOptions
 
class  NoLintDirectiveHandler
 This class is used to locate NOLINT comments in the file being analyzed, to decide whether a diagnostic should be suppressed. More...
 
struct  OptionEnumMapping
 This class should be specialized by any enum type that needs to be converted to and from an llvm::StringRef. More...
 
struct  OptionEnumMapping< bugprone::SignalHandlerCheck::AsyncSafeFunctionSetKind >
 
struct  OptionEnumMapping< concurrency::MtUnsafeCheck::FunctionSet >
 
struct  OptionEnumMapping< misc::UseInternalLinkageCheck::FixModeKind >
 
struct  OptionEnumMapping< modernize::Confidence::Level >
 
struct  OptionEnumMapping< modernize::VariableNamer::NamingStyle >
 
struct  OptionEnumMapping< readability::IdentifierNamingCheck::CaseType >
 
struct  OptionEnumMapping< readability::IdentifierNamingCheck::HungarianPrefixType >
 
struct  OptionEnumMapping< utils::IncludeSorter::IncludeStyle >
 
class  RenamerClangTidyCheck
 Base class for clang-tidy checks that want to flag declarations and/or macros for renaming based on customizable criteria. More...
 

Typedefs

using ClangTidyModuleRegistry = llvm::Registry< ClangTidyModule >
 
using DiagCallback = llvm::function_ref< void(const llvm::SMDiagnostic &)>
 
using FileExtensionsSet = llvm::SmallSet< llvm::StringRef, 5 >
 

Enumerations

enum  FixBehaviour { FB_NoFix , FB_Fix , FB_FixNotes }
 Controls what kind of fixes clang-tidy is allowed to apply. More...
 
enum class  NoLintType { NoLint , NoLintNextLine , NoLintBegin , NoLintEnd }
 

Functions

static ClangTidyModuleRegistry::Add< altera::AlteraModuleX ("altera-module", "Adds Altera FPGA OpenCL lint checks.")
 
static ClangTidyModuleRegistry::Add< bugprone::BugproneModuleX ("bugprone-module", "Adds checks for bugprone code constructs.")
 
static ClangTidyModuleRegistry::Add< cert::CERTModuleX ("cert-module", "Adds lint checks corresponding to CERT secure coding guidelines.")
 
std::vector< std::string > getCheckNames (const ClangTidyOptions &Options, bool AllowEnablingAnalyzerAlphaCheckers)
 Fills the list of check names that are enabled when the provided filters are applied.
 
ClangTidyOptions::OptionMap getCheckOptions (const ClangTidyOptions &Options, bool AllowEnablingAnalyzerAlphaCheckers)
 Returns the effective check-specific options.
 
std::vector< ClangTidyErrorrunClangTidy (clang::tidy::ClangTidyContext &Context, const CompilationDatabase &Compilations, ArrayRef< std::string > InputFiles, llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > BaseFS, bool ApplyAnyFix, bool EnableCheckProfile, llvm::StringRef StoreCheckProfile)
 
void handleErrors (llvm::ArrayRef< ClangTidyError > Errors, ClangTidyContext &Context, FixBehaviour Fix, unsigned &WarningsAsErrorsCount, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS)
 Displays the found Errors to the users.
 
void exportReplacements (const llvm::StringRef MainFilePath, const std::vector< ClangTidyError > &Errors, raw_ostream &OS)
 
NamesAndOptions getAllChecksAndOptions (bool AllowEnablingAnalyzerAlphaCheckers)
 
std::vector< ClangTidyErrorrunClangTidy (clang::tidy::ClangTidyContext &Context, const tooling::CompilationDatabase &Compilations, ArrayRef< std::string > InputFiles, llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > BaseFS, bool ApplyAnyFix, bool EnableCheckProfile=false, llvm::StringRef StoreCheckProfile=StringRef())
 Run a set of clang-tidy checks on a set of files.
 
void exportReplacements (StringRef MainFilePath, const std::vector< ClangTidyError > &Errors, raw_ostream &OS)
 Serializes replacements into YAML and writes them to the specified output stream.
 
static ClangTidyOptions::OptionMap::const_iterator findPriorityOption (const ClangTidyOptions::OptionMap &Options, StringRef NamePrefix, StringRef LocalName, llvm::StringSet<> *Collector)
 
static std::optional< bool > getAsBool (StringRef Value, const llvm::Twine &LookupName)
 
static constexpr llvm::StringLiteral ConfigWarning ("invalid configuration value '%0' for option '%1'%select{|; expected a " "bool|; expected an integer|; did you mean '%3'?}2")
 
const llvm::StringMap< tooling::Replacements > * getFixIt (const tooling::Diagnostic &Diagnostic, bool AnyFix)
 Gets the Fix attached to Diagnostic.
 
template<typename T >
static void mergeVectors (std::optional< T > &Dest, const std::optional< T > &Src)
 
static void mergeCommaSeparatedLists (std::optional< std::string > &Dest, const std::optional< std::string > &Src)
 
template<typename T >
static void overrideValue (std::optional< T > &Dest, const std::optional< T > &Src)
 
std::error_code parseLineFilter (StringRef LineFilter, clang::tidy::ClangTidyGlobalOptions &Options)
 Parses -line-filter option and stores it to the Options.
 
llvm::ErrorOr< ClangTidyOptionsparseConfiguration (llvm::MemoryBufferRef Config)
 Parses configuration from JSON and returns ClangTidyOptions or an error.
 
static void diagHandlerImpl (const llvm::SMDiagnostic &Diag, void *Ctx)
 
llvm::ErrorOr< ClangTidyOptionsparseConfigurationWithDiags (llvm::MemoryBufferRef Config, DiagCallback Handler)
 
std::string configurationAsText (const ClangTidyOptions &Options)
 Serializes configuration to a YAML-encoded string.
 
std::error_code parseLineFilter (llvm::StringRef LineFilter, ClangTidyGlobalOptions &Options)
 Parses LineFilter from JSON and stores it to the Options.
 
static ClangTidyModuleRegistry::Add< concurrency::ConcurrencyModuleX ("concurrency-module", "Adds concurrency checks.")
 
static ClangTidyModuleRegistry::Add< darwin::DarwinModuleX ("darwin-module", "Adds Darwin-specific lint checks.")
 
static bool consumeNegativeIndicator (StringRef &GlobList)
 
static llvm::StringRef extractNextGlob (StringRef &GlobList)
 
static llvm::Regex createRegexFromGlob (StringRef &Glob)
 
static ClangTidyModuleRegistry::Add< misc::MiscModuleX ("misc-module", "Adds miscellaneous lint checks.")
 
static ClangTidyModuleRegistry::Add< mpi::MPIModuleX ("mpi-module", "Adds MPI clang-tidy checks.")
 
static std::optional< NoLintTypestrToNoLintType (StringRef Str)
 
static std::string trimWhitespace (StringRef Checks)
 
static SmallVector< NoLintToken > getNoLints (StringRef Buffer)
 
static SmallVector< NoLintBlockToken > formNoLintBlocks (SmallVector< NoLintToken > NoLints, SmallVectorImpl< NoLintToken > &UnmatchedTokens)
 
static std::pair< size_t, size_t > getLineStartAndEnd (StringRef Buffer, size_t From)
 
static bool lineHasNoLint (StringRef Buffer, std::pair< size_t, size_t > LineStartAndEnd, NoLintType Type, StringRef DiagName)
 
static bool withinNoLintBlock (ArrayRef< NoLintBlockToken > NoLintBlocks, size_t DiagPos, StringRef DiagName)
 
static std::optional< StringRef > getBuffer (const SourceManager &SrcMgr, FileID File, bool AllowIO)
 
static tooling::Diagnostic makeNoLintError (const SourceManager &SrcMgr, FileID File, const NoLintToken &NoLint)
 
static void printStats (const ClangTidyStats &Stats)
 
static std::unique_ptr< ClangTidyOptionsProvidercreateOptionsProvider (llvm::IntrusiveRefCntPtr< vfs::FileSystem > FS)
 
llvm::IntrusiveRefCntPtr< vfs::FileSystem > getVfsFromFile (const std::string &OverlayFile, llvm::IntrusiveRefCntPtr< vfs::FileSystem > BaseFS)
 
static StringRef closest (StringRef Value, const StringSet<> &Allowed)
 
static bool verifyChecks (const StringSet<> &AllChecks, StringRef CheckGlob, StringRef Source)
 
static bool verifyFileExtensions (const std::vector< std::string > &HeaderFileExtensions, const std::vector< std::string > &ImplementationFileExtensions, StringRef Source)
 
static SmallString< 256 > makeAbsolute (llvm::StringRef Input)
 
static llvm::IntrusiveRefCntPtr< vfs::OverlayFileSystem > createBaseFS ()
 
int clangTidyMain (int argc, const char **argv)
 
static const NamedDecl * findDecl (const RecordDecl &RecDecl, StringRef DeclName)
 
static const CXXMethodDecl * getOverrideMethod (const CXXMethodDecl *Method)
 Returns the function that Method is overridding.
 
static bool hasNoName (const NamedDecl *Decl)
 
static const NamedDecl * getFailureForNamedDecl (const NamedDecl *ND)
 
static NameLookup findDeclInBases (const CXXRecordDecl &Parent, StringRef DeclName, bool AggressiveTemplateLookup)
 Returns a decl matching the DeclName in Parent or one of its base classes.
 
static std::string getDiagnosticSuffix (const RenamerClangTidyCheck::ShouldFixStatus FixStatus, const std::string &Fixup)
 

Variables

volatile int AbseilModuleAnchorSource = 0
 
volatile int AlteraModuleAnchorSource = 0
 
volatile int AndroidModuleAnchorSource = 0
 
volatile int BoostModuleAnchorSource = 0
 
volatile int BugproneModuleAnchorSource = 0
 
volatile int CERTModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination
 
static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination
 
static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination
 
static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination
 
static int LLVM_ATTRIBUTE_UNUSED BugproneModuleAnchorDestination
 
static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination
 
volatile int ConcurrencyModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED ConcurrencyModuleAnchorDestination
 
volatile int CppCoreGuidelinesModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination
 
volatile int DarwinModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination
 
volatile int FuchsiaModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination
 
volatile int GoogleModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination
 
volatile int HICPPModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination
 
volatile int LinuxKernelModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED LinuxKernelModuleAnchorDestination
 
volatile int LLVMModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination
 
volatile int LLVMLibcModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED LLVMLibcModuleAnchorDestination
 
volatile int MiscModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination
 
volatile int ModernizeModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination
 
volatile int ObjCModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED ObjCModuleAnchorDestination
 
volatile int OpenMPModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination
 
volatile int PerformanceModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination
 
volatile int PortabilityModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination
 
volatile int ReadabilityModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination
 
volatile int ZirconModuleAnchorSource = 0
 
static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination
 
volatile int MPIModuleAnchorSource = 0
 
static constexpr StringLiteral VerifyConfigWarningEnd = " [-verify-config]\n"
 

Typedef Documentation

◆ ClangTidyModuleRegistry

using clang::tidy::ClangTidyModuleRegistry = typedef llvm::Registry<ClangTidyModule>

Definition at line 17 of file ClangTidyModuleRegistry.h.

◆ DiagCallback

using clang::tidy::DiagCallback = typedef llvm::function_ref<void(const llvm::SMDiagnostic &)>

Definition at line 323 of file ClangTidyOptions.h.

◆ FileExtensionsSet

using clang::tidy::FileExtensionsSet = typedef llvm::SmallSet<llvm::StringRef, 5>

Definition at line 16 of file FileExtensionsSet.h.

Enumeration Type Documentation

◆ FixBehaviour

Controls what kind of fixes clang-tidy is allowed to apply.

Enumerator
FB_NoFix 

Don't try to apply any fix.

FB_Fix 

Only apply fixes added to warnings.

FB_FixNotes 

Apply fixes found in notes.

Definition at line 95 of file ClangTidy.h.

◆ NoLintType

enum class clang::tidy::NoLintType
strong
Enumerator
NoLint 
NoLintNextLine 
NoLintBegin 
NoLintEnd 

Definition at line 43 of file NoLintDirectiveHandler.cpp.

Function Documentation

◆ clangTidyMain()

int clang::tidy::clangTidyMain ( int  argc,
const char **  argv 
)

Definition at line 357 of file ClangTidyMain.cpp.

Referenced by main().

◆ closest()

static StringRef clang::tidy::closest ( StringRef  Value,
const StringSet<> &  Allowed 
)
static

Definition at line 269 of file ClangTidyMain.cpp.

References desc().

◆ configurationAsText()

std::string clang::tidy::configurationAsText ( const ClangTidyOptions Options)

Serializes configuration to a YAML-encoded string.

Definition at line 497 of file ClangTidyOptions.cpp.

References Output, and Text.

Referenced by clang::clangd::ParsedAST::build().

◆ ConfigWarning()

static constexpr llvm::StringLiteral clang::tidy::ConfigWarning ( "invalid configuration value '%0' for option '%1'%select{|; expected a " "bool|; expected an integer|; did you mean '%3'?}2"  )
staticconstexpr

◆ consumeNegativeIndicator()

static bool clang::tidy::consumeNegativeIndicator ( StringRef &  GlobList)
static

Definition at line 17 of file GlobList.cpp.

Referenced by clang::tidy::GlobList::GlobList().

◆ createBaseFS()

static llvm::IntrusiveRefCntPtr< vfs::OverlayFileSystem > clang::tidy::createBaseFS ( )
static

Definition at line 343 of file ClangTidyMain.cpp.

◆ createOptionsProvider()

static std::unique_ptr< ClangTidyOptionsProvider > clang::tidy::createOptionsProvider ( llvm::IntrusiveRefCntPtr< vfs::FileSystem >  FS)
static

Definition at line 169 of file ClangTidyMain.cpp.

References desc().

◆ createRegexFromGlob()

static llvm::Regex clang::tidy::createRegexFromGlob ( StringRef &  Glob)
static

Definition at line 32 of file GlobList.cpp.

References C.

Referenced by clang::tidy::GlobList::GlobList().

◆ diagHandlerImpl()

static void clang::tidy::diagHandlerImpl ( const llvm::SMDiagnostic &  Diag,
void *  Ctx 
)
static

Definition at line 481 of file ClangTidyOptions.cpp.

Referenced by parseConfigurationWithDiags().

◆ exportReplacements() [1/2]

void clang::tidy::exportReplacements ( const llvm::StringRef  MainFilePath,
const std::vector< ClangTidyError > &  Errors,
raw_ostream &  OS 
)

Definition at line 633 of file ClangTidy.cpp.

References Error, Errors, and OS.

◆ exportReplacements() [2/2]

void clang::tidy::exportReplacements ( StringRef  MainFilePath,
const std::vector< ClangTidyError > &  Errors,
raw_ostream &  OS 
)

Serializes replacements into YAML and writes them to the specified output stream.

◆ extractNextGlob()

static llvm::StringRef clang::tidy::extractNextGlob ( StringRef &  GlobList)
static

Definition at line 25 of file GlobList.cpp.

Referenced by clang::tidy::GlobList::GlobList().

◆ findDecl()

static const NamedDecl * clang::tidy::findDecl ( const RecordDecl &  RecDecl,
StringRef  DeclName 
)
static

Definition at line 85 of file RenamerClangTidyCheck.cpp.

References Decl.

Referenced by findDeclInBases().

◆ findDeclInBases()

static NameLookup clang::tidy::findDeclInBases ( const CXXRecordDecl &  Parent,
StringRef  DeclName,
bool  AggressiveTemplateLookup 
)
static

Returns a decl matching the DeclName in Parent or one of its base classes.

If AggressiveTemplateLookup is true then it will check template dependent base classes as well. If a matching decl is found in multiple base classes then it will return a flag indicating the multiple resolutions.

Definition at line 142 of file RenamerClangTidyCheck.cpp.

References findDecl(), findDeclInBases(), and Parent.

Referenced by findDeclInBases().

◆ findPriorityOption()

static ClangTidyOptions::OptionMap::const_iterator clang::tidy::findPriorityOption ( const ClangTidyOptions::OptionMap Options,
StringRef  NamePrefix,
StringRef  LocalName,
llvm::StringSet<> *  Collector 
)
static

◆ formNoLintBlocks()

static SmallVector< NoLintBlockToken > clang::tidy::formNoLintBlocks ( SmallVector< NoLintToken >  NoLints,
SmallVectorImpl< NoLintToken > &  UnmatchedTokens 
)
static

Definition at line 186 of file NoLintDirectiveHandler.cpp.

References NoLint, NoLintBegin, and NoLintEnd.

◆ getAllChecksAndOptions()

NamesAndOptions clang::tidy::getAllChecksAndOptions ( bool  AllowEnablingAnalyzerAlphaCheckers)

Definition at line 650 of file ClangTidy.cpp.

References AllowEnablingAnalyzerAlphaCheckers().

◆ getAsBool()

static std::optional< bool > clang::tidy::getAsBool ( StringRef  Value,
const llvm::Twine &  LookupName 
)
static

Definition at line 93 of file ClangTidyCheck.cpp.

◆ getBuffer()

static std::optional< StringRef > clang::tidy::getBuffer ( const SourceManager &  SrcMgr,
FileID  File,
bool  AllowIO 
)
static

Definition at line 307 of file NoLintDirectiveHandler.cpp.

◆ getCheckNames()

std::vector< std::string > clang::tidy::getCheckNames ( const ClangTidyOptions Options,
bool  AllowEnablingAnalyzerAlphaCheckers 
)

Fills the list of check names that are enabled when the provided filters are applied.

Definition at line 501 of file ClangTidy.cpp.

References AllowEnablingAnalyzerAlphaCheckers(), and clang::tidy::ClangTidyASTConsumerFactory::getCheckNames().

◆ getCheckOptions()

ClangTidyOptions::OptionMap clang::tidy::getCheckOptions ( const ClangTidyOptions Options,
bool  AllowEnablingAnalyzerAlphaCheckers 
)

Returns the effective check-specific options.

The method configures ClangTidy with the specified Options and collects effective options from all created checks. The returned set of options includes default check-specific options for all keys not overridden by Options.

Definition at line 512 of file ClangTidy.cpp.

References AllowEnablingAnalyzerAlphaCheckers(), DiagConsumer, and clang::tidy::ClangTidyASTConsumerFactory::getCheckOptions().

◆ getDiagnosticSuffix()

static std::string clang::tidy::getDiagnosticSuffix ( const RenamerClangTidyCheck::ShouldFixStatus  FixStatus,
const std::string &  Fixup 
)
static

◆ getFailureForNamedDecl()

static const NamedDecl * clang::tidy::getFailureForNamedDecl ( const NamedDecl *  ND)
static

◆ getFixIt()

const llvm::StringMap< tooling::Replacements > * clang::tidy::getFixIt ( const tooling::Diagnostic &  Diagnostic,
bool  AnyFix 
)

Gets the Fix attached to Diagnostic.

If there isn't a Fix attached to the diagnostic and AnyFix is true, Check to see if exactly one note has a Fix and return it. Otherwise return nullptr.

Definition at line 353 of file ClangTidyDiagnosticConsumer.cpp.

References Diagnostic.

◆ getLineStartAndEnd()

static std::pair< size_t, size_t > clang::tidy::getLineStartAndEnd ( StringRef  Buffer,
size_t  From 
)
static

Definition at line 275 of file NoLintDirectiveHandler.cpp.

◆ getNoLints()

static SmallVector< NoLintToken > clang::tidy::getNoLints ( StringRef  Buffer)
static

Definition at line 112 of file NoLintDirectiveHandler.cpp.

References Pos, and strToNoLintType().

Referenced by lineHasNoLint().

◆ getOverrideMethod()

static const CXXMethodDecl * clang::tidy::getOverrideMethod ( const CXXMethodDecl *  Method)
static

Returns the function that Method is overridding.

If There are none or multiple overrides it returns nullptr. If the overridden function itself is overridding then it will recurse up to find the first decl of the function.

Definition at line 99 of file RenamerClangTidyCheck.cpp.

Referenced by getFailureForNamedDecl().

◆ getVfsFromFile()

llvm::IntrusiveRefCntPtr< vfs::FileSystem > clang::tidy::getVfsFromFile ( const std::string &  OverlayFile,
llvm::IntrusiveRefCntPtr< vfs::FileSystem >  BaseFS 
)

Definition at line 248 of file ClangTidyMain.cpp.

References desc().

◆ handleErrors()

void clang::tidy::handleErrors ( llvm::ArrayRef< ClangTidyError Errors,
ClangTidyContext Context,
FixBehaviour  Fix,
unsigned &  WarningsAsErrorsCount,
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem >  BaseFS 
)

Displays the found Errors to the users.

If Fix is FB_Fix or FB_FixNotes, Errors containing fixes are automatically applied and reformatted. If no clang-format configuration file is found, the given \P FormatStyle is used.

Definition at line 606 of file ClangTidy.cpp.

References Error, Errors, and Fix().

◆ hasNoName()

static bool clang::tidy::hasNoName ( const NamedDecl *  Decl)
static

Definition at line 114 of file RenamerClangTidyCheck.cpp.

References Decl.

Referenced by clang::tidy::RenamerClangTidyCheck::addUsage().

◆ lineHasNoLint()

static bool clang::tidy::lineHasNoLint ( StringRef  Buffer,
std::pair< size_t, size_t >  LineStartAndEnd,
NoLintType  Type,
StringRef  DiagName 
)
static

Definition at line 284 of file NoLintDirectiveHandler.cpp.

References getNoLints(), NoLint, and Type.

◆ makeAbsolute()

static SmallString< 256 > clang::tidy::makeAbsolute ( llvm::StringRef  Input)
static

Definition at line 332 of file ClangTidyMain.cpp.

◆ makeNoLintError()

static tooling::Diagnostic clang::tidy::makeNoLintError ( const SourceManager &  SrcMgr,
FileID  File,
const NoLintToken &  NoLint 
)
static

Definition at line 363 of file NoLintDirectiveHandler.cpp.

References Error, Loc, NoLint, and NoLintBegin.

◆ mergeCommaSeparatedLists()

static void clang::tidy::mergeCommaSeparatedLists ( std::optional< std::string > &  Dest,
const std::optional< std::string > &  Src 
)
static

Definition at line 217 of file ClangTidyOptions.cpp.

References Src.

Referenced by clang::tidy::ClangTidyOptions::mergeWith().

◆ mergeVectors()

template<typename T >
static void clang::tidy::mergeVectors ( std::optional< T > &  Dest,
const std::optional< T > &  Src 
)
static

Definition at line 208 of file ClangTidyOptions.cpp.

References Src.

Referenced by clang::tidy::ClangTidyOptions::mergeWith().

◆ overrideValue()

template<typename T >
static void clang::tidy::overrideValue ( std::optional< T > &  Dest,
const std::optional< T > &  Src 
)
static

Definition at line 224 of file ClangTidyOptions.cpp.

References Src.

Referenced by clang::tidy::ClangTidyOptions::mergeWith().

◆ parseConfiguration()

llvm::ErrorOr< ClangTidyOptions > clang::tidy::parseConfiguration ( llvm::MemoryBufferRef  Config)

Parses configuration from JSON and returns ClangTidyOptions or an error.

Definition at line 472 of file ClangTidyOptions.cpp.

References Config().

Referenced by clang::tidy::FileOptionsBaseProvider::FileOptionsBaseProvider().

◆ parseConfigurationWithDiags()

llvm::ErrorOr< ClangTidyOptions > clang::tidy::parseConfigurationWithDiags ( llvm::MemoryBufferRef  Config,
DiagCallback  Handler 
)

Definition at line 486 of file ClangTidyOptions.cpp.

References Config(), and diagHandlerImpl().

◆ parseLineFilter() [1/2]

std::error_code clang::tidy::parseLineFilter ( llvm::StringRef  LineFilter,
ClangTidyGlobalOptions Options 
)

Parses LineFilter from JSON and stores it to the Options.

◆ parseLineFilter() [2/2]

std::error_code clang::tidy::parseLineFilter ( StringRef  LineFilter,
clang::tidy::ClangTidyGlobalOptions Options 
)

Parses -line-filter option and stores it to the Options.

Definition at line 464 of file ClangTidyOptions.cpp.

References clang::tidy::ClangTidyGlobalOptions::LineFilter, and LineFilter().

◆ printStats()

static void clang::tidy::printStats ( const ClangTidyStats Stats)
static

Definition at line 141 of file ClangTidyMain.cpp.

References desc().

◆ runClangTidy() [1/2]

std::vector< ClangTidyError > clang::tidy::runClangTidy ( clang::tidy::ClangTidyContext Context,
const CompilationDatabase &  Compilations,
ArrayRef< std::string >  InputFiles,
llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem >  BaseFS,
bool  ApplyAnyFix,
bool  EnableCheckProfile,
llvm::StringRef  StoreCheckProfile 
)

◆ runClangTidy() [2/2]

std::vector< ClangTidyError > clang::tidy::runClangTidy ( clang::tidy::ClangTidyContext Context,
const tooling::CompilationDatabase &  Compilations,
ArrayRef< std::string >  InputFiles,
llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem >  BaseFS,
bool  ApplyAnyFix,
bool  EnableCheckProfile = false,
llvm::StringRef  StoreCheckProfile = StringRef() 
)

Run a set of clang-tidy checks on a set of files.

Parameters
EnableCheckProfileIf provided, it enables check profile collection in MatchFinder, and will contain the result of the profile.
StoreCheckProfileIf provided, and EnableCheckProfile is true, the profile will not be output to stderr, but will instead be stored as a JSON file in the specified directory.

◆ strToNoLintType()

static std::optional< NoLintType > clang::tidy::strToNoLintType ( StringRef  Str)
static

Definition at line 47 of file NoLintDirectiveHandler.cpp.

References NoLint, NoLintBegin, NoLintEnd, NoLintNextLine, and Type.

Referenced by getNoLints().

◆ trimWhitespace()

static std::string clang::tidy::trimWhitespace ( StringRef  Checks)
static

Definition at line 64 of file NoLintDirectiveHandler.cpp.

◆ verifyChecks()

static bool clang::tidy::verifyChecks ( const StringSet<> &  AllChecks,
StringRef  CheckGlob,
StringRef  Source 
)
static

Definition at line 284 of file ClangTidyMain.cpp.

References desc().

◆ verifyFileExtensions()

static bool clang::tidy::verifyFileExtensions ( const std::vector< std::string > &  HeaderFileExtensions,
const std::vector< std::string > &  ImplementationFileExtensions,
StringRef  Source 
)
static

Definition at line 312 of file ClangTidyMain.cpp.

References desc().

◆ withinNoLintBlock()

static bool clang::tidy::withinNoLintBlock ( ArrayRef< NoLintBlockToken >  NoLintBlocks,
size_t  DiagPos,
StringRef  DiagName 
)
static

Definition at line 299 of file NoLintDirectiveHandler.cpp.

◆ X() [1/7]

static ClangTidyModuleRegistry::Add< altera::AlteraModule > clang::tidy::X ( "altera-module"  ,
"Adds Altera FPGA OpenCL lint checks."   
)
static

◆ X() [2/7]

static ClangTidyModuleRegistry::Add< bugprone::BugproneModule > clang::tidy::X ( "bugprone-module"  ,
"Adds checks for bugprone code constructs."   
)
static

◆ X() [3/7]

static ClangTidyModuleRegistry::Add< cert::CERTModule > clang::tidy::X ( "cert-module"  ,
"Adds lint checks corresponding to CERT secure coding guidelines."   
)
static

◆ X() [4/7]

static ClangTidyModuleRegistry::Add< concurrency::ConcurrencyModule > clang::tidy::X ( "concurrency-module"  ,
"Adds concurrency checks."   
)
static

◆ X() [5/7]

static ClangTidyModuleRegistry::Add< darwin::DarwinModule > clang::tidy::X ( "darwin-module"  ,
"Adds Darwin-specific lint checks."   
)
static

◆ X() [6/7]

static ClangTidyModuleRegistry::Add< misc::MiscModule > clang::tidy::X ( "misc-module"  ,
"Adds miscellaneous lint checks."   
)
static

◆ X() [7/7]

static ClangTidyModuleRegistry::Add< mpi::MPIModule > clang::tidy::X ( "mpi-module"  ,
"Adds MPI clang-tidy checks."   
)
static

Variable Documentation

◆ AbseilModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::AbseilModuleAnchorDestination
static
Initial value:

Definition at line 19 of file ClangTidyForceLinker.h.

◆ AbseilModuleAnchorSource

volatile int clang::tidy::AbseilModuleAnchorSource = 0

Definition at line 85 of file AbseilTidyModule.cpp.

◆ AlteraModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::AlteraModuleAnchorDestination
static
Initial value:

Definition at line 24 of file ClangTidyForceLinker.h.

◆ AlteraModuleAnchorSource

volatile int clang::tidy::AlteraModuleAnchorSource = 0

Definition at line 46 of file AlteraTidyModule.cpp.

◆ AndroidModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::AndroidModuleAnchorDestination
static
Initial value:

Definition at line 29 of file ClangTidyForceLinker.h.

◆ AndroidModuleAnchorSource

volatile int clang::tidy::AndroidModuleAnchorSource = 0

Definition at line 69 of file AndroidTidyModule.cpp.

◆ BoostModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::BoostModuleAnchorDestination
static
Initial value:

Definition at line 34 of file ClangTidyForceLinker.h.

◆ BoostModuleAnchorSource

volatile int clang::tidy::BoostModuleAnchorSource = 0

Definition at line 35 of file BoostTidyModule.cpp.

◆ BugproneModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::BugproneModuleAnchorDestination
static
Initial value:

Definition at line 39 of file ClangTidyForceLinker.h.

◆ BugproneModuleAnchorSource

volatile int clang::tidy::BugproneModuleAnchorSource = 0

Definition at line 282 of file BugproneTidyModule.cpp.

◆ CERTModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::CERTModuleAnchorDestination
static
Initial value:

Definition at line 44 of file ClangTidyForceLinker.h.

◆ CERTModuleAnchorSource

volatile int clang::tidy::CERTModuleAnchorSource = 0

Definition at line 363 of file CERTTidyModule.cpp.

◆ ConcurrencyModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::ConcurrencyModuleAnchorDestination
static
Initial value:

Definition at line 49 of file ClangTidyForceLinker.h.

◆ ConcurrencyModuleAnchorSource

volatile int clang::tidy::ConcurrencyModuleAnchorSource = 0

Definition at line 36 of file ConcurrencyTidyModule.cpp.

◆ CppCoreGuidelinesModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::CppCoreGuidelinesModuleAnchorDestination
static
Initial value:

Definition at line 54 of file ClangTidyForceLinker.h.

◆ CppCoreGuidelinesModuleAnchorSource

volatile int clang::tidy::CppCoreGuidelinesModuleAnchorSource = 0

Definition at line 159 of file CppCoreGuidelinesTidyModule.cpp.

◆ DarwinModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::DarwinModuleAnchorDestination
static
Initial value:

Definition at line 59 of file ClangTidyForceLinker.h.

◆ DarwinModuleAnchorSource

volatile int clang::tidy::DarwinModuleAnchorSource = 0

Definition at line 36 of file DarwinTidyModule.cpp.

◆ FuchsiaModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::FuchsiaModuleAnchorDestination
static
Initial value:

Definition at line 64 of file ClangTidyForceLinker.h.

◆ FuchsiaModuleAnchorSource

volatile int clang::tidy::FuchsiaModuleAnchorSource = 0

Definition at line 55 of file FuchsiaTidyModule.cpp.

◆ GoogleModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::GoogleModuleAnchorDestination
static
Initial value:

Definition at line 69 of file ClangTidyForceLinker.h.

◆ GoogleModuleAnchorSource

volatile int clang::tidy::GoogleModuleAnchorSource = 0

Definition at line 103 of file GoogleTidyModule.cpp.

◆ HICPPModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::HICPPModuleAnchorDestination
static
Initial value:

Definition at line 74 of file ClangTidyForceLinker.h.

◆ HICPPModuleAnchorSource

volatile int clang::tidy::HICPPModuleAnchorSource = 0

Definition at line 123 of file HICPPTidyModule.cpp.

◆ LinuxKernelModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::LinuxKernelModuleAnchorDestination
static
Initial value:

Definition at line 79 of file ClangTidyForceLinker.h.

◆ LinuxKernelModuleAnchorSource

volatile int clang::tidy::LinuxKernelModuleAnchorSource = 0

Definition at line 33 of file LinuxKernelTidyModule.cpp.

◆ LLVMLibcModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::LLVMLibcModuleAnchorDestination
static
Initial value:

Definition at line 89 of file ClangTidyForceLinker.h.

◆ LLVMLibcModuleAnchorSource

volatile int clang::tidy::LLVMLibcModuleAnchorSource = 0

Definition at line 42 of file LLVMLibcTidyModule.cpp.

◆ LLVMModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::LLVMModuleAnchorDestination
static
Initial value:

Definition at line 84 of file ClangTidyForceLinker.h.

◆ LLVMModuleAnchorSource

volatile int clang::tidy::LLVMModuleAnchorSource = 0

Definition at line 60 of file LLVMTidyModule.cpp.

◆ MiscModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::MiscModuleAnchorDestination
static
Initial value:

Definition at line 94 of file ClangTidyForceLinker.h.

◆ MiscModuleAnchorSource

volatile int clang::tidy::MiscModuleAnchorSource = 0

Definition at line 95 of file MiscTidyModule.cpp.

◆ ModernizeModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::ModernizeModuleAnchorDestination
static
Initial value:

Definition at line 99 of file ClangTidyForceLinker.h.

◆ ModernizeModuleAnchorSource

volatile int clang::tidy::ModernizeModuleAnchorSource = 0

Definition at line 139 of file ModernizeTidyModule.cpp.

◆ MPIModuleAnchorSource

volatile int clang::tidy::MPIModuleAnchorSource = 0

Definition at line 34 of file MPITidyModule.cpp.

◆ ObjCModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::ObjCModuleAnchorDestination
static
Initial value:

Definition at line 112 of file ClangTidyForceLinker.h.

◆ ObjCModuleAnchorSource

volatile int clang::tidy::ObjCModuleAnchorSource = 0

Definition at line 59 of file ObjCTidyModule.cpp.

◆ OpenMPModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::OpenMPModuleAnchorDestination
static
Initial value:

Definition at line 117 of file ClangTidyForceLinker.h.

◆ OpenMPModuleAnchorSource

volatile int clang::tidy::OpenMPModuleAnchorSource = 0

Definition at line 37 of file OpenMPTidyModule.cpp.

◆ PerformanceModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::PerformanceModuleAnchorDestination
static
Initial value:

Definition at line 122 of file ClangTidyForceLinker.h.

◆ PerformanceModuleAnchorSource

volatile int clang::tidy::PerformanceModuleAnchorSource = 0

Definition at line 84 of file PerformanceTidyModule.cpp.

◆ PortabilityModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::PortabilityModuleAnchorDestination
static
Initial value:

Definition at line 127 of file ClangTidyForceLinker.h.

◆ PortabilityModuleAnchorSource

volatile int clang::tidy::PortabilityModuleAnchorSource = 0

Definition at line 42 of file PortabilityTidyModule.cpp.

◆ ReadabilityModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::ReadabilityModuleAnchorDestination
static
Initial value:

Definition at line 132 of file ClangTidyForceLinker.h.

◆ ReadabilityModuleAnchorSource

volatile int clang::tidy::ReadabilityModuleAnchorSource = 0

Definition at line 186 of file ReadabilityTidyModule.cpp.

◆ VerifyConfigWarningEnd

constexpr StringLiteral clang::tidy::VerifyConfigWarningEnd = " [-verify-config]\n"
staticconstexpr

Definition at line 282 of file ClangTidyMain.cpp.

◆ ZirconModuleAnchorDestination

int LLVM_ATTRIBUTE_UNUSED clang::tidy::ZirconModuleAnchorDestination
static
Initial value:

Definition at line 137 of file ClangTidyForceLinker.h.

◆ ZirconModuleAnchorSource

volatile int clang::tidy::ZirconModuleAnchorSource = 0

Definition at line 35 of file ZirconTidyModule.cpp.