https://github.com/Decodetalkers updated https://github.com/llvm/llvm-project/pull/200001
>From caa62bc8dc234f19105e929887488b41caa9fb39 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp index 4eda330716f21..e820ab01877f6 100644 --- a/clang-tools-extra/clangd/CompileCommands.cpp +++ b/clang-tools-extra/clangd/CompileCommands.cpp @@ -273,6 +273,18 @@ void CommandMangler::operator()(tooling::CompileCommand &Command, SawInput(Cmd[I]); Cmd.resize(DashDashIndex); } + + std::string UnsupportedArguments; + for (auto *UnknownArg : ArgList.filtered(options::OPT_UNKNOWN)) { + unsigned Index = UnknownArg->getIndex(); + UnsupportedArguments += OriginalArgs[Index + 1]; + UnsupportedArguments += ", "; + IndicesToDrop.push_back(Index); + } + if (UnsupportedArguments.length() != 0) { + UnsupportedArguments.pop_back(); + UnsupportedArguments.pop_back(); + } llvm::sort(IndicesToDrop); for (unsigned Idx : llvm::reverse(IndicesToDrop)) // +1 to account for the executable name in Cmd[0] that @@ -327,6 +339,10 @@ void CommandMangler::operator()(tooling::CompileCommand &Command, return Elem.starts_with("--save-temps") || Elem.starts_with("-save-temps"); }); + if (UnsupportedArguments.length() != 0) { + log("Warning: detected unsupported Flags {0}", UnsupportedArguments); + } + std::vector<std::string> ToAppend; if (ResourceDir && !HasExact("-resource-dir") && !HasPrefix("-resource-dir=")) ToAppend.push_back(("-resource-dir=" + *ResourceDir)); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
