Skip to content

Commit 976be60

Browse files
committed
Don't use report_fatal_error in the LoadBorrowImmutabilityChecker.
That prevents the SILVerifier from printing the context, making it hard to quickly produce test cases from logs. Instead, just return the failure status to the SILVerifier so it can do its diagnostic thing. An assert or llvm_unreachable would also be fine in addition to the normal SILVerifier diagnostics, but I don't think that's needed here.
1 parent 257b7e6 commit 976be60

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/SIL/Verifier/LoadBorrowImmutabilityChecker.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,11 @@ bool GatherWritesVisitor::visitUse(Operand *op, AccessUseType useTy) {
267267
if (!op->get()->getType().isAddress() && !user->mayWriteToMemory()) {
268268
return true;
269269
}
270-
// If we did not recognize the user, just return conservatively that it was
271-
// written to in a way we did not understand.
270+
// If we did not recognize the user, print additional error diagnostics and
271+
// return false to force SIL verification to fail.
272272
llvm::errs() << "Function: " << user->getFunction()->getName() << "\n";
273273
llvm::errs() << "Value: " << op->get();
274274
llvm::errs() << "Unknown instruction: " << *user;
275-
llvm::report_fatal_error("Unexpected instruction using borrowed address?!");
276275
return false;
277276
}
278277

0 commit comments

Comments
 (0)