Skip to content

Commit a2052d2

Browse files
committed
Convert GetAllErrors() to return an llvm::Error (NFC)
1 parent c668d58 commit a2052d2

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,8 +1381,7 @@ static llvm::Expected<ParsedExpression> ParseAndImport(
13811381

13821382
if (expr_diagnostics.HasErrors())
13831383
return make_error<ModuleImportError>(
1384-
expr_diagnostics.GetAllErrors().AsCString(
1385-
"Explicit module import error"));
1384+
llvm::toString(expr_diagnostics.GetAllErrors()));
13861385

13871386
std::unique_ptr<SwiftASTManipulator> code_manipulator;
13881387
if (repl || !playground) {

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -937,14 +937,12 @@ bool SwiftASTContext::ScopedDiagnostics::HasErrors() const {
937937
return false;
938938
}
939939

940-
Status SwiftASTContext::ScopedDiagnostics::GetAllErrors() const {
940+
llvm::Error SwiftASTContext::ScopedDiagnostics::GetAllErrors() const {
941941
// Retrieve the error message from the DiagnosticConsumer.
942942
DiagnosticManager diagnostic_manager;
943943
PrintDiagnostics(diagnostic_manager);
944-
945-
Status error;
946-
error.SetErrorString(diagnostic_manager.GetString());
947-
return error;
944+
return llvm::make_error<llvm::StringError>(diagnostic_manager.GetString(),
945+
llvm::inconvertibleErrorCode());
948946
}
949947

950948
SwiftASTContext::ScopedDiagnostics::~ScopedDiagnostics() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ class SwiftASTContext : public TypeSystemSwift {
484484
bool HasErrors() const;
485485
/// Return all errors and warnings that happened during the lifetime of this
486486
/// object.
487-
Status GetAllErrors() const;
487+
llvm::Error GetAllErrors() const;
488488
};
489489
std::unique_ptr<ScopedDiagnostics> getScopedDiagnosticConsumer();
490490
/// \}

0 commit comments

Comments
 (0)