Hi Tim, as I did the change: Sorry that it broke for you on Darwin! I could not test myself and there doesn't seem to be a build-bot...
To the change: I think the explicit passing of -stdlib=libc++ will override CLANG_DEFAULT_CXX_STDLIB on Darwin. Instead, Darwin::AddClangCXXStdlibIncludeArgs should be implemented, maybe similar to Linux::AddClangCXXStdlibIncludeArgs. (ToolChain::AddClangCXXStdlibIncludeArgs states that the implementation of passing down -stdlib is legacy anyway) With regard to the test case: First I think this currently won't ever be executed because it resists in the root directory. And second: Testing the default stdlib chosen by clang is fragile now because it can be changed by CLANG_DEFAULT_CXX_STDLIB which would fail all the tests! I already had this problem with FreeBSD and NetBSD. As a solution we could think about implementing -stdlib=default which would take the architecture default instead... Greetings, Jonas ________________________________________ Von: cfe-commits <cfe-commits-boun...@lists.llvm.org> im Auftrag von Tim Northover via cfe-commits <cfe-commits@lists.llvm.org> Gesendet: Freitag, 12. Februar 2016 23:30 An: cfe-commits@lists.llvm.org Betreff: r260755 - Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++ Author: tnorthover Date: Fri Feb 12 16:30:42 2016 New Revision: 260755 URL: http://llvm.org/viewvc/llvm-project?rev=260755&view=rev Log: Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++ Recent refactoring meant it only got passed down when explicitly specified, which breaks header search on Darwin. Added: cfe/trunk/darwin-stdlib.cpp Modified: cfe/trunk/lib/Driver/ToolChains.cpp Added: cfe/trunk/darwin-stdlib.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/darwin-stdlib.cpp?rev=260755&view=auto ============================================================================== --- cfe/trunk/darwin-stdlib.cpp (added) +++ cfe/trunk/darwin-stdlib.cpp Fri Feb 12 16:30:42 2016 @@ -0,0 +1,16 @@ +// RUN: %clang -target x86_64-apple-darwin -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.8 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX +// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -arch armv7s -miphoneos-version-min=6.1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX +// RUN: %clang -target x86_64-apple-darwin -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -arch armv7k %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX + +// The purpose of this test is that the libc++ headers should be found +// properly. At the moment this is done by passing -stdlib=libc++ down to the +// cc1 invocation. If and when we change to finding them in the driver this test +// should reflect that. + +// CHECK-LIBCXX: -stdlib=libc++ + +// CHECK-LIBSTDCXX-NOT: -stdlib=libc++ +// CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++ Modified: cfe/trunk/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=260755&r1=260754&r2=260755&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Feb 12 16:30:42 2016 @@ -1030,6 +1030,7 @@ DerivedArgList *Darwin::TranslateArgs(co const char *BoundArch) const { // First get the generic Apple args, before moving onto Darwin-specific ones. DerivedArgList *DAL = MachO::TranslateArgs(Args, BoundArch); + const OptTable &Opts = getDriver().getOpts(); // If no architecture is bound, none of the translations here are relevant. if (!BoundArch) @@ -1060,6 +1061,11 @@ DerivedArgList *Darwin::TranslateArgs(co } } + if (!Args.getLastArg(options::OPT_stdlib_EQ) && + GetDefaultCXXStdlibType() == ToolChain::CST_Libcxx) + DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_stdlib_EQ), + "libc++"); + // Validate the C++ standard library choice. CXXStdlibType Type = GetCXXStdlibType(*DAL); if (Type == ToolChain::CST_Libcxx) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits