clang-tools 20.0.0git
|
Contains options for clang-tidy. More...
#include <ClangTidyOptions.h>
Classes | |
struct | ClangTidyValue |
Helper structure for storing option value with priority of the value. More... | |
Public Types | |
using | StringPair = std::pair< std::string, std::string > |
using | OptionMap = llvm::StringMap< ClangTidyValue > |
using | ArgList = std::vector< std::string > |
Public Member Functions | |
ClangTidyOptions & | mergeWith (const ClangTidyOptions &Other, unsigned Order) |
Overwrites all fields in here by the fields of Other that have a value. | |
ClangTidyOptions | merge (const ClangTidyOptions &Other, unsigned Order) const |
Creates a new ClangTidyOptions instance combined from all fields of this instance overridden by the fields of Other that have a value. | |
Static Public Member Functions | |
static ClangTidyOptions | getDefaults () |
These options are used for all settings that haven't been overridden by the OptionsProvider . | |
Public Attributes | |
std::optional< std::string > | Checks |
Checks filter. | |
std::optional< std::string > | WarningsAsErrors |
WarningsAsErrors filter. | |
std::optional< std::vector< std::string > > | HeaderFileExtensions |
File extensions to consider to determine if a given diagnostic is located in a header file. | |
std::optional< std::vector< std::string > > | ImplementationFileExtensions |
File extensions to consider to determine if a given diagnostic is located is located in an implementation file. | |
std::optional< std::string > | HeaderFilterRegex |
Output warnings from headers matching this filter. | |
std::optional< std::string > | ExcludeHeaderFilterRegex |
Exclude warnings from headers matching this filter, even if they match HeaderFilterRegex . | |
std::optional< bool > | SystemHeaders |
Output warnings from system headers matching HeaderFilterRegex . | |
std::optional< std::string > | FormatStyle |
Format code around applied fixes with clang-format using this style. | |
std::optional< std::string > | User |
Specifies the name or e-mail of the user running clang-tidy. | |
OptionMap | CheckOptions |
Key-value mapping used to store check-specific options. | |
std::optional< ArgList > | ExtraArgs |
Add extra compilation arguments to the end of the list. | |
std::optional< ArgList > | ExtraArgsBefore |
Add extra compilation arguments to the start of the list. | |
std::optional< bool > | InheritParentConfig |
Only used in the FileOptionsProvider and ConfigOptionsProvider. | |
std::optional< bool > | UseColor |
Use colors in diagnostics. If missing, it will be auto detected. | |
Contains options for clang-tidy.
These options may be read from configuration files, and may be different for different translation units.
Definition at line 49 of file ClangTidyOptions.h.
using clang::tidy::ClangTidyOptions::ArgList = std::vector<std::string> |
Definition at line 131 of file ClangTidyOptions.h.
using clang::tidy::ClangTidyOptions::OptionMap = llvm::StringMap<ClangTidyValue> |
Definition at line 126 of file ClangTidyOptions.h.
using clang::tidy::ClangTidyOptions::StringPair = std::pair<std::string, std::string> |
Definition at line 125 of file ClangTidyOptions.h.
|
static |
These options are used for all settings that haven't been overridden by the OptionsProvider
.
Allow no checks and no headers by default. This method initializes check-specific options by calling ClangTidyModule::getModuleOptions()
of each registered ClangTidyModule
.
Definition at line 190 of file ClangTidyOptions.cpp.
References Checks, ExcludeHeaderFilterRegex, FormatStyle, HeaderFileExtensions, HeaderFilterRegex, ImplementationFileExtensions, mergeWith(), SystemHeaders, User, and WarningsAsErrors.
Referenced by clang::tidy::ClangTidyContext::getOptionsForFile(), and clang::clangd::getTidyOptionsForFile().
ClangTidyOptions clang::tidy::ClangTidyOptions::merge | ( | const ClangTidyOptions & | Other, |
unsigned | Order | ||
) | const |
Creates a new ClangTidyOptions
instance combined from all fields of this instance overridden by the fields of Other
that have a value.
Order
specifies precedence of Other
option.
Definition at line 254 of file ClangTidyOptions.cpp.
Referenced by clang::tidy::ClangTidyContext::getOptionsForFile().
ClangTidyOptions & clang::tidy::ClangTidyOptions::mergeWith | ( | const ClangTidyOptions & | Other, |
unsigned | Order | ||
) |
Overwrites all fields in here by the fields of Other
that have a value.
Order
specifies precedence of Other
option.
Definition at line 229 of file ClangTidyOptions.cpp.
References CheckOptions, Checks, ExcludeHeaderFilterRegex, ExtraArgs, ExtraArgsBefore, FormatStyle, HeaderFileExtensions, HeaderFilterRegex, ImplementationFileExtensions, clang::tidy::mergeCommaSeparatedLists(), clang::tidy::mergeVectors(), clang::tidy::overrideValue(), SystemHeaders, UseColor, User, and WarningsAsErrors.
Referenced by getDefaults().
OptionMap clang::tidy::ClangTidyOptions::CheckOptions |
Key-value mapping used to store check-specific options.
Definition at line 129 of file ClangTidyOptions.h.
Referenced by clang::tidy::cert::CERTModule::getModuleOptions(), clang::tidy::cppcoreguidelines::CppCoreGuidelinesModule::getModuleOptions(), clang::tidy::google::GoogleModule::getModuleOptions(), clang::tidy::llvm_check::LLVMModule::getModuleOptions(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::string> clang::tidy::ClangTidyOptions::Checks |
Checks filter.
Definition at line 69 of file ClangTidyOptions.h.
Referenced by clang::clangd::ParsedAST::build(), getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), mergeWith(), and clang::tidy::ClangTidyPluginAction::ParseArgs().
std::optional<std::string> clang::tidy::ClangTidyOptions::ExcludeHeaderFilterRegex |
Exclude warnings from headers matching this filter, even if they match HeaderFilterRegex
.
Definition at line 88 of file ClangTidyOptions.h.
Referenced by clang::tidy::ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer(), getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<ArgList> clang::tidy::ClangTidyOptions::ExtraArgs |
Add extra compilation arguments to the end of the list.
Definition at line 134 of file ClangTidyOptions.h.
Referenced by clang::clangd::ParsedAST::build(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<ArgList> clang::tidy::ClangTidyOptions::ExtraArgsBefore |
Add extra compilation arguments to the start of the list.
Definition at line 137 of file ClangTidyOptions.h.
Referenced by clang::clangd::ParsedAST::build(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::string> clang::tidy::ClangTidyOptions::FormatStyle |
Format code around applied fixes with clang-format using this style.
Can be one of:
See clang-format documentation for more about configuring format style.
Definition at line 105 of file ClangTidyOptions.h.
Referenced by getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::vector<std::string> > clang::tidy::ClangTidyOptions::HeaderFileExtensions |
File extensions to consider to determine if a given diagnostic is located in a header file.
Definition at line 76 of file ClangTidyOptions.h.
Referenced by getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::string> clang::tidy::ClangTidyOptions::HeaderFilterRegex |
Output warnings from headers matching this filter.
Warnings from main files will always be displayed.
Definition at line 84 of file ClangTidyOptions.h.
Referenced by clang::tidy::ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer(), getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::vector<std::string> > clang::tidy::ClangTidyOptions::ImplementationFileExtensions |
File extensions to consider to determine if a given diagnostic is located is located in an implementation file.
Definition at line 80 of file ClangTidyOptions.h.
Referenced by getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<bool> clang::tidy::ClangTidyOptions::InheritParentConfig |
Only used in the FileOptionsProvider and ConfigOptionsProvider.
If true and using a FileOptionsProvider, it will take a configuration file in the parent directory (if any exists) and apply this config file on top of the parent one. IF true and using a ConfigOptionsProvider, it will apply this config on top of any configuration file it finds in the directory using the same logic as FileOptionsProvider. If false or missing, only this configuration file will be used.
Definition at line 146 of file ClangTidyOptions.h.
Referenced by clang::tidy::ConfigOptionsProvider::getRawOptions(), and llvm::yaml::MappingTraits< ClangTidyOptions >::mapping().
std::optional<bool> clang::tidy::ClangTidyOptions::SystemHeaders |
Output warnings from system headers matching HeaderFilterRegex
.
Definition at line 91 of file ClangTidyOptions.h.
Referenced by getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<bool> clang::tidy::ClangTidyOptions::UseColor |
Use colors in diagnostics. If missing, it will be auto detected.
Definition at line 149 of file ClangTidyOptions.h.
Referenced by llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::string> clang::tidy::ClangTidyOptions::User |
Specifies the name or e-mail of the user running clang-tidy.
This option is used, for example, to place the correct user name in TODO() comments in the relevant check.
Definition at line 111 of file ClangTidyOptions.h.
Referenced by getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().
std::optional<std::string> clang::tidy::ClangTidyOptions::WarningsAsErrors |
WarningsAsErrors filter.
Definition at line 72 of file ClangTidyOptions.h.
Referenced by getDefaults(), llvm::yaml::MappingTraits< ClangTidyOptions >::mapping(), and mergeWith().