[PATCH] D72415: [clangd] Respect `--sysroot` argument if it is set

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 9 08:12:24 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGea9888b8f6f2: [clangd] Respect `--sysroot` argument if it is set (authored by dgoldman).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72415/new/

https://reviews.llvm.org/D72415

Files:
  clang-tools-extra/clangd/CompileCommands.cpp


Index: clang-tools-extra/clangd/CompileCommands.cpp
===================================================================
--- clang-tools-extra/clangd/CompileCommands.cpp
+++ clang-tools-extra/clangd/CompileCommands.cpp
@@ -155,7 +155,9 @@
   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);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72415.237091.patch
Type: text/x-patch
Size: 643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200109/b81a4499/attachment.bin>


More information about the cfe-commits mailing list