9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H 12 #include "llvm/ADT/IntrusiveRefCntPtr.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" 17 #include "llvm/Support/VirtualFileSystem.h" 21 #include <system_error> 94 llvm::Optional<std::string>
User;
97 typedef std::map<std::string, std::string>
OptionMap;
114 static const char OptionsSourceTypeDefaultBinary[];
115 static const char OptionsSourceTypeCheckCommandLineOption[];
116 static const char OptionsSourceTypeConfigCommandLineOption[];
135 virtual std::vector<OptionsSource>
136 getRawOptions(llvm::StringRef
FileName) = 0;
149 : GlobalOptions(GlobalOptions), DefaultOptions(Options) {}
151 return GlobalOptions;
153 std::vector<OptionsSource> getRawOptions(llvm::StringRef
FileName)
override;
168 std::vector<OptionsSource> getRawOptions(llvm::StringRef
FileName)
override;
187 typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
224 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
FS =
nullptr);
246 const ConfigFileHandlers &ConfigHandlers);
248 std::vector<OptionsSource> getRawOptions(llvm::StringRef
FileName)
override;
253 llvm::Optional<OptionsSource> tryReadConfigFile(llvm::StringRef
Directory);
258 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
FS;
275 #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 > 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).
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS
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.
llvm::StringRef Directory
Contains a list of line ranges in a single file.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
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...