Skip to content

Commit c725efe

Browse files
authored
Merge pull request #3357 from apple/lldb-Remove-superfluous-SDKTypeMinVersion-type-NFC
[lldb] Remove superfluous SDKTypeMinVersion type (NFC)
2 parents 405eae5 + 8b4225d commit c725efe

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -962,23 +962,14 @@ const std::string &SwiftASTContext::GetDescription() const {
962962
return m_description;
963963
}
964964

965-
namespace {
966-
struct SDKTypeMinVersion {
967-
XcodeSDK::Type sdk_type;
968-
unsigned min_version_major;
969-
unsigned min_version_minor;
970-
};
971-
} // namespace
972-
973-
/// Return the SDKType (+minimum version needed for Swift support) for
974-
/// the target triple, if that makes sense. Otherwise, return the
975-
/// unknown sdk type.
976-
static SDKTypeMinVersion GetSDKType(const llvm::Triple &target,
977-
const llvm::Triple &host) {
965+
/// Return the Xcode sdk type for the target triple, if that makes sense.
966+
/// Otherwise, return the unknown sdk type.
967+
static XcodeSDK::Type GetSDKType(const llvm::Triple &target,
968+
const llvm::Triple &host) {
978969
// Only Darwin platforms know the concept of an SDK.
979970
auto host_os = host.getOS();
980971
if (host_os != llvm::Triple::OSType::MacOSX)
981-
return {XcodeSDK::Type::unknown, 0, 0};
972+
return XcodeSDK::Type::unknown;
982973

983974
auto is_simulator = [&]() -> bool {
984975
return target.getEnvironment() == llvm::Triple::Simulator ||
@@ -988,31 +979,30 @@ static SDKTypeMinVersion GetSDKType(const llvm::Triple &target,
988979
switch (target.getOS()) {
989980
case llvm::Triple::OSType::MacOSX:
990981
case llvm::Triple::OSType::Darwin:
991-
return {XcodeSDK::Type::MacOSX, 10, 10};
982+
return XcodeSDK::Type::MacOSX;
992983
case llvm::Triple::OSType::IOS:
993984
if (is_simulator())
994-
return {XcodeSDK::Type::iPhoneSimulator, 8, 0};
995-
return {XcodeSDK::Type::iPhoneOS, 8, 0};
985+
return XcodeSDK::Type::iPhoneSimulator;
986+
return XcodeSDK::Type::iPhoneOS;
996987
case llvm::Triple::OSType::TvOS:
997988
if (is_simulator())
998-
return {XcodeSDK::Type::AppleTVSimulator, 9, 0};
999-
return {XcodeSDK::Type::AppleTVOS, 9, 0};
989+
return XcodeSDK::Type::AppleTVSimulator;
990+
return XcodeSDK::Type::AppleTVOS;
1000991
case llvm::Triple::OSType::WatchOS:
1001992
if (is_simulator())
1002-
return {XcodeSDK::Type::WatchSimulator, 2, 0};
1003-
return {XcodeSDK::Type::watchOS, 2, 0};
993+
return XcodeSDK::Type::WatchSimulator;
994+
return XcodeSDK::Type::watchOS;
1004995
default:
1005-
return {XcodeSDK::Type::unknown, 0, 0};
996+
return XcodeSDK::Type::unknown;
1006997
}
1007998
}
1008999

10091000
/// Return the name of the OS-specific subdirectory containing the
10101001
/// Swift stdlib needed for \p target.
10111002
std::string SwiftASTContext::GetSwiftStdlibOSDir(const llvm::Triple &target,
10121003
const llvm::Triple &host) {
1013-
auto sdk = GetSDKType(target, host);
10141004
XcodeSDK::Info sdk_info;
1015-
sdk_info.type = sdk.sdk_type;
1005+
sdk_info.type = GetSDKType(target, host);
10161006
std::string sdk_name = XcodeSDK::GetCanonicalName(sdk_info);
10171007
if (!sdk_name.empty())
10181008
return sdk_name;

0 commit comments

Comments
 (0)