Skip to content

Commit 2a63c52

Browse files
committed
Report errors in PerformCompileUnitImports to the user in addition to logging them.
1 parent cddc4e0 commit 2a63c52

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,16 +1409,18 @@ TypeSystemSwiftTypeRefForExpressions::TypeSystemSwiftTypeRefForExpressions(
14091409
}
14101410
}
14111411

1412-
void TypeSystemSwiftTypeRefForExpressions::PerformCompileUnitImports(
1412+
Status TypeSystemSwiftTypeRefForExpressions::PerformCompileUnitImports(
14131413
SymbolContext &sc) {
1414-
Status error;
1414+
Status status;
14151415
lldb::ProcessSP process_sp;
14161416
if (auto target_sp = sc.target_sp)
14171417
process_sp = target_sp->GetProcessSP();
14181418
if (!m_swift_ast_context_initialized)
1419+
// Stash sc, the import will happen lazily when SwiftASTContext is created.
14191420
m_initial_symbol_context = std::make_unique<SymbolContext>(sc);
14201421
else if (auto *swift_ast_ctx = GetSwiftASTContext())
1421-
swift_ast_ctx->PerformCompileUnitImports(sc, process_sp, error);
1422+
swift_ast_ctx->PerformCompileUnitImports(sc, process_sp, status);
1423+
return status;
14221424
}
14231425

14241426
UserExpression *TypeSystemSwiftTypeRefForExpressions::GetUserExpression(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ class TypeSystemSwiftTypeRefForExpressions : public TypeSystemSwiftTypeRef {
481481

482482
/// Forwards to SwiftASTContext.
483483
PersistentExpressionState *GetPersistentExpressionState() override;
484-
void PerformCompileUnitImports(SymbolContext &sc);
484+
Status PerformCompileUnitImports(SymbolContext &sc);
485485

486486
friend class SwiftASTContextForExpressions;
487487
protected:

lldb/source/Target/Target.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,9 @@ llvm::Optional<SwiftScratchContextReader> Target::GetSwiftScratchContext(
27982798
if (frame_sp && frame_sp.get() && swift_scratch_ctx) {
27992799
SymbolContext sc =
28002800
frame_sp->GetSymbolContext(lldb::eSymbolContextEverything);
2801-
swift_scratch_ctx->PerformCompileUnitImports(sc);
2801+
Status status = swift_scratch_ctx->PerformCompileUnitImports(sc);
2802+
if (status.Fail())
2803+
Debugger::ReportError(status.AsCString(), GetDebugger().GetID());
28022804
}
28032805

28042806
if (!swift_scratch_ctx)

0 commit comments

Comments
 (0)