Skip to content

Commit fcec10c

Browse files
Merge pull request #10399 from adrian-prantl/143448485
[lldb] Improve wording of Swift expression parser error messages (NFC)
2 parents 69907bf + 6db68ae commit fcec10c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,14 @@ bool SwiftUserExpression::Parse(DiagnosticManager &diagnostic_manager,
738738
auto ts_or_err = target->GetScratchTypeSystemForLanguage(
739739
lldb::eLanguageTypeSwift, /*create_on_demand=*/true);
740740
if (!ts_or_err)
741-
return error("could not create a Swift scratch context: ",
741+
return error("could not create a Swift scratch typesystem",
742742
llvm::toString(ts_or_err.takeError()).c_str());
743743
m_swift_scratch_ctx =
744744
std::static_pointer_cast<TypeSystemSwiftTypeRefForExpressions>(
745745
*ts_or_err);
746746
if (!m_swift_scratch_ctx)
747-
return error("could not create a Swift scratch context: ", "unknown error");
747+
return error("could not create a Swift scratch typesystem",
748+
"unknown error");
748749
// Notify SwiftASTContext that this is a Playground.
749750
if (m_options.GetPlaygroundTransformEnabled())
750751
m_swift_scratch_ctx->SetCompilerOptions("");
@@ -765,12 +766,13 @@ bool SwiftUserExpression::Parse(DiagnosticManager &diagnostic_manager,
765766
std::static_pointer_cast<SwiftASTContextForExpressions>(swift_ast_ctx);
766767

767768
if (!m_swift_ast_ctx)
768-
return error("could not create a Swift AST context");
769+
return error("could not initialize Swift compiler",
770+
"run 'swift-healthcheck' for more details");
769771

770772
if (m_swift_ast_ctx->HasFatalErrors()) {
771773
m_swift_ast_ctx->PrintDiagnostics(diagnostic_manager);
772-
LLDB_LOG(log, "Swift AST context is in a fatal error state");
773-
return false;
774+
return error("Swift AST context is in a fatal error state",
775+
"run 'swift-healthcheck' for more details");
774776
}
775777

776778
// This may destroy the scratch context.

0 commit comments

Comments
 (0)