[cfe-commits] r136507 - /cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Jul 29 19:02:56 PDT 2011
On Fri, Jul 29, 2011 at 1:21 PM, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Fri Jul 29 15:21:18 2011
> New Revision: 136507
>
> URL: http://llvm.org/viewvc/llvm-project?rev=136507&view=rev
> Log:
> 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>
>
> Modified:
> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>
> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=136507&r1=136506&r2=136507&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Fri Jul 29 15:21:18 2011
> @@ -940,8 +940,24 @@
> 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);
> }
Is there any particular reason to restrict this to Darwin?
-Eli
More information about the cfe-commits
mailing list