Skip to content

Commit c668d58

Browse files
committed
Surface LLVM verification errors.
1 parent 98c0f3f commit c668d58

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2029,12 +2029,21 @@ SwiftExpressionParser::Parse(DiagnosticManager &diagnostic_manager,
20292029
std::lock_guard<std::recursive_mutex> global_context_locker(
20302030
IRExecutionUnit::GetLLVMGlobalContextMutex());
20312031

2032-
LLVMVerifyModule((LLVMOpaqueModule *)m_module.get(), LLVMReturnStatusAction,
2033-
nullptr);
2032+
bool has_errors = LLVMVerifyModule((LLVMOpaqueModule *)m_module.get(),
2033+
LLVMReturnStatusAction, nullptr);
2034+
if (has_errors) {
2035+
diagnostic_manager.PutString(eDiagnosticSeverityRemark,
2036+
"LLVM verification error");
2037+
return ParseResult::unrecoverable_error;
2038+
}
20342039
}
20352040

2036-
if (expr_diagnostics->HasErrors())
2041+
if (expr_diagnostics->HasErrors()) {
2042+
diagnostic_manager.PutString(eDiagnosticSeverityRemark,
2043+
"post-IRGen error");
2044+
DiagnoseSwiftASTContextError();
20372045
return ParseResult::unrecoverable_error;
2046+
}
20382047

20392048
// The Parse succeeded! Now put this module into the context's list
20402049
// of loaded modules, and copy the Decls that were globalized as

0 commit comments

Comments
 (0)