Skip to content

Commit 48d4997

Browse files
committed
[CSStep] Don't abort upon discovering constraint system in an invalid state
Setting `InvalidState` already makes sure that there is no possibility of miscompile.
1 parent d8cdbcd commit 48d4997

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

lib/Sema/CSStep.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -362,22 +362,16 @@ StepResult ComponentStep::take(bool prevFailed) {
362362
return finalize(/*isSuccess=*/false);
363363
}
364364

365-
#ifdef NDEBUG
366365
auto printConstraints = [&](const ConstraintList &constraints) {
367366
for (auto &constraint : constraints)
368367
constraint.print(getDebugLogger(), &CS.getASTContext().SourceMgr);
369368
};
370-
#endif
371369

372370
// If we don't have any disjunction or type variable choices left, we're done
373371
// solving. Make sure we don't have any unsolved constraints left over, using
374372
// report_fatal_error to make sure we trap in debug builds and fail the step
375373
// in release builds.
376374
if (!CS.ActiveConstraints.empty()) {
377-
#ifndef NDEBUG
378-
CS.print(llvm::errs());
379-
llvm::report_fatal_error("Active constraints left over?");
380-
#else
381375
if (CS.isDebugMode()) {
382376
getDebugLogger() << "(failed due to remaining active constraints:\n";
383377
printConstraints(CS.ActiveConstraints);
@@ -386,15 +380,10 @@ StepResult ComponentStep::take(bool prevFailed) {
386380

387381
CS.InvalidState = true;
388382
return finalize(/*isSuccess=*/false);
389-
#endif
390383
}
391384

392385
if (!CS.solverState->allowsFreeTypeVariables()) {
393386
if (!CS.InactiveConstraints.empty()) {
394-
#ifndef NDEBUG
395-
CS.print(llvm::errs());
396-
llvm::report_fatal_error("Inactive constraints left over?");
397-
#else
398387
if (CS.isDebugMode()) {
399388
getDebugLogger() << "(failed due to remaining inactive constraints:\n";
400389
printConstraints(CS.InactiveConstraints);
@@ -403,7 +392,6 @@ StepResult ComponentStep::take(bool prevFailed) {
403392

404393
CS.InvalidState = true;
405394
return finalize(/*isSuccess=*/false);
406-
#endif
407395
}
408396
}
409397

0 commit comments

Comments
 (0)