Skip to content

Commit 63d5131

Browse files
Merge pull request #3971 from adrian-prantl/lazy-swiftastcontext
Make the initialization of SwiftASTContextForExpressions lazy (NFC)
2 parents bcc9201 + ff55d81 commit 63d5131

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,6 @@ TypeSystemSwiftTypeRefForExpressions::TypeSystemSwiftTypeRefForExpressions(
12681268
m_swift_ast_context =
12691269
llvm::dyn_cast_or_null<SwiftASTContext>(m_swift_ast_context_sp.get());
12701270
}
1271-
// FIXME: Remove this line to make initialization lazy.
1272-
GetSwiftASTContext();
12731271
}
12741272

12751273
void TypeSystemSwiftTypeRefForExpressions::PerformCompileUnitImports(

lldb/source/Target/Target.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,14 +2588,9 @@ llvm::Optional<SwiftScratchContextReader> Target::GetSwiftScratchContext(
25882588

25892589
StackFrameSP frame_sp = exe_scope.CalculateStackFrame();
25902590
if (frame_sp && frame_sp.get() && swift_scratch_ctx) {
2591-
auto *swift_ast_ctx = llvm::dyn_cast_or_null<SwiftASTContextForExpressions>(
2592-
swift_scratch_ctx->GetSwiftASTContextOrNull());
2593-
if (swift_ast_ctx && !swift_ast_ctx->HasFatalErrors()) {
2594-
StackFrameWP frame_wp(frame_sp);
2595-
SymbolContext sc =
2596-
frame_sp->GetSymbolContext(lldb::eSymbolContextEverything);
2597-
swift_scratch_ctx->PerformCompileUnitImports(sc);
2598-
}
2591+
SymbolContext sc =
2592+
frame_sp->GetSymbolContext(lldb::eSymbolContextEverything);
2593+
swift_scratch_ctx->PerformCompileUnitImports(sc);
25992594
}
26002595

26012596
if (!swift_scratch_ctx)

0 commit comments

Comments
 (0)