[PATCH] D72415: [clangd] Respect `--sysroot` argument if it is set
David Goldman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 8 14:04:51 PST 2020
dgoldman created this revision.
dgoldman added a reviewer: sammccall.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
- Since `--sysroot` is a superset of the `-isysroot` argument, we shouldn't add the `-isysroot` if we detect a `--sysroot` flag.
Repository:
rG LLVM Github Monorepo
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.236903.patch
Type: text/x-patch
Size: 643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200108/0f9073c3/attachment.bin>
More information about the cfe-commits
mailing list