clang-tools
11.0.0
|
Implementation of the ClangTidyOptionsProvider
interface, which tries to find a configuration file in the closest parent directory of each source file.
More...
#include <ClangTidyOptions.h>
Public Member Functions | |
FileOptionsProvider (const ClangTidyGlobalOptions &GlobalOptions, const ClangTidyOptions &DefaultOptions, const ClangTidyOptions &OverrideOptions, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS=nullptr) | |
Initializes the FileOptionsProvider instance. More... | |
FileOptionsProvider (const ClangTidyGlobalOptions &GlobalOptions, const ClangTidyOptions &DefaultOptions, const ClangTidyOptions &OverrideOptions, const ConfigFileHandlers &ConfigHandlers) | |
Initializes the FileOptionsProvider instance with a custom set of configuration file handlers. More... | |
std::vector< OptionsSource > | getRawOptions (llvm::StringRef FileName) override |
Returns an ordered vector of OptionsSources, in order of increasing priority. More... | |
![]() | |
FileOptionsBaseProvider (const ClangTidyGlobalOptions &GlobalOptions, const ClangTidyOptions &DefaultOptions, const ClangTidyOptions &OverrideOptions, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS=nullptr) | |
FileOptionsBaseProvider (const ClangTidyGlobalOptions &GlobalOptions, const ClangTidyOptions &DefaultOptions, const ClangTidyOptions &OverrideOptions, const ConfigFileHandlers &ConfigHandlers) | |
![]() | |
DefaultOptionsProvider (const ClangTidyGlobalOptions &GlobalOptions, const ClangTidyOptions &Options) | |
const ClangTidyGlobalOptions & | getGlobalOptions () override |
Returns global options, which are independent of the file. More... | |
![]() | |
virtual | ~ClangTidyOptionsProvider () |
ClangTidyOptions | getOptions (llvm::StringRef FileName) |
Returns options applying to a specific translation unit with the specified FileName . More... | |
Additional Inherited Members | |
![]() | |
typedef std::pair< std::string, std::function< llvm::ErrorOr< ClangTidyOptions > llvm::StringRef)> > | ConfigFileHandler |
typedef std::vector< ConfigFileHandler > | ConfigFileHandlers |
Configuration file handlers listed in the order of priority. More... | |
![]() | |
typedef std::pair< ClangTidyOptions, std::string > | OptionsSource |
ClangTidyOptions and its source. More... | |
![]() | |
static const char | OptionsSourceTypeDefaultBinary [] |
static const char | OptionsSourceTypeCheckCommandLineOption [] |
static const char | OptionsSourceTypeConfigCommandLineOption [] |
![]() | |
void | addRawFileOptions (llvm::StringRef AbsolutePath, std::vector< OptionsSource > &CurOptions) |
llvm::Optional< OptionsSource > | tryReadConfigFile (llvm::StringRef Directory) |
Try to read configuration files from Directory using registered ConfigHandlers . More... | |
![]() | |
llvm::StringMap< OptionsSource > | CachedOptions |
ClangTidyOptions | OverrideOptions |
ConfigFileHandlers | ConfigHandlers |
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | FS |
Implementation of the ClangTidyOptionsProvider
interface, which tries to find a configuration file in the closest parent directory of each source file.
By default, files named ".clang-tidy" will be considered, and the clang::tidy::parseConfiguration
function will be used for parsing, but a custom set of configuration file names and parsing functions can be specified using the appropriate constructor.
Definition at line 262 of file ClangTidyOptions.h.
clang::tidy::FileOptionsProvider::FileOptionsProvider | ( | const ClangTidyGlobalOptions & | GlobalOptions, |
const ClangTidyOptions & | DefaultOptions, | ||
const ClangTidyOptions & | OverrideOptions, | ||
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | FS = nullptr |
||
) |
Initializes the FileOptionsProvider
instance.
GlobalOptions | are just stored and returned to the caller of getGlobalOptions . |
DefaultOptions | are used for all settings not specified in a configuration file. |
If any of the
OverrideOptions | fields are set, they will override whatever options are read from the configuration file. |
Definition at line 284 of file ClangTidyOptions.cpp.
clang::tidy::FileOptionsProvider::FileOptionsProvider | ( | const ClangTidyGlobalOptions & | GlobalOptions, |
const ClangTidyOptions & | DefaultOptions, | ||
const ClangTidyOptions & | OverrideOptions, | ||
const ConfigFileHandlers & | ConfigHandlers | ||
) |
Initializes the FileOptionsProvider
instance with a custom set of configuration file handlers.
GlobalOptions | are just stored and returned to the caller of getGlobalOptions . |
DefaultOptions | are used for all settings not specified in a configuration file. |
If any of the
OverrideOptions | fields are set, they will override whatever options are read from the configuration file. |
ConfigHandlers | specifies a custom set of configuration file handlers. Each handler is a pair of configuration file name and a function that can parse configuration from this file type. The configuration files in each directory are searched for in the order of appearance in ConfigHandlers . |
Definition at line 292 of file ClangTidyOptions.cpp.
|
overridevirtual |
Returns an ordered vector of OptionsSources, in order of increasing priority.
Reimplemented from clang::tidy::DefaultOptionsProvider.
Definition at line 304 of file ClangTidyOptions.cpp.
References clang::tidy::FileOptionsBaseProvider::addRawFileOptions(), FileName, clang::tidy::FileOptionsBaseProvider::FS, clang::tidy::DefaultOptionsProvider::getRawOptions(), clang::tidy::ClangTidyOptionsProvider::OptionsSourceTypeCheckCommandLineOption, and clang::tidy::FileOptionsBaseProvider::OverrideOptions.