Skip to content

Commit aa88808

Browse files
committed
Add missing validity-check for SwiftASTContextReader
This is a narrower version of #1440 spun off for 5.3. I've kept 'scratch_ctx' wrapped in an Optional to minimize the necessary source changes. Simply removing the Optional triggers a subsequent assert because the context lock is not taken (even though the context reader is invalid). rdar://65276251
1 parent ed17568 commit aa88808

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lldb/source/Target/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,9 @@ llvm::Optional<uint64_t> SwiftLanguageRuntimeImpl::GetMemberVariableOffset(
634634

635635
llvm::Optional<SwiftASTContextReader> scratch_ctx;
636636
if (instance) {
637-
scratch_ctx = instance->GetScratchSwiftASTContext();
638-
if (!scratch_ctx)
637+
if (SwiftASTContextReader reader = instance->GetScratchSwiftASTContext())
638+
scratch_ctx = reader;
639+
else
639640
return llvm::None;
640641
}
641642

0 commit comments

Comments
 (0)