Skip to content

Commit 3b94837

Browse files
committed
[lldb] Correct BridgeOS spelling and ignore case when parsing the SDK
Ignore case when parsing the Xcode SDK. The BridgeOS SDK is capitalized, but previously failed to parse because we were looking for bridgeOS. This PR updates the enum value and the canonical spelling, and also relaxes the parsing to be case insensitive. rdar://162641896
1 parent 3b46556 commit 3b94837

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

lldb/include/lldb/Utility/XcodeSDK.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class XcodeSDK {
3838
watchOS,
3939
XRSimulator,
4040
XROS,
41-
bridgeOS,
41+
BridgeOS,
4242
Linux,
4343
unknown = -1
4444
};

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
11501150
case XcodeSDK::Type::XRSimulator:
11511151
case XcodeSDK::Type::XROS:
11521152
// FIXME: Pass the right argument once it exists.
1153-
case XcodeSDK::Type::bridgeOS:
1153+
case XcodeSDK::Type::BridgeOS:
11541154
case XcodeSDK::Type::Linux:
11551155
case XcodeSDK::Type::unknown:
11561156
if (Log *log = GetLog(LLDBLog::Host)) {

lldb/source/Utility/XcodeSDK.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ static llvm::StringRef GetName(XcodeSDK::Type type) {
3838
return "XRSimulator";
3939
case XcodeSDK::XROS:
4040
return "XROS";
41-
case XcodeSDK::bridgeOS:
42-
return "bridgeOS";
41+
case XcodeSDK::BridgeOS:
42+
return "BridgeOS";
4343
case XcodeSDK::Linux:
4444
return "Linux";
4545
case XcodeSDK::unknown:
@@ -65,27 +65,27 @@ bool XcodeSDK::operator==(const XcodeSDK &other) const {
6565
}
6666

6767
static XcodeSDK::Type ParseSDKName(llvm::StringRef &name) {
68-
if (name.consume_front("MacOSX"))
68+
if (name.consume_front_insensitive("MacOSX"))
6969
return XcodeSDK::MacOSX;
70-
if (name.consume_front("iPhoneSimulator"))
70+
if (name.consume_front_insensitive("iPhoneSimulator"))
7171
return XcodeSDK::iPhoneSimulator;
72-
if (name.consume_front("iPhoneOS"))
72+
if (name.consume_front_insensitive("iPhoneOS"))
7373
return XcodeSDK::iPhoneOS;
74-
if (name.consume_front("AppleTVSimulator"))
74+
if (name.consume_front_insensitive("AppleTVSimulator"))
7575
return XcodeSDK::AppleTVSimulator;
76-
if (name.consume_front("AppleTVOS"))
76+
if (name.consume_front_insensitive("AppleTVOS"))
7777
return XcodeSDK::AppleTVOS;
78-
if (name.consume_front("WatchSimulator"))
78+
if (name.consume_front_insensitive("WatchSimulator"))
7979
return XcodeSDK::WatchSimulator;
80-
if (name.consume_front("WatchOS"))
80+
if (name.consume_front_insensitive("WatchOS"))
8181
return XcodeSDK::watchOS;
82-
if (name.consume_front("XRSimulator"))
82+
if (name.consume_front_insensitive("XRSimulator"))
8383
return XcodeSDK::XRSimulator;
84-
if (name.consume_front("XROS"))
84+
if (name.consume_front_insensitive("XROS"))
8585
return XcodeSDK::XROS;
86-
if (name.consume_front("bridgeOS"))
87-
return XcodeSDK::bridgeOS;
88-
if (name.consume_front("Linux"))
86+
if (name.consume_front_insensitive("BridgeOS"))
87+
return XcodeSDK::BridgeOS;
88+
if (name.consume_front_insensitive("Linux"))
8989
return XcodeSDK::Linux;
9090
static_assert(XcodeSDK::Linux == XcodeSDK::numSDKTypes - 1,
9191
"New SDK type was added, update this list!");
@@ -110,7 +110,8 @@ static llvm::VersionTuple ParseSDKVersion(llvm::StringRef &name) {
110110
}
111111

112112
static bool ParseAppleInternalSDK(llvm::StringRef &name) {
113-
return name.consume_front("Internal.") || name.consume_front(".Internal.");
113+
return name.consume_front_insensitive("Internal.") ||
114+
name.consume_front_insensitive(".Internal.");
114115
}
115116

116117
XcodeSDK::Info XcodeSDK::Parse() const {
@@ -204,7 +205,7 @@ std::string XcodeSDK::GetCanonicalName(XcodeSDK::Info info) {
204205
case XROS:
205206
name = "xros";
206207
break;
207-
case bridgeOS:
208+
case BridgeOS:
208209
name = "bridgeos";
209210
break;
210211
case Linux:

lldb/unittests/Utility/XcodeSDKTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ TEST(XcodeSDKTest, ParseTest) {
2727
EXPECT_EQ(XcodeSDK("AppleTVOS.sdk").GetType(), XcodeSDK::AppleTVOS);
2828
EXPECT_EQ(XcodeSDK("WatchSimulator.sdk").GetType(), XcodeSDK::WatchSimulator);
2929
EXPECT_EQ(XcodeSDK("WatchOS.sdk").GetType(), XcodeSDK::watchOS);
30+
EXPECT_EQ(XcodeSDK("BridgeOS.sdk").GetType(), XcodeSDK::BridgeOS);
31+
EXPECT_EQ(XcodeSDK("bridgeOS.sdk").GetType(), XcodeSDK::BridgeOS);
3032
EXPECT_EQ(XcodeSDK("XRSimulator.sdk").GetType(), XcodeSDK::XRSimulator);
3133
EXPECT_EQ(XcodeSDK("XROS.sdk").GetType(), XcodeSDK::XROS);
3234
EXPECT_EQ(XcodeSDK("Linux.sdk").GetType(), XcodeSDK::Linux);

0 commit comments

Comments
 (0)