10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H 13 #include "llvm/ADT/Optional.h" 14 #include "llvm/ADT/StringMap.h" 15 #include "llvm/ADT/StringRef.h" 16 #include "llvm/Support/ErrorOr.h" 20 #include <system_error> 96 llvm::Optional<std::string>
User;
99 typedef std::map<std::string, std::string>
OptionMap;
116 static const char OptionsSourceTypeDefaultBinary[];
117 static const char OptionsSourceTypeCheckCommandLineOption[];
118 static const char OptionsSourceTypeConfigCommandLineOption[];
137 virtual std::vector<OptionsSource>
138 getRawOptions(llvm::StringRef FileName) = 0;
151 : GlobalOptions(GlobalOptions), DefaultOptions(Options) {}
153 return GlobalOptions;
155 std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName)
override;
170 std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName)
override;
189 typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
246 const ConfigFileHandlers &ConfigHandlers);
248 std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName)
override;
253 llvm::Optional<OptionsSource> tryReadConfigFile(llvm::StringRef
Directory);
274 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H llvm::Optional< std::string > Checks
Checks filter.
llvm::Optional< ArgList > ExtraArgs
Add extra compilation arguments to the end of the list.
Implementation of the ClangTidyOptionsProvider interface, which tries to find a configuration file in...
llvm::Optional< std::string > User
Specifies the name or e-mail of the user running clang-tidy.
std::vector< std::string > ArgList
std::pair< std::string, std::string > StringPair
Implementation of ClangTidyOptions interface, which is used for '-config' command-line option...
static cl::opt< std::string > Config("config", cl::desc(R"(
Specifies a configuration in YAML/JSON format:
-config="{Checks:' *', CheckOptions:[{key:x, value:y}]}"
When the value is empty, clang-tidy will
attempt to find a file named .clang-tidy for
each source file in its parent directories.
)"), cl::init(""), cl::cat(ClangTidyCategory))
llvm::Optional< std::string > HeaderFilterRegex
Output warnings from headers matching this filter.
Contains options for clang-tidy.
std::error_code parseLineFilter(StringRef LineFilter, clang::tidy::ClangTidyGlobalOptions &Options)
Parses -line-filter option and stores it to the Options.
llvm::ErrorOr< ClangTidyOptions > parseConfiguration(StringRef Config)
OptionMap CheckOptions
Key-value mapping used to store check-specific options.
llvm::Optional< bool > SystemHeaders
Output warnings from system headers matching HeaderFilterRegex.
ClangTidyOptions OverrideOptions
virtual ~ClangTidyOptionsProvider()
ConfigFileHandlers ConfigHandlers
llvm::Optional< ArgList > ExtraArgsBefore
Add extra compilation arguments to the start of the list.
llvm::Optional< std::string > FormatStyle
Format code around applied fixes with clang-format using this style.
static cl::opt< std::string > Directory(cl::Positional, cl::Required, cl::desc("<Search Root Directory>"))
static cl::opt< std::string > LineFilter("line-filter", cl::desc(R"(
List of files with line ranges to filter the
warnings. Can be used together with
-header-filter. The format of the list is a
JSON array of objects:
[
{"name":"file1.cpp","lines":[[1,3],[5,7]]},
{"name":"file2.h"}
]
)"), cl::init(""), cl::cat(ClangTidyCategory))
std::pair< unsigned, unsigned > LineRange
LineRange is a pair<start, end> (inclusive).
std::string configurationAsText(const ClangTidyOptions &Options)
Serializes configuration to a YAML-encoded string.
llvm::StringMap< OptionsSource > CachedOptions
std::map< std::string, std::string > OptionMap
std::vector< FileFilter > LineFilter
Output warnings from certain line ranges of certain files only.
std::pair< std::string, std::function< llvm::ErrorOr< ClangTidyOptions > llvm::StringRef)> > ConfigFileHandler
llvm::Optional< std::string > WarningsAsErrors
WarningsAsErrors filter.
std::vector< ConfigFileHandler > ConfigFileHandlers
Configuration file handlers listed in the order of priority.
Contains a list of line ranges in a single file.
llvm::Optional< bool > AnalyzeTemporaryDtors
Turns on temporary destructor-based analysis.
DefaultOptionsProvider(const ClangTidyGlobalOptions &GlobalOptions, const ClangTidyOptions &Options)
std::pair< ClangTidyOptions, std::string > OptionsSource
ClangTidyOptions and its source.
std::vector< LineRange > LineRanges
A list of line ranges in this file, for which we show warnings.
Abstract interface for retrieving various ClangTidy options.
const ClangTidyGlobalOptions & getGlobalOptions() override
Returns global options, which are independent of the file.
std::string Name
File name.
Implementation of the ClangTidyOptionsProvider interface, which returns the same options for all file...