From: Leonard Chan Date: Thu, 4 Aug 2022 22:56:32 +0000 (+0000) Subject: Revert "[clang][Darwin] Always set the default C++ Standard Library to libc++" X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33171df9cc7f6560dea7b0b162ab51ff97417468;p=platform%2Fupstream%2Fllvm.git Revert "[clang][Darwin] Always set the default C++ Standard Library to libc++" This reverts commit c5ccb78ade8136134e0ca9dde64de97f913f0f8c. We're seeing darwin-stdlib.cpp fail on our linux, mac, and windows builders: https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8806821020552676065/overview --- diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index 7e3fc62..bada811 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -896,7 +896,12 @@ types::ID MachO::LookupTypeForExtension(StringRef Ext) const { bool MachO::HasNativeLLVMSupport() const { return true; } ToolChain::CXXStdlibType Darwin::GetDefaultCXXStdlibType() const { - // Always use libc++ by default + // 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++ return ToolChain::CST_Libcxx; } diff --git a/clang/test/Driver/darwin-iphone-defaults.m b/clang/test/Driver/darwin-iphone-defaults.m index 79d3bc8..ec9507f 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-darwin -miphoneos-version-min=5.0 -arch armv7 -stdlib=platform -flto -S -o - %s | FileCheck %s +// RUN: %clang -target i386-apple-darwin9 -miphoneos-version-min=3.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 d15eb19..0538a42 100644 --- a/clang/test/Driver/darwin-stdlib.cpp +++ b/clang/test/Driver/darwin-stdlib.cpp @@ -2,10 +2,13 @@ // 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 -// 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 +// 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 -// CHECK: "-stdlib=libc++" -// CHECK-NOT: "-stdlib=libstdc++" +// CHECK-LIBCXX: "-stdlib=libc++" +// CHECK-LIBSTDCXX-NOT: -stdlib=libc++ +// CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++