Darwin: Look for libc++ headers in include/, rather than lib/
Up until now we were expecting that when libc++ is installed alongside
clang the headers would be in lib/, which was true if the configure
build was used and false if the cmake build was.
We've now corrected the configure build to install in include/, and
with this change we'll be able to find the correct headers with both
build systems.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194834 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index 53074e2..d144cbb 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -475,15 +475,17 @@
if (HSOpts.UseLibcxx) {
if (triple.isOSDarwin()) {
// On Darwin, libc++ may be installed alongside the compiler in
- // lib/c++/v1.
+ // include/c++/v1.
if (!HSOpts.ResourceDir.empty()) {
// Remove version from foo/lib/clang/version
StringRef NoVer = llvm::sys::path::parent_path(HSOpts.ResourceDir);
// Remove clang from foo/lib/clang
- SmallString<128> P = llvm::sys::path::parent_path(NoVer);
-
- // Get foo/lib/c++/v1
- llvm::sys::path::append(P, "c++", "v1");
+ StringRef Lib = llvm::sys::path::parent_path(NoVer);
+ // Remove lib from foo/lib
+ SmallString<128> P = llvm::sys::path::parent_path(Lib);
+
+ // Get foo/include/c++/v1
+ llvm::sys::path::append(P, "include", "c++", "v1");
AddUnmappedPath(P.str(), CXXSystem, false);
}
}