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

>From 4b856ad0fd28ffe18c0d13308f94ba720717cf15 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..d22adef96513f 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> UnsupportedArgs;
+
+  for (auto *UnknownArg : ArgList.filtered(options::OPT_UNKNOWN)) {
+    unsigned Index = UnknownArg->getIndex();
+    const auto *Argument = UnknownArg->getValue();
+    UnsupportedArgs.push_back(Argument);
+    IndicesToDrop.push_back(Index);
+  }
+
+  if (!UnsupportedArgs.empty()) {
+    std::string UnsupportedArguments = llvm::join(UnsupportedArgs, ", ");
+    log("Warning: detected unsupported Flags {0}", UnsupportedArguments);
+  }
+
   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