[clang] 80e66a0 - [clang][NFC] Refactor logic for picking standard library on Apple
Louis Dionne via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 22 09:35:53 PDT 2022
Author: Louis Dionne
Date: 2022-03-22T12:35:47-04:00
New Revision: 80e66a05b6fad7d5f0ef71d5e0a74ce5ddc157a5
URL: https://github.com/llvm/llvm-project/commit/80e66a05b6fad7d5f0ef71d5e0a74ce5ddc157a5
DIFF: https://github.com/llvm/llvm-project/commit/80e66a05b6fad7d5f0ef71d5e0a74ce5ddc157a5.diff
LOG: [clang][NFC] Refactor logic for picking standard library on Apple
Flip the logic around: always default to libc++ except on older platforms,
instead of defaulting to libstdc++ except on newer platforms. Since roughly
all supported platforms use libc++ now, it makes more sense to make that
the default, and allows the removal of some downstream diff.
Differential Revision: https://reviews.llvm.org/D122232
Added:
Modified:
clang/lib/Driver/ToolChains/Darwin.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 47eb14ffb83e4..9f0eeea8d54e2 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -869,13 +869,13 @@ types::ID MachO::LookupTypeForExtension(StringRef Ext) const {
bool MachO::HasNativeLLVMSupport() const { return true; }
ToolChain::CXXStdlibType Darwin::GetDefaultCXXStdlibType() const {
- // Default to use libc++ on OS X 10.9+ and iOS 7+.
- if ((isTargetMacOSBased() && !isMacosxVersionLT(10, 9)) ||
- (isTargetIOSBased() && !isIPhoneOSVersionLT(7, 0)) ||
- isTargetWatchOSBased())
- return ToolChain::CST_Libcxx;
+ // Use libstdc++ on old targets (OSX < 10.9 and iOS < 7)
+ if ((isTargetMacOSBased() && isMacosxVersionLT(10, 9)) ||
+ (isTargetIOSBased() && isIPhoneOSVersionLT(7, 0)))
+ return ToolChain::CST_Libstdcxx;
- return ToolChain::CST_Libstdcxx;
+ // On all other targets, use libc++
+ return ToolChain::CST_Libcxx;
}
/// Darwin provides an ARC runtime starting in MacOS X 10.7 and iOS 5.0.
More information about the cfe-commits
mailing list