[clang] [Driver] Fix detection of libc++ with empty sysroot. (PR #66947)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 20 12:29:20 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
<details>
<summary>Changes</summary>
b1e3cd1d79443603dc003441e07cdd8d30bb7f26 dropped the leading slash here,
presumably unintentionally.
(I don't understand Driver well enough to know how/where this is supposed
to be tested, but it broke clangd on any project that uses the
system-installed -stdlib=libc++ on a standard debian install)
---
Full diff: https://github.com/llvm/llvm-project/pull/66947.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+2-2)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index e909549d20708fe..f2fd85021a777b4 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3139,11 +3139,11 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
// not be found at ../include/c++ but it likely to be found at
// one of the following two locations:
SmallString<128> UsrLocalIncludeDir(SysRoot);
- llvm::sys::path::append(UsrLocalIncludeDir, "usr", "local", "include");
+ llvm::sys::path::append(UsrLocalIncludeDir, "/usr", "local", "include");
if (AddIncludePath(UsrLocalIncludeDir))
return;
SmallString<128> UsrIncludeDir(SysRoot);
- llvm::sys::path::append(UsrIncludeDir, "usr", "include");
+ llvm::sys::path::append(UsrIncludeDir, "/usr", "include");
if (AddIncludePath(UsrIncludeDir))
return;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/66947
More information about the cfe-commits
mailing list