[clang-tools-extra] [clangd][modules] Remove the options when driver detects that it was unsupported, and log them (PR #200001)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 08:45:38 PDT 2026


================
@@ -561,7 +561,18 @@ TEST(CommandMangler, ClangClStdFlags_Inference) {
     EXPECT_THAT(llvm::join(Cmd.CommandLine, " "), HasSubstr("/std:c++latest"));
   }
 }
+TEST(CommandMangler, ClangUnknownArgs) {
+  // Check that clang-cl-specific will drop unknown flags
+  const auto Mangler = CommandMangler::forTests();
 
+  {
+    tooling::CompileCommand Cmd;
+    Cmd.CommandLine = {"clang-cl", "-std=c++23", "--unknown-flag=abcd.flag"};
----------------
ArcsinX wrote:

Why `clang-cl`? Maybe just `clang`?

Also, I think we can have several options to drop and at least one which we should not drop.

E.g. `--unknown-option=abcd -std=c++23 --unknown-flag`

And check that  `--unknown-option=abcd` and `--unknown-flag` were dropped, but `-std=c++23` is not

https://github.com/llvm/llvm-project/pull/200001


More information about the cfe-commits mailing list