diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-29 20:21:18 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-29 20:21:18 +0000 |
commit | f4016fdf7140f19f08425dc5e6bce983a0a61f12 (patch) | |
tree | d201df693aebee61bdd89e78954d90a29741adbe /clang/lib/Frontend/InitHeaderSearch.cpp | |
parent | 539db98987b18c31c4b236fa911c0ebaef47c42c (diff) | |
download | bcm5719-llvm-f4016fdf7140f19f08425dc5e6bce983a0a61f12.tar.gz bcm5719-llvm-f4016fdf7140f19f08425dc5e6bce983a0a61f12.zip |
On Darwin, libc++ may be installed alongside the compiler in
lib/c++/v1. Look there first, before falling back to the normal
/usr/include/c++/v1. <rdar://problem/9866149>
llvm-svn: 136507
Diffstat (limited to 'clang/lib/Frontend/InitHeaderSearch.cpp')
-rw-r--r-- | clang/lib/Frontend/InitHeaderSearch.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index f596b992f54..61cc223b3fb 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -940,8 +940,24 @@ void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang, const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes) { - if (HSOpts.UseLibcxx) + if (HSOpts.UseLibcxx) { + if (triple.isOSDarwin()) { + // On Darwin, libc++ may be installed alongside the compiler in + // lib/c++/v1. + llvm::sys::Path P(HSOpts.ResourceDir); + if (!P.isEmpty()) { + P.eraseComponent(); // Remove version from foo/lib/clang/version + P.eraseComponent(); // Remove clang from foo/lib/clang + + // Get foo/lib/c++/v1 + P.appendComponent("c++"); + P.appendComponent("v1"); + AddPath(P.str(), CXXSystem, true, false, false, true); + } + } + AddPath("/usr/include/c++/v1", CXXSystem, true, false, false); + } else AddDefaultCPlusPlusIncludePaths(triple, HSOpts); } |