=?utf-8?q?Félix-Antoine?= Constantin,
=?utf-8?q?Félix-Antoine?= Constantin,
=?utf-8?q?Félix-Antoine?= Constantin
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
================
@@ -581,6 +581,24 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
return AdjustedArgs;
};
+ // Remove unwanted arguments passed to the compiler
+ ArgumentsAdjuster CompilationArgsToRemove =
+ [&Context](const CommandLineArguments &Args, StringRef Filename) {
+ ClangTidyOptions Opts = Context.getOptionsForFile(Filename);
+ CommandLineArguments AdjustedArgs = Args;
+
+ if (Opts.RemovedArgs) {
+ for (StringRef ArgToIgnore : *Opts.RemovedArgs) {
+ AdjustedArgs.erase(std::remove(AdjustedArgs.begin(),
+ AdjustedArgs.end(), ArgToIgnore),
+ AdjustedArgs.end());
+ }
+ }
+
+ return AdjustedArgs;
+ };
+
+ Tool.appendArgumentsAdjuster(CompilationArgsToRemove);
----------------
carlosgalvezp wrote:
Nit: for consistency with the one for `ExtraArgs`, maybe we can call this
`PerFileArgumentRemover`?
https://github.com/llvm/llvm-project/pull/164344
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits