commit 66dbb3f95e1666089acd3431792d02c623e459fc Author: Bob Wilson Date: Sat Nov 2 23:19:53 2013 +0000 Default to use libc++ on OS X 10.9+ and iOS 7+. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193934 91177308-0d34-0410-b5e6-96231b3b80d8 diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 99a182e..cc1efb6 100644 --- a/tools/clang/lib/Driver/ToolChains.cpp +++ b/tools/clang/lib/Driver/ToolChains.cpp @@ -839,6 +839,12 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, } } + // Default to use libc++ on OS X 10.9+ and iOS 7+. + if (((isTargetMacOS() && !isMacosxVersionLT(10, 9)) || + (isTargetIPhoneOS() && !isIPhoneOSVersionLT(7, 0))) && + !Args.getLastArg(options::OPT_stdlib_EQ)) + DAL->AddJoinedArg(0, Opts.getOption(options::OPT_stdlib_EQ), "libc++"); + // Validate the C++ standard library choice. CXXStdlibType Type = GetCXXStdlibType(*DAL); if (Type == ToolChain::CST_Libcxx) { diff --git a/test/PCH/cxx-typeid.cpp b/test/PCH/cxx-typeid.cpp index 534863a..6e62220 100644 --- a/tools/clang/test/PCH/cxx-typeid.cpp +++ b/tools/clang/test/PCH/cxx-typeid.cpp @@ -1,8 +1,8 @@ // Test this without pch. -// RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -verify %s +// RUN: %clang_cc1 -include %S/cxx-typeid.h -fsyntax-only -stdlib=libstdc++ -verify %s -// RUN: %clang_cc1 -x c++-header -emit-pch -o %t.pch %S/cxx-typeid.h -// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -verify %s +// RUN: %clang_cc1 -x c++-header -emit-pch -stdlib=libstdc++ -o %t.pch %S/cxx-typeid.h +// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -stdlib=libstdc++ -verify %s // expected-no-diagnostics