Skip to content

Commit 4d9bda3

Browse files
committed
Fix a typo that prevents non-host SDKs from being detected.
Unfortunately the test for this requires simulator infrastructure support that has not yet landed. <rdar://problem/58477904>
1 parent 9292433 commit 4d9bda3

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

lldb/source/Symbol/SwiftASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2487,7 +2487,7 @@ void SwiftASTContext::InitializeSearchPathOptions(
24872487
XcodeSDK::Info info;
24882488
info.type = XcodeSDK::GetSDKTypeForTriple(triple);
24892489
XcodeSDK sdk(info);
2490-
StringRef sdk_path = HostInfo::GetXcodeSDKPath(sdk);
2490+
sdk_path = HostInfo::GetXcodeSDKPath(sdk);
24912491
}
24922492
if (sdk_path.empty()) {
24932493
// This fallback is questionable. Perhaps it should be removed.

lldb/test/API/lang/swift/xcode_sdk/TestSwiftXcodeSDK.py

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ class TestSwiftXcodeSDK(lldbtest.TestBase):
1111
mydir = lldbtest.TestBase.compute_mydir(__file__)
1212
NO_DEBUG_INFO_TESTCASE = True
1313

14+
def check_log(self, log, expected_path):
15+
logfile = open(log, "r")
16+
in_expr_log = 0
17+
found = 0
18+
for line in logfile:
19+
if line.startswith(" SwiftASTContextForExpressions::LogConfiguration"):
20+
in_expr_log += 1
21+
if in_expr_log and "SDK path" in line and expected_path in line:
22+
found += 1
23+
self.assertEqual(in_expr_log, 1)
24+
self.assertEqual(found, 1)
25+
1426
@swiftTest
1527
@skipUnlessDarwin
1628
@skipIfDarwinEmbedded
@@ -23,16 +35,26 @@ def test_decode(self):
2335
lldbutil.run_to_name_breakpoint(self, 'main')
2436

2537
self.expect("p 1")
26-
logfile = open(log, "r")
27-
in_expr_log = 0
28-
found = 0
29-
for line in logfile:
30-
if line.startswith(" SwiftASTContextForExpressions::LogConfiguration"):
31-
in_expr_log += 1
32-
if in_expr_log and "SDK path" in line and ".sdk" in line:
33-
found += 1
34-
self.assertEqual(in_expr_log, 1)
35-
self.assertEqual(found, 1)
38+
self.check_log(log, ".sdk")
39+
40+
@swiftTest
41+
@skipUnlessDarwin
42+
@skipIfDarwinEmbedded
43+
@apple_simulator_test('iphone')
44+
# FIXME: This test depends on https://reviews.llvm.org/D81980.
45+
@expectedFailureAll(bugnumber="rdar://problem/64461839")
46+
def test_decode_sim(self):
47+
"""Test that we can detect an Xcode SDK that is different from the host SDK
48+
from the DW_AT_LLVM_sdk attribute."""
49+
arch = self.getArchitecture()
50+
self.build(dictionary={'TRIPLE': arch+'-apple-ios-simulator', 'ARCH': arch})
51+
log = self.getBuildArtifact("types.log")
52+
self.expect("log enable lldb types -f " + log)
53+
54+
lldbutil.run_to_name_breakpoint(self, 'main')
55+
56+
self.expect("p 1")
57+
self.check_log(log, "iPhoneSimulator")
3658

3759
@swiftTest
3860
@skipUnlessDarwin
@@ -52,13 +74,4 @@ def test_override(self):
5274
lldbutil.run_to_name_breakpoint(self, 'main')
5375

5476
self.expect("p 1")
55-
logfile = open(log, "r")
56-
in_expr_log = 0
57-
found = 0
58-
for line in logfile:
59-
if line.startswith(" SwiftASTContextForExpressions::LogConfiguration"):
60-
in_expr_log += 1
61-
if in_expr_log and "SDK path" in line and ios_sdk in line:
62-
found += 1
63-
self.assertEqual(in_expr_log, 1)
64-
self.assertEqual(found, 1)
77+
self.check_log(log, ios_sdk)

0 commit comments

Comments
 (0)