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

>From 22e2950f611e1aa91f61759f7b9c3601cf57f60b Mon Sep 17 00:00:00 2001
From: ShootingStarDragons <[email protected]>
Date: Fri, 5 Jun 2026 21:48:39 +0900
Subject: [PATCH] feat: remove unsupported compile options when driver detects
 them

and log the unsupported options to the editor
---
 clang-tools-extra/clangd/CompileCommands.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/clang-tools-extra/clangd/CompileCommands.cpp 
b/clang-tools-extra/clangd/CompileCommands.cpp
index 4eda330716f21..c589b622b66fa 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -273,6 +273,21 @@ void CommandMangler::operator()(tooling::CompileCommand 
&Command,
       SawInput(Cmd[I]);
     Cmd.resize(DashDashIndex);
   }
+
+  llvm::SmallVector<const char *, 16> UnknownArgs;
+
+  for (auto *UnknownArg : ArgList.filtered(options::OPT_UNKNOWN)) {
+    unsigned Index = UnknownArg->getIndex();
+    const auto *Argument = UnknownArg->getValue();
+    UnknownArgs.push_back(Argument);
+    IndicesToDrop.push_back(Index);
+  }
+
+  if (!UnknownArgs.empty()) {
+    log("Warning: detected unsupported Flags {0}",
+        llvm::join(UnknownArgs, ", "));
+  }
+
   llvm::sort(IndicesToDrop);
   for (unsigned Idx : llvm::reverse(IndicesToDrop))
     // +1 to account for the executable name in Cmd[0] that

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to