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.

llvm-svn: 194834
This commit is contained in:
Justin Bogner
2013-11-15 18:07:59 +00:00
parent 2e8350b2b9
commit 13a641b338

View File

@@ -475,15 +475,17 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
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);
}
}