[clang-tools-extra] [clangd] Fix off-by-one error in CommandMangler (PR #156593)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 2 23:41:32 PDT 2025


================
@@ -526,6 +526,16 @@ TEST(CommandMangler, RespectsOriginalSysroot) {
                 Not(HasSubstr(testPath("fake/sysroot"))));
   }
 }
+
+TEST(CommandMangler, StdLatestFlag) {
+  const auto Mangler = CommandMangler::forTests();
+  tooling::CompileCommand Cmd;
+  Cmd.CommandLine = {"clang-cl", "-std:c++latest", "--", "/Users/foo.cc"};
+  Mangler(Cmd, "/Users/foo.cc");
+  // Check that the -std:c++latest flag is not dropped
----------------
HighCommander4 wrote:

Not sure if this is the best test case for this change. `-std:c++latest` being dropped in `transferCompileCommand()` is a separate bug that will hopefully be fixed in the near future.

But I'm not sure how to write a more direct test for "`transferCompileCommand()` was not called", and the scenario being tested here is a valid one from a user expectation point of view.

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


More information about the cfe-commits mailing list