Skip to content

[swift/master-rebranch] SwiftASTContext: allow deserializing @_implementationOnly dependencies to avoid crashing #1626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,10 @@ SwiftASTContext::SwiftASTContext(std::string description, llvm::Triple triple,
ir_gen_opts.OutputKind = swift::IRGenOutputKind::Module;
ir_gen_opts.UseJIT = true;
ir_gen_opts.DWARFVersion = swift::DWARFVersion;
// Allow deserializing @_implementationOnly dependencies
// to avoid crashing due to module recovery issues.
swift::LangOptions &lang_opts = m_compiler_invocation_ap->getLangOptions();
lang_opts.AllowDeserializingImplementationOnly = true;
}

SwiftASTContext::~SwiftASTContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def cleanup():
"\n value = (first = 2, second = 3)\n }\n other = 10\n}",
"(Int) simple = 1"])
self.expect("e container", substrs=["(SomeLibrary.ContainsTwoInts)", "other = 10"])
self.expect("e container.wrapped", substrs=["(SomeLibrary.BoxedTwoInts)", "0x", "{}"])
self.expect("e container.wrapped.value", error=True, substrs=["value of type 'BoxedTwoInts' has no member 'value'"])
self.expect("e container.wrapped", substrs=["(SomeLibrary.BoxedTwoInts)", "0x", "value = (first = 2, second = 3)"])
self.expect("e container.wrapped.value", substrs=["(SomeLibraryCore.TwoInts)", "(first = 2, second = 3)"])

@swiftTest
def test_implementation_only_import_library_no_library_module(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def cleanup():
"(SomeLibrary.ContainsTwoInts) container = {\n wrapped = (first = 2, second = 3)\n other = 10\n}",
"(Int) simple = 1"])
self.expect("e container", substrs=["(SomeLibrary.ContainsTwoInts)", "other = 10"])
self.expect("e container.wrapped", error=True, substrs=["value of type 'ContainsTwoInts' has no member 'wrapped'"])
self.expect("e container.wrapped", substrs=["(SomeLibraryCore.TwoInts)", "(first = 2, second = 3)"])

@swiftTest
@expectedFailureOS(no_match(["macosx"])) # Requires Remote Mirrors support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class TestSwiftObjCOptionalType(TestBase):

mydir = TestBase.compute_mydir(__file__)

@expectedFailureAll(bugnumber="rdar://60396797",
setting=('symbols.use-swift-clangimporter', 'false'))
@swiftTest
@skipUnlessDarwin
def test_swift_objc_optional_type(self):
Expand Down