]> granicus.if.org Git - clang/commitdiff
Default to use libc++ on OS X 10.9+ and iOS 7+.
authorBob Wilson <bob.wilson@apple.com>
Sat, 2 Nov 2013 23:19:53 +0000 (23:19 +0000)
committerBob Wilson <bob.wilson@apple.com>
Sat, 2 Nov 2013 23:19:53 +0000 (23:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193934 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
test/PCH/cxx-typeid.cpp

index 99a182e40139cc63108f8cfd6b3b1f5be07557a1..cc1efb69c9e5d48170a59ddb958e89bff4aff539 100644 (file)
@@ -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) {
index 534863af21b1c48885acff8443e8e4f25fbb3d20..6e622206521ca1f9a3d9fd8676d9eec1cf4e16ff 100644 (file)
@@ -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