summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clangd/CompileCommands.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp
index b1eca02813b..f11b1236803 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -155,7 +155,9 @@ void CommandMangler::adjust(std::vector<std::string> &Cmd) const {
if (ResourceDir && !Has("-resource-dir"))
Cmd.push_back(("-resource-dir=" + *ResourceDir));
- if (Sysroot && !Has("-isysroot")) {
+ // Don't set `-isysroot` if it is already set or if `--sysroot` is set.
+ // `--sysroot` is a superset of the `-isysroot` argument.
+ if (Sysroot && !Has("-isysroot") && !Has("--sysroot")) {
Cmd.push_back("-isysroot");
Cmd.push_back(*Sysroot);
}
OpenPOWER on IntegriCloud