Skip to content

Commit 1ebaee1

Browse files
authored
Merge pull request #12519 from dcci/noabort
[SILVerifier] Add a flag to not abort upon verification failure.
2 parents 828cb50 + 98992df commit 1ebaee1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/SIL/SILVerifier.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ static llvm::cl::opt<bool> SkipUnreachableMustBeLastErrors(
5050
"verify-skip-unreachable-must-be-last",
5151
llvm::cl::init(false));
5252

53+
// This flag controls the default behaviour when hitting a verification
54+
// failure (abort/exit).
55+
static llvm::cl::opt<bool> AbortOnFailure(
56+
"verify-abort-on-failure",
57+
llvm::cl::init(true));
58+
5359
// The verifier is basically all assertions, so don't compile it with NDEBUG to
5460
// prevent release builds from triggering spurious unused variable warnings.
5561

@@ -139,7 +145,12 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
139145
F.print(llvm::dbgs());
140146
}
141147

142-
abort();
148+
// We abort by default because we want to always crash in
149+
// the debugger.
150+
if (AbortOnFailure)
151+
abort();
152+
else
153+
exit(1);
143154
}
144155
#define require(condition, complaint) \
145156
_require(bool(condition), complaint ": " #condition)

0 commit comments

Comments
 (0)