[clang] c5ccb78 - [clang][Darwin] Always set the default C++ Standard Library to libc++
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 3 12:40:48 PDT 2022
Author: Louis Dionne
Date: 2022-08-03T15:40:27-04:00
New Revision: c5ccb78ade8136134e0ca9dde64de97f913f0f8c
URL: https://github.com/llvm/llvm-project/commit/c5ccb78ade8136134e0ca9dde64de97f913f0f8c
DIFF: https://github.com/llvm/llvm-project/commit/c5ccb78ade8136134e0ca9dde64de97f913f0f8c.diff
LOG: [clang][Darwin] Always set the default C++ Standard Library to libc++
Newer SDKs don't even provide libstdc++ headers, so it's effectively
never valid to build for libstdc++ unless the user explicitly asks
for it (in which case they will need to provide include paths and more).
Added:
Modified:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/darwin-iphone-defaults.m
clang/test/Driver/darwin-stdlib.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index bada811daadfe..7e3fc625d8c85 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -896,12 +896,7 @@ types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
bool MachO::HasNativeLLVMSupport() const { return true; }
ToolChain::CXXStdlibType Darwin::GetDefaultCXXStdlibType() const {
- // Use libstdc++ on old targets (OSX < 10.9 and iOS < 7)
- if ((isTargetMacOSBased() && isMacosxVersionLT(10, 9)) ||
- (isTargetIOSBased() && isIPhoneOSVersionLT(7, 0)))
- return ToolChain::CST_Libstdcxx;
-
- // On all other targets, use libc++
+ // Always use libc++ by default
return ToolChain::CST_Libcxx;
}
diff --git a/clang/test/Driver/darwin-iphone-defaults.m b/clang/test/Driver/darwin-iphone-defaults.m
index ec9507fd091a3..79d3bc848faf5 100644
--- a/clang/test/Driver/darwin-iphone-defaults.m
+++ b/clang/test/Driver/darwin-iphone-defaults.m
@@ -1,4 +1,4 @@
-// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.0 -arch armv7 -stdlib=platform -flto -S -o - %s | FileCheck %s
+// RUN: %clang -target i386-apple-darwin -miphoneos-version-min=5.0 -arch armv7 -stdlib=platform -flto -S -o - %s | FileCheck %s
// CHECK: @f0() [[F0:#[0-9]+]]
// CHECK: @__f0_block_invoke
diff --git a/clang/test/Driver/darwin-stdlib.cpp b/clang/test/Driver/darwin-stdlib.cpp
index 0538a42ecd5cc..d15eb1932e3ca 100644
--- a/clang/test/Driver/darwin-stdlib.cpp
+++ b/clang/test/Driver/darwin-stdlib.cpp
@@ -2,13 +2,10 @@
// than the platform default. (see https://llvm.org/bugs/show_bug.cgi?id=30548)
// XFAIL: default-cxx-stdlib-set
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.8 -Wno-stdlibcxx-not-found %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=6.1 -Wno-stdlibcxx-not-found %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
-// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k %s -### 2>&1 | FileCheck %s
-// CHECK-LIBCXX: "-stdlib=libc++"
-// CHECK-LIBSTDCXX-NOT: -stdlib=libc++
-// CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++
+// CHECK: "-stdlib=libc++"
+// CHECK-NOT: "-stdlib=libstdc++"
More information about the cfe-commits
mailing list