clang-tools  17.0.0git
ClangTidyOptions.h
Go to the documentation of this file.
1 //===--- ClangTidyOptions.h - clang-tidy ------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
11 
12 #include "llvm/ADT/IntrusiveRefCntPtr.h"
13 #include "llvm/ADT/StringMap.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/ErrorOr.h"
16 #include "llvm/Support/MemoryBufferRef.h"
17 #include "llvm/Support/VirtualFileSystem.h"
18 #include <functional>
19 #include <optional>
20 #include <string>
21 #include <system_error>
22 #include <utility>
23 #include <vector>
24 
25 namespace clang::tidy {
26 
27 /// Contains a list of line ranges in a single file.
28 struct FileFilter {
29  /// File name.
30  std::string Name;
31 
32  /// LineRange is a pair<start, end> (inclusive).
33  typedef std::pair<unsigned, unsigned> LineRange;
34 
35  /// A list of line ranges in this file, for which we show warnings.
36  std::vector<LineRange> LineRanges;
37 };
38 
39 /// Global options. These options are neither stored nor read from
40 /// configuration files.
42  /// Output warnings from certain line ranges of certain files only.
43  /// If empty, no warnings will be filtered.
44  std::vector<FileFilter> LineFilter;
45 };
46 
47 /// Contains options for clang-tidy. These options may be read from
48 /// configuration files, and may be different for different translation units.
50  /// These options are used for all settings that haven't been
51  /// overridden by the \c OptionsProvider.
52  ///
53  /// Allow no checks and no headers by default. This method initializes
54  /// check-specific options by calling \c ClangTidyModule::getModuleOptions()
55  /// of each registered \c ClangTidyModule.
57 
58  /// Overwrites all fields in here by the fields of \p Other that have a value.
59  /// \p Order specifies precedence of \p Other option.
60  ClangTidyOptions &mergeWith(const ClangTidyOptions &Other, unsigned Order);
61 
62  /// Creates a new \c ClangTidyOptions instance combined from all fields
63  /// of this instance overridden by the fields of \p Other that have a value.
64  /// \p Order specifies precedence of \p Other option.
65  [[nodiscard]] ClangTidyOptions merge(const ClangTidyOptions &Other,
66  unsigned Order) const;
67 
68  /// Checks filter.
69  std::optional<std::string> Checks;
70 
71  /// WarningsAsErrors filter.
72  std::optional<std::string> WarningsAsErrors;
73 
74  /// Output warnings from headers matching this filter. Warnings from
75  /// main files will always be displayed.
76  std::optional<std::string> HeaderFilterRegex;
77 
78  /// Output warnings from system headers matching \c HeaderFilterRegex.
79  std::optional<bool> SystemHeaders;
80 
81  /// Format code around applied fixes with clang-format using this
82  /// style.
83  ///
84  /// Can be one of:
85  /// * 'none' - don't format code around applied fixes;
86  /// * 'llvm', 'google', 'mozilla' or other predefined clang-format style
87  /// names;
88  /// * 'file' - use the .clang-format file in the closest parent directory of
89  /// each source file;
90  /// * '{inline-formatting-style-in-yaml-format}'.
91  ///
92  /// See clang-format documentation for more about configuring format style.
93  std::optional<std::string> FormatStyle;
94 
95  /// Specifies the name or e-mail of the user running clang-tidy.
96  ///
97  /// This option is used, for example, to place the correct user name in TODO()
98  /// comments in the relevant check.
99  std::optional<std::string> User;
100 
101  /// Helper structure for storing option value with priority of the value.
102  struct ClangTidyValue {
104  ClangTidyValue(const char *Value) : Value(Value), Priority(0) {}
105  ClangTidyValue(llvm::StringRef Value, unsigned Priority = 0)
106  : Value(Value), Priority(Priority) {}
107 
108  std::string Value;
109  /// Priority stores relative precedence of the value loaded from config
110  /// files to disambiguate local vs global value from different levels.
111  unsigned Priority;
112  };
113  typedef std::pair<std::string, std::string> StringPair;
114  typedef llvm::StringMap<ClangTidyValue> OptionMap;
115 
116  /// Key-value mapping used to store check-specific options.
118 
119  typedef std::vector<std::string> ArgList;
120 
121  /// Add extra compilation arguments to the end of the list.
122  std::optional<ArgList> ExtraArgs;
123 
124  /// Add extra compilation arguments to the start of the list.
125  std::optional<ArgList> ExtraArgsBefore;
126 
127  /// Only used in the FileOptionsProvider and ConfigOptionsProvider. If true
128  /// and using a FileOptionsProvider, it will take a configuration file in the
129  /// parent directory (if any exists) and apply this config file on top of the
130  /// parent one. IF true and using a ConfigOptionsProvider, it will apply this
131  /// config on top of any configuration file it finds in the directory using
132  /// the same logic as FileOptionsProvider. If false or missing, only this
133  /// configuration file will be used.
134  std::optional<bool> InheritParentConfig;
135 
136  /// Use colors in diagnostics. If missing, it will be auto detected.
137  std::optional<bool> UseColor;
138 };
139 
140 /// Abstract interface for retrieving various ClangTidy options.
142 public:
143  static const char OptionsSourceTypeDefaultBinary[];
146 
148 
149  /// Returns global options, which are independent of the file.
150  virtual const ClangTidyGlobalOptions &getGlobalOptions() = 0;
151 
152  /// ClangTidyOptions and its source.
153  //
154  /// clang-tidy has 3 types of the sources in order of increasing priority:
155  /// * clang-tidy binary.
156  /// * '-config' commandline option or a specific configuration file. If the
157  /// commandline option is specified, clang-tidy will ignore the
158  /// configuration file.
159  /// * '-checks' commandline option.
160  typedef std::pair<ClangTidyOptions, std::string> OptionsSource;
161 
162  /// Returns an ordered vector of OptionsSources, in order of increasing
163  /// priority.
164  virtual std::vector<OptionsSource>
165  getRawOptions(llvm::StringRef FileName) = 0;
166 
167  /// Returns options applying to a specific translation unit with the
168  /// specified \p FileName.
169  ClangTidyOptions getOptions(llvm::StringRef FileName);
170 };
171 
172 /// Implementation of the \c ClangTidyOptionsProvider interface, which
173 /// returns the same options for all files.
175 public:
177  ClangTidyOptions Options)
178  : GlobalOptions(std::move(GlobalOptions)),
179  DefaultOptions(std::move(Options)) {}
181  return GlobalOptions;
182  }
183  std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
184 
185 private:
186  ClangTidyGlobalOptions GlobalOptions;
187  ClangTidyOptions DefaultOptions;
188 };
189 
191 protected:
192  // A pair of configuration file base name and a function parsing
193  // configuration from text in the corresponding format.
194  typedef std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
195  llvm::MemoryBufferRef)>>
197 
198  /// Configuration file handlers listed in the order of priority.
199  ///
200  /// Custom configuration file formats can be supported by constructing the
201  /// list of handlers and passing it to the appropriate \c FileOptionsProvider
202  /// constructor. E.g. initialization of a \c FileOptionsProvider with support
203  /// of a custom configuration file format for files named ".my-tidy-config"
204  /// could look similar to this:
205  /// \code
206  /// FileOptionsProvider::ConfigFileHandlers ConfigHandlers;
207  /// ConfigHandlers.emplace_back(".my-tidy-config", parseMyConfigFormat);
208  /// ConfigHandlers.emplace_back(".clang-tidy", parseConfiguration);
209  /// return std::make_unique<FileOptionsProvider>(
210  /// GlobalOptions, DefaultOptions, OverrideOptions, ConfigHandlers);
211  /// \endcode
212  ///
213  /// With the order of handlers shown above, the ".my-tidy-config" file would
214  /// take precedence over ".clang-tidy" if both reside in the same directory.
215  typedef std::vector<ConfigFileHandler> ConfigFileHandlers;
216 
218  ClangTidyOptions DefaultOptions,
220  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
221 
223  ClangTidyOptions DefaultOptions,
226 
227 protected:
228  void addRawFileOptions(llvm::StringRef AbsolutePath,
229  std::vector<OptionsSource> &CurOptions);
230 
231  /// Try to read configuration files from \p Directory using registered
232  /// \c ConfigHandlers.
233  std::optional<OptionsSource> tryReadConfigFile(llvm::StringRef Directory);
234 
235  llvm::StringMap<OptionsSource> CachedOptions;
238  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS;
239 };
240 
241 /// Implementation of ClangTidyOptions interface, which is used for
242 /// '-config' command-line option.
244 public:
246  ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions DefaultOptions,
248  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
249  std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
250 
251 private:
252  ClangTidyOptions ConfigOptions;
253 };
254 
255 /// Implementation of the \c ClangTidyOptionsProvider interface, which
256 /// tries to find a configuration file in the closest parent directory of each
257 /// source file.
258 ///
259 /// By default, files named ".clang-tidy" will be considered, and the
260 /// \c clang::tidy::parseConfiguration function will be used for parsing, but a
261 /// custom set of configuration file names and parsing functions can be
262 /// specified using the appropriate constructor.
264 public:
265  /// Initializes the \c FileOptionsProvider instance.
266  ///
267  /// \param GlobalOptions are just stored and returned to the caller of
268  /// \c getGlobalOptions.
269  ///
270  /// \param DefaultOptions are used for all settings not specified in a
271  /// configuration file.
272  ///
273  /// If any of the \param OverrideOptions fields are set, they will override
274  /// whatever options are read from the configuration file.
276  ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions DefaultOptions,
278  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr);
279 
280  /// Initializes the \c FileOptionsProvider instance with a custom set
281  /// of configuration file handlers.
282  ///
283  /// \param GlobalOptions are just stored and returned to the caller of
284  /// \c getGlobalOptions.
285  ///
286  /// \param DefaultOptions are used for all settings not specified in a
287  /// configuration file.
288  ///
289  /// If any of the \param OverrideOptions fields are set, they will override
290  /// whatever options are read from the configuration file.
291  ///
292  /// \param ConfigHandlers specifies a custom set of configuration file
293  /// handlers. Each handler is a pair of configuration file name and a function
294  /// that can parse configuration from this file type. The configuration files
295  /// in each directory are searched for in the order of appearance in
296  /// \p ConfigHandlers.
298  ClangTidyOptions DefaultOptions,
301 
302  std::vector<OptionsSource> getRawOptions(llvm::StringRef FileName) override;
303 };
304 
305 /// Parses LineFilter from JSON and stores it to the \p Options.
306 std::error_code parseLineFilter(llvm::StringRef LineFilter,
307  ClangTidyGlobalOptions &Options);
308 
309 /// Parses configuration from JSON and returns \c ClangTidyOptions or an
310 /// error.
311 llvm::ErrorOr<ClangTidyOptions>
312 parseConfiguration(llvm::MemoryBufferRef Config);
313 
314 using DiagCallback = llvm::function_ref<void(const llvm::SMDiagnostic &)>;
315 
316 llvm::ErrorOr<ClangTidyOptions>
317 parseConfigurationWithDiags(llvm::MemoryBufferRef Config, DiagCallback Handler);
318 
319 /// Serializes configuration to a YAML-encoded string.
320 std::string configurationAsText(const ClangTidyOptions &Options);
321 
322 } // namespace clang::tidy
323 
324 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYOPTIONS_H
clang::tidy::ClangTidyOptions::ExtraArgs
std::optional< ArgList > ExtraArgs
Add extra compilation arguments to the end of the list.
Definition: ClangTidyOptions.h:122
clang::tidy::parseConfiguration
llvm::ErrorOr< ClangTidyOptions > parseConfiguration(llvm::MemoryBufferRef Config)
Parses configuration from JSON and returns ClangTidyOptions or an error.
Definition: ClangTidyOptions.cpp:416
clang::tidy::DefaultOptionsProvider::getRawOptions
std::vector< OptionsSource > getRawOptions(llvm::StringRef FileName) override
Returns an ordered vector of OptionsSources, in order of increasing priority.
Definition: ClangTidyOptions.cpp:223
clang::tidy::ClangTidyOptions::OptionMap
llvm::StringMap< ClangTidyValue > OptionMap
Definition: ClangTidyOptions.h:114
clang::tidy::DefaultOptionsProvider
Implementation of the ClangTidyOptionsProvider interface, which returns the same options for all file...
Definition: ClangTidyOptions.h:174
clang::tidy::ClangTidyOptions::ClangTidyValue::Priority
unsigned Priority
Priority stores relative precedence of the value loaded from config files to disambiguate local vs gl...
Definition: ClangTidyOptions.h:111
clang::tidy::FileOptionsBaseProvider::ConfigHandlers
ConfigFileHandlers ConfigHandlers
Definition: ClangTidyOptions.h:237
clang::tidy::ClangTidyOptionsProvider
Abstract interface for retrieving various ClangTidy options.
Definition: ClangTidyOptions.h:141
clang::tidy::parseLineFilter
std::error_code parseLineFilter(StringRef LineFilter, clang::tidy::ClangTidyGlobalOptions &Options)
Parses -line-filter option and stores it to the Options.
Definition: ClangTidyOptions.cpp:408
clang::tidy::ClangTidyOptions::ClangTidyValue::ClangTidyValue
ClangTidyValue(llvm::StringRef Value, unsigned Priority=0)
Definition: ClangTidyOptions.h:105
clang::tidy::ClangTidyOptions::ArgList
std::vector< std::string > ArgList
Definition: ClangTidyOptions.h:119
clang::tidy::ClangTidyOptionsProvider::OptionsSourceTypeCheckCommandLineOption
static const char OptionsSourceTypeCheckCommandLineOption[]
Definition: ClangTidyOptions.h:144
clang::tidy::FileOptionsBaseProvider::addRawFileOptions
void addRawFileOptions(llvm::StringRef AbsolutePath, std::vector< OptionsSource > &CurOptions)
Definition: ClangTidyOptions.cpp:281
clang::tidy::ClangTidyOptions::ClangTidyValue
Helper structure for storing option value with priority of the value.
Definition: ClangTidyOptions.h:102
clang::tidy::FileFilter
Contains a list of line ranges in a single file.
Definition: ClangTidyOptions.h:28
clang::tidy::FileFilter::LineRanges
std::vector< LineRange > LineRanges
A list of line ranges in this file, for which we show warnings.
Definition: ClangTidyOptions.h:36
clang::tidy::ClangTidyOptions::CheckOptions
OptionMap CheckOptions
Key-value mapping used to store check-specific options.
Definition: ClangTidyOptions.h:117
clang::tidy::ConfigOptionsProvider::ConfigOptionsProvider
ConfigOptionsProvider(ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions DefaultOptions, ClangTidyOptions ConfigOptions, ClangTidyOptions OverrideOptions, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS=nullptr)
Definition: ClangTidyOptions.cpp:229
clang::tidy::parseConfigurationWithDiags
llvm::ErrorOr< ClangTidyOptions > parseConfigurationWithDiags(llvm::MemoryBufferRef Config, DiagCallback Handler)
Definition: ClangTidyOptions.cpp:430
clang::tidy::ClangTidyOptions
Contains options for clang-tidy.
Definition: ClangTidyOptions.h:49
clang::tidy::ClangTidyOptionsProvider::OptionsSourceTypeDefaultBinary
static const char OptionsSourceTypeDefaultBinary[]
Definition: ClangTidyOptions.h:143
clang::tidy::DefaultOptionsProvider::getGlobalOptions
const ClangTidyGlobalOptions & getGlobalOptions() override
Returns global options, which are independent of the file.
Definition: ClangTidyOptions.h:180
clang::tidy::FileOptionsProvider
Implementation of the ClangTidyOptionsProvider interface, which tries to find a configuration file in...
Definition: ClangTidyOptions.h:263
clang::tidy::ClangTidyOptions::InheritParentConfig
std::optional< bool > InheritParentConfig
Only used in the FileOptionsProvider and ConfigOptionsProvider.
Definition: ClangTidyOptions.h:134
clang::tidy::ClangTidyOptionsProvider::OptionsSource
std::pair< ClangTidyOptions, std::string > OptionsSource
ClangTidyOptions and its source.
Definition: ClangTidyOptions.h:160
clang::tidy::FileOptionsBaseProvider
Definition: ClangTidyOptions.h:190
clang::tidy::ClangTidyGlobalOptions::LineFilter
std::vector< FileFilter > LineFilter
Output warnings from certain line ranges of certain files only.
Definition: ClangTidyOptions.h:44
clang::tidy::ClangTidyOptions::mergeWith
ClangTidyOptions & mergeWith(const ClangTidyOptions &Other, unsigned Order)
Overwrites all fields in here by the fields of Other that have a value.
Definition: ClangTidyOptions.cpp:177
Config
static cl::opt< std::string > Config("config", cl::desc(R"( Specifies a configuration in YAML/JSON format: -config="{Checks:' *', CheckOptions:{x: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))
clang::tidy::FileOptionsBaseProvider::FS
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS
Definition: ClangTidyOptions.h:238
clang::tidy::FileOptionsProvider::getRawOptions
std::vector< OptionsSource > getRawOptions(llvm::StringRef FileName) override
Returns an ordered vector of OptionsSources, in order of increasing priority.
Definition: ClangTidyOptions.cpp:340
clang::tidy::ClangTidyOptions::ClangTidyValue::ClangTidyValue
ClangTidyValue()
Definition: ClangTidyOptions.h:103
Directory
llvm::StringRef Directory
Definition: Serialization.cpp:424
clang::tidy::ClangTidyOptionsProvider::getGlobalOptions
virtual const ClangTidyGlobalOptions & getGlobalOptions()=0
Returns global options, which are independent of the file.
clang::tidy::FileOptionsBaseProvider::CachedOptions
llvm::StringMap< OptionsSource > CachedOptions
Definition: ClangTidyOptions.h:235
clang::tidy::FileOptionsBaseProvider::ConfigFileHandler
std::pair< std::string, std::function< llvm::ErrorOr< ClangTidyOptions > llvm::MemoryBufferRef)> > ConfigFileHandler
Definition: ClangTidyOptions.h:196
clang::tidy::configurationAsText
std::string configurationAsText(const ClangTidyOptions &Options)
Serializes configuration to a YAML-encoded string.
Definition: ClangTidyOptions.cpp:441
clang::tidy
Definition: AbseilTidyModule.cpp:32
FileName
StringRef FileName
Definition: KernelNameRestrictionCheck.cpp:44
clang::tidy::ClangTidyOptions::HeaderFilterRegex
std::optional< std::string > HeaderFilterRegex
Output warnings from headers matching this filter.
Definition: ClangTidyOptions.h:76
clang::tidy::FileOptionsBaseProvider::tryReadConfigFile
std::optional< OptionsSource > tryReadConfigFile(llvm::StringRef Directory)
Try to read configuration files from Directory using registered ConfigHandlers.
Definition: ClangTidyOptions.cpp:361
clang::tidy::FileOptionsProvider::FileOptionsProvider
FileOptionsProvider(ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions DefaultOptions, ClangTidyOptions OverrideOptions, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS=nullptr)
Initializes the FileOptionsProvider instance.
Definition: ClangTidyOptions.cpp:320
clang::tidy::ClangTidyOptionsProvider::OptionsSourceTypeConfigCommandLineOption
static const char OptionsSourceTypeConfigCommandLineOption[]
Definition: ClangTidyOptions.h:145
clang::tidy::ClangTidyGlobalOptions
Global options.
Definition: ClangTidyOptions.h:41
clang::tidy::ConfigOptionsProvider
Implementation of ClangTidyOptions interface, which is used for '-config' command-line option.
Definition: ClangTidyOptions.h:243
clang::tidy::ClangTidyOptions::Checks
std::optional< std::string > Checks
Checks filter.
Definition: ClangTidyOptions.h:69
clang::tidy::ClangTidyOptions::UseColor
std::optional< bool > UseColor
Use colors in diagnostics. If missing, it will be auto detected.
Definition: ClangTidyOptions.h:137
clang::tidy::FileFilter::Name
std::string Name
File name.
Definition: ClangTidyOptions.h:30
clang::tidy::DiagCallback
llvm::function_ref< void(const llvm::SMDiagnostic &)> DiagCallback
Definition: ClangTidyOptions.h:314
clang::tidy::ClangTidyOptionsProvider::getOptions
ClangTidyOptions getOptions(llvm::StringRef FileName)
Returns options applying to a specific translation unit with the specified FileName.
Definition: ClangTidyOptions.cpp:214
clang::tidy::FileOptionsBaseProvider::FileOptionsBaseProvider
FileOptionsBaseProvider(ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions DefaultOptions, ClangTidyOptions OverrideOptions, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS)
Definition: ClangTidyOptions.cpp:260
clang::tidy::FileOptionsBaseProvider::ConfigFileHandlers
std::vector< ConfigFileHandler > ConfigFileHandlers
Configuration file handlers listed in the order of priority.
Definition: ClangTidyOptions.h:215
LineFilter
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))
clang::tidy::ClangTidyOptions::WarningsAsErrors
std::optional< std::string > WarningsAsErrors
WarningsAsErrors filter.
Definition: ClangTidyOptions.h:72
clang::tidy::ClangTidyOptions::SystemHeaders
std::optional< bool > SystemHeaders
Output warnings from system headers matching HeaderFilterRegex.
Definition: ClangTidyOptions.h:79
clang::tidy::ClangTidyOptions::FormatStyle
std::optional< std::string > FormatStyle
Format code around applied fixes with clang-format using this style.
Definition: ClangTidyOptions.h:93
clang::tidy::FileFilter::LineRange
std::pair< unsigned, unsigned > LineRange
LineRange is a pair<start, end> (inclusive).
Definition: ClangTidyOptions.h:33
clang::tidy::ClangTidyOptionsProvider::getRawOptions
virtual std::vector< OptionsSource > getRawOptions(llvm::StringRef FileName)=0
Returns an ordered vector of OptionsSources, in order of increasing priority.
clang::tidy::ClangTidyOptions::ClangTidyValue::Value
std::string Value
Definition: ClangTidyOptions.h:108
clang::tidy::FileOptionsBaseProvider::OverrideOptions
ClangTidyOptions OverrideOptions
Definition: ClangTidyOptions.h:236
clang::tidy::ClangTidyOptions::User
std::optional< std::string > User
Specifies the name or e-mail of the user running clang-tidy.
Definition: ClangTidyOptions.h:99
clang::tidy::ClangTidyOptionsProvider::~ClangTidyOptionsProvider
virtual ~ClangTidyOptionsProvider()
Definition: ClangTidyOptions.h:147
clang::tidy::ClangTidyOptions::ClangTidyValue::ClangTidyValue
ClangTidyValue(const char *Value)
Definition: ClangTidyOptions.h:104
clang::tidy::ClangTidyOptions::merge
ClangTidyOptions merge(const ClangTidyOptions &Other, unsigned Order) const
Creates a new ClangTidyOptions instance combined from all fields of this instance overridden by the f...
Definition: ClangTidyOptions.cpp:198
clang::tidy::ClangTidyOptions::getDefaults
static ClangTidyOptions getDefaults()
These options are used for all settings that haven't been overridden by the OptionsProvider.
Definition: ClangTidyOptions.cpp:141
clang::tidy::ConfigOptionsProvider::getRawOptions
std::vector< OptionsSource > getRawOptions(llvm::StringRef FileName) override
Returns an ordered vector of OptionsSources, in order of increasing priority.
Definition: ClangTidyOptions.cpp:239
clang::tidy::ClangTidyOptions::StringPair
std::pair< std::string, std::string > StringPair
Definition: ClangTidyOptions.h:113
clang::tidy::ClangTidyOptions::ExtraArgsBefore
std::optional< ArgList > ExtraArgsBefore
Add extra compilation arguments to the start of the list.
Definition: ClangTidyOptions.h:125
clang::tidy::DefaultOptionsProvider::DefaultOptionsProvider
DefaultOptionsProvider(ClangTidyGlobalOptions GlobalOptions, ClangTidyOptions Options)
Definition: ClangTidyOptions.h:176