clang-tools
10.0.0git
|
Classes | |
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 | 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... | |
Typedefs | |
typedef llvm::Registry< ClangTidyModule > | ClangTidyModuleRegistry |
Functions | |
static ClangTidyModuleRegistry::Add< bugprone::BugproneModule > | X ("bugprone-module", "Adds checks for bugprone code constructs.") |
static ClangTidyModuleRegistry::Add< cert::CERTModule > | X ("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. More... | |
ClangTidyOptions::OptionMap | getCheckOptions (const ClangTidyOptions &Options, bool AllowEnablingAnalyzerAlphaCheckers) |
Returns the effective check-specific options. More... | |
std::vector< ClangTidyError > | runClangTidy (clang::tidy::ClangTidyContext &Context, const CompilationDatabase &Compilations, ArrayRef< std::string > InputFiles, llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > BaseFS, bool EnableCheckProfile, llvm::StringRef StoreCheckProfile) |
void | handleErrors (llvm::ArrayRef< ClangTidyError > Errors, ClangTidyContext &Context, bool Fix, unsigned &WarningsAsErrorsCount, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS) |
Displays the found Errors to the users. More... | |
void | exportReplacements (const llvm::StringRef MainFilePath, const std::vector< ClangTidyError > &Errors, raw_ostream &OS) |
std::vector< ClangTidyError > | runClangTidy (clang::tidy::ClangTidyContext &Context, const tooling::CompilationDatabase &Compilations, ArrayRef< std::string > InputFiles, llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > BaseFS, bool EnableCheckProfile=false, llvm::StringRef StoreCheckProfile=StringRef()) |
Run a set of clang-tidy checks on a set of files. More... | |
void | exportReplacements (StringRef MainFilePath, const std::vector< ClangTidyError > &Errors, raw_ostream &OS) |
Serializes replacements into YAML and writes them to the specified output stream. More... | |
bool | shouldSuppressDiagnostic (DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info, ClangTidyContext &Context, bool CheckMacroExpansion=true) |
Check whether a given diagnostic should be suppressed due to the presence of a "NOLINT" suppression comment. More... | |
template<typename T > | |
static void | mergeVectors (Optional< T > &Dest, const Optional< T > &Src) |
static void | mergeCommaSeparatedLists (Optional< std::string > &Dest, const Optional< std::string > &Src) |
template<typename T > | |
static void | overrideValue (Optional< T > &Dest, const Optional< T > &Src) |
std::error_code | parseLineFilter (StringRef LineFilter, clang::tidy::ClangTidyGlobalOptions &Options) |
Parses -line-filter option and stores it to the Options . More... | |
llvm::ErrorOr< ClangTidyOptions > | parseConfiguration (StringRef Config) |
std::string | configurationAsText (const ClangTidyOptions &Options) |
Serializes configuration to a YAML-encoded string. More... | |
std::error_code | parseLineFilter (llvm::StringRef LineFilter, ClangTidyGlobalOptions &Options) |
Parses LineFilter from JSON and stores it to the Options . More... | |
llvm::ErrorOr< ClangTidyOptions > | parseConfiguration (llvm::StringRef Config) |
Parses configuration from JSON and returns ClangTidyOptions or an error. More... | |
static ClangTidyModuleRegistry::Add< darwin::DarwinModule > | X ("darwin-module", "Adds Darwin-specific lint checks.") |
static ClangTidyModuleRegistry::Add< misc::MiscModule > | X ("misc-module", "Adds miscellaneous lint checks.") |
static ClangTidyModuleRegistry::Add< mpi::MPIModule > | X ("mpi-module", "Adds MPI clang-tidy checks.") |
static void | printStats (const ClangTidyStats &Stats) |
static std::unique_ptr< ClangTidyOptionsProvider > | createOptionsProvider (llvm::IntrusiveRefCntPtr< vfs::FileSystem > FS) |
llvm::IntrusiveRefCntPtr< vfs::FileSystem > | getVfsFromFile (const std::string &OverlayFile, llvm::IntrusiveRefCntPtr< vfs::FileSystem > BaseFS) |
static int | clangTidyMain (int argc, const char **argv) |
typedef llvm::Registry<ClangTidyModule> clang::tidy::ClangTidyModuleRegistry |
Definition at line 18 of file ClangTidyModuleRegistry.h.
|
static |
Definition at line 212 of file ClangTidyMain.cpp.
std::string clang::tidy::configurationAsText | ( | const ClangTidyOptions & | Options | ) |
Serializes configuration to a YAML-encoded string.
Definition at line 336 of file ClangTidyOptions.cpp.
References Text.
|
static |
Definition at line 141 of file ClangTidyMain.cpp.
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.
void clang::tidy::exportReplacements | ( | const llvm::StringRef | MainFilePath, |
const std::vector< ClangTidyError > & | Errors, | ||
raw_ostream & | OS | ||
) |
Definition at line 595 of file ClangTidy.cpp.
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 469 of file ClangTidy.cpp.
References clang::tidy::ClangTidyASTConsumerFactory::getCheckNames().
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 480 of file ClangTidy.cpp.
References clang::tidy::ClangTidyASTConsumerFactory::getCheckOptions().
llvm::IntrusiveRefCntPtr<vfs::FileSystem> clang::tidy::getVfsFromFile | ( | const std::string & | OverlayFile, |
llvm::IntrusiveRefCntPtr< vfs::FileSystem > | BaseFS | ||
) |
Definition at line 191 of file ClangTidyMain.cpp.
void clang::tidy::handleErrors | ( | llvm::ArrayRef< ClangTidyError > | Errors, |
ClangTidyContext & | Context, | ||
bool | Fix, | ||
unsigned & | WarningsAsErrorsCount, | ||
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | BaseFS | ||
) |
Displays the found Errors
to the users.
If Fix
is true, Errors
containing fixes are automatically applied and reformatted. If no clang-format configuration file is found, the given FormatStyle is used.
Definition at line 568 of file ClangTidy.cpp.
|
static |
Definition at line 129 of file ClangTidyOptions.cpp.
|
static |
Definition at line 120 of file ClangTidyOptions.cpp.
References Src.
|
static |
Definition at line 136 of file ClangTidyOptions.cpp.
References Src.
llvm::ErrorOr<ClangTidyOptions> clang::tidy::parseConfiguration | ( | llvm::StringRef | Config | ) |
Parses configuration from JSON and returns ClangTidyOptions
or an error.
llvm::ErrorOr<ClangTidyOptions> clang::tidy::parseConfiguration | ( | StringRef | Config | ) |
Definition at line 327 of file ClangTidyOptions.cpp.
Referenced by clang::tidy::FileOptionsProvider::FileOptionsProvider().
std::error_code clang::tidy::parseLineFilter | ( | llvm::StringRef | LineFilter, |
ClangTidyGlobalOptions & | Options | ||
) |
Parses LineFilter from JSON and stores it to the Options
.
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 320 of file ClangTidyOptions.cpp.
References clang::tidy::ClangTidyGlobalOptions::LineFilter.
|
static |
Definition at line 113 of file ClangTidyMain.cpp.
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 | EnableCheckProfile = false , |
||
llvm::StringRef | StoreCheckProfile = StringRef() |
||
) |
Run a set of clang-tidy checks on a set of files.
EnableCheckProfile | If provided, it enables check profile collection in MatchFinder, and will contain the result of the profile. |
StoreCheckProfile | If 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. |
std::vector<ClangTidyError> clang::tidy::runClangTidy | ( | clang::tidy::ClangTidyContext & | Context, |
const CompilationDatabase & | Compilations, | ||
ArrayRef< std::string > | InputFiles, | ||
llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > | BaseFS, | ||
bool | EnableCheckProfile, | ||
llvm::StringRef | StoreCheckProfile | ||
) |
Definition at line 491 of file ClangTidy.cpp.
bool clang::tidy::shouldSuppressDiagnostic | ( | DiagnosticsEngine::Level | DiagLevel, |
const Diagnostic & | Info, | ||
ClangTidyContext & | Context, | ||
bool | CheckMacroExpansion = true |
||
) |
Check whether a given diagnostic should be suppressed due to the presence of a "NOLINT" suppression comment.
This is exposed so that other tools that present clang-tidy diagnostics (such as clangd) can respect the same suppression rules as clang-tidy. This does not handle suppression of notes following a suppressed diagnostic; that is left to the caller is it requires maintaining state in between calls to this function. The CheckMacroExpansion
parameter determines whether the function should handle the case where the diagnostic is inside a macro expansion. A degree of control over this is needed because handling this case can require examining source files other than the one in which the diagnostic is located, and in some use cases we cannot rely on such other files being mapped in the SourceMapper.
Definition at line 358 of file ClangTidyDiagnosticConsumer.cpp.
References LineIsMarkedWithNOLINT(), and LineIsMarkedWithNOLINTinMacro().
Referenced by clang::tidy::ClangTidyDiagnosticConsumer::HandleDiagnostic().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 25 of file ClangTidyForceLinker.h.
volatile int clang::tidy::AbseilModuleAnchorSource = 0 |
Definition at line 81 of file AbseilTidyModule.cpp.
|
static |
Definition at line 70 of file ClangTidyForceLinker.h.
volatile int clang::tidy::AndroidModuleAnchorSource = 0 |
Definition at line 70 of file AndroidTidyModule.cpp.
|
static |
Definition at line 30 of file ClangTidyForceLinker.h.
volatile int clang::tidy::BoostModuleAnchorSource = 0 |
Definition at line 34 of file BoostTidyModule.cpp.
|
static |
Definition at line 35 of file ClangTidyForceLinker.h.
volatile int clang::tidy::BugproneModuleAnchorSource = 0 |
Definition at line 178 of file BugproneTidyModule.cpp.
|
static |
Definition at line 20 of file ClangTidyForceLinker.h.
volatile int clang::tidy::CERTModuleAnchorSource = 0 |
Definition at line 116 of file CERTTidyModule.cpp.
|
static |
Definition at line 50 of file ClangTidyForceLinker.h.
volatile int clang::tidy::CppCoreGuidelinesModuleAnchorSource = 0 |
Definition at line 115 of file CppCoreGuidelinesTidyModule.cpp.
|
static |
Definition at line 55 of file ClangTidyForceLinker.h.
volatile int clang::tidy::DarwinModuleAnchorSource = 0 |
Definition at line 37 of file DarwinTidyModule.cpp.
|
static |
Definition at line 60 of file ClangTidyForceLinker.h.
volatile int clang::tidy::FuchsiaModuleAnchorSource = 0 |
Definition at line 59 of file FuchsiaTidyModule.cpp.
|
static |
Definition at line 65 of file ClangTidyForceLinker.h.
volatile int clang::tidy::GoogleModuleAnchorSource = 0 |
Definition at line 107 of file GoogleTidyModule.cpp.
|
static |
Definition at line 118 of file ClangTidyForceLinker.h.
volatile int clang::tidy::HICPPModuleAnchorSource = 0 |
Definition at line 121 of file HICPPTidyModule.cpp.
|
static |
Definition at line 40 of file ClangTidyForceLinker.h.
volatile int clang::tidy::LinuxKernelModuleAnchorSource = 0 |
Definition at line 34 of file LinuxKernelTidyModule.cpp.
|
static |
Definition at line 45 of file ClangTidyForceLinker.h.
volatile int clang::tidy::LLVMModuleAnchorSource = 0 |
Definition at line 49 of file LLVMTidyModule.cpp.
|
static |
Definition at line 75 of file ClangTidyForceLinker.h.
volatile int clang::tidy::MiscModuleAnchorSource = 0 |
Definition at line 68 of file MiscTidyModule.cpp.
|
static |
Definition at line 80 of file ClangTidyForceLinker.h.
volatile int clang::tidy::ModernizeModuleAnchorSource = 0 |
Definition at line 126 of file ModernizeTidyModule.cpp.
volatile int clang::tidy::MPIModuleAnchorSource = 0 |
Definition at line 35 of file MPITidyModule.cpp.
|
static |
Definition at line 113 of file ClangTidyForceLinker.h.
volatile int clang::tidy::ObjCModuleAnchorSource = 0 |
Definition at line 49 of file ObjCTidyModule.cpp.
|
static |
Definition at line 93 of file ClangTidyForceLinker.h.
volatile int clang::tidy::OpenMPModuleAnchorSource = 0 |
Definition at line 38 of file OpenMPTidyModule.cpp.
|
static |
Definition at line 98 of file ClangTidyForceLinker.h.
volatile int clang::tidy::PerformanceModuleAnchorSource = 0 |
Definition at line 73 of file PerformanceTidyModule.cpp.
|
static |
Definition at line 103 of file ClangTidyForceLinker.h.
volatile int clang::tidy::PortabilityModuleAnchorSource = 0 |
Definition at line 34 of file PortabilityTidyModule.cpp.
|
static |
Definition at line 108 of file ClangTidyForceLinker.h.
volatile int clang::tidy::ReadabilityModuleAnchorSource = 0 |
Definition at line 139 of file ReadabilityTidyModule.cpp.
|
static |
Definition at line 123 of file ClangTidyForceLinker.h.
volatile int clang::tidy::ZirconModuleAnchorSource = 0 |
Definition at line 36 of file ZirconTidyModule.cpp.