Skip to content

Commit 438d89c

Browse files
authored
Merge pull request #1625 from nkcsgexi/65570721-swift-master
SwiftASTContext: allow deserializing @_implementationOnly dependencies to avoid crashing
2 parents 03a20a7 + 818ebca commit 438d89c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,10 @@ SwiftASTContext::SwiftASTContext(std::string description, llvm::Triple triple,
930930
ir_gen_opts.OutputKind = swift::IRGenOutputKind::Module;
931931
ir_gen_opts.UseJIT = true;
932932
ir_gen_opts.DWARFVersion = swift::DWARFVersion;
933+
// Allow deserializing @_implementationOnly dependencies
934+
// to avoid crashing due to module recovery issues.
935+
swift::LangOptions &lang_opts = m_compiler_invocation_ap->getLangOptions();
936+
lang_opts.AllowDeserializingImplementationOnly = true;
933937
}
934938

935939
SwiftASTContext::~SwiftASTContext() {

lldb/test/API/lang/swift/implementation_only_imports/library_indirect/TestLibraryIndirect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def cleanup():
7575
"\n value = (first = 2, second = 3)\n }\n other = 10\n}",
7676
"(Int) simple = 1"])
7777
self.expect("e container", substrs=["(SomeLibrary.ContainsTwoInts)", "other = 10"])
78-
self.expect("e container.wrapped", substrs=["(SomeLibrary.BoxedTwoInts)", "0x", "{}"])
79-
self.expect("e container.wrapped.value", error=True, substrs=["value of type 'BoxedTwoInts' has no member 'value'"])
78+
self.expect("e container.wrapped", substrs=["(SomeLibrary.BoxedTwoInts)", "0x", "value = (first = 2, second = 3)"])
79+
self.expect("e container.wrapped.value", substrs=["(SomeLibraryCore.TwoInts)", "(first = 2, second = 3)"])
8080

8181
@swiftTest
8282
def test_implementation_only_import_library_no_library_module(self):

lldb/test/API/lang/swift/implementation_only_imports/library_resilient/TestLibraryResilient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def cleanup():
6060
"(SomeLibrary.ContainsTwoInts) container = {\n wrapped = (first = 2, second = 3)\n other = 10\n}",
6161
"(Int) simple = 1"])
6262
self.expect("e container", substrs=["(SomeLibrary.ContainsTwoInts)", "other = 10"])
63-
self.expect("e container.wrapped", error=True, substrs=["value of type 'ContainsTwoInts' has no member 'wrapped'"])
63+
self.expect("e container.wrapped", substrs=["(SomeLibraryCore.TwoInts)", "(first = 2, second = 3)"])
6464

6565
@swiftTest
6666
@expectedFailureOS(no_match(["macosx"])) # Requires Remote Mirrors support

lldb/test/API/lang/swift/variables/objc_optionals/TestSwiftObjCOptionals.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ class TestSwiftObjCOptionalType(TestBase):
2424

2525
mydir = TestBase.compute_mydir(__file__)
2626

27-
@expectedFailureAll(bugnumber="rdar://60396797",
28-
setting=('symbols.use-swift-clangimporter', 'false'))
2927
@swiftTest
3028
@skipUnlessDarwin
3129
def test_swift_objc_optional_type(self):

0 commit comments

Comments
 (0)