|
18 | 18 | #include "../ClangTidy.h" |
19 | 19 | #include "../ClangTidyForceLinker.h" |
20 | 20 | #include "../GlobList.h" |
| 21 | +#include "../utils/OptionsUtils.h" |
21 | 22 | #include "clang/Tooling/CommonOptionsParser.h" |
22 | 23 | #include "llvm/ADT/StringSet.h" |
23 | 24 | #include "llvm/Support/CommandLine.h" |
@@ -77,6 +78,7 @@ Configuration files: |
77 | 78 | (if any exists) will be taken and the current |
78 | 79 | config file will be applied on top of the |
79 | 80 | parent one. |
| 81 | + RemovedArgs - Same as '--removed-arg'. |
80 | 82 | SystemHeaders - Same as '--system-headers'. |
81 | 83 | UseColor - Same as '--use-color'. |
82 | 84 | User - Specifies the name or e-mail of the user |
@@ -357,6 +359,16 @@ see https://clang.llvm.org/extra/clang-tidy/QueryBasedCustomChecks.html. |
357 | 359 | cl::init(false), |
358 | 360 | cl::cat(ClangTidyCategory)); |
359 | 361 |
|
| 362 | +static cl::list<std::string> RemovedArgs("removed-arg", desc(R"( |
| 363 | +List of arguments to remove from the command |
| 364 | +line sent to the compiler. Please note that |
| 365 | +removing arguments might change the semantic |
| 366 | +of the analzed code, possibly leading to |
| 367 | +compiler errors, false positives or |
| 368 | +false negatives. This option is applied |
| 369 | +before --extra-arg and --extra-arg-before)"), |
| 370 | + cl::cat(ClangTidyCategory)); |
| 371 | + |
360 | 372 | namespace clang::tidy { |
361 | 373 |
|
362 | 374 | static void printStats(const ClangTidyStats &Stats) { |
@@ -423,6 +435,8 @@ createOptionsProvider(llvm::IntrusiveRefCntPtr<vfs::FileSystem> FS) { |
423 | 435 | OverrideOptions.FormatStyle = FormatStyle; |
424 | 436 | if (UseColor.getNumOccurrences() > 0) |
425 | 437 | OverrideOptions.UseColor = UseColor; |
| 438 | + if (RemovedArgs.getNumOccurrences() > 0) |
| 439 | + OverrideOptions.RemovedArgs = RemovedArgs; |
426 | 440 |
|
427 | 441 | auto LoadConfig = |
428 | 442 | [&](StringRef Configuration, |
|
0 commit comments