Skip to content

Commit 4fb8a20

Browse files
committed
[sil-opt] Hard exit(-1) instead of finishDiagProcessing when failing to setup a compiler invocation.
Running finishDiagProcessing and potentially silently exiting when -verify is set is the correct behavior for failures later in sil-opt when running Sema or when running SIL passes. This is incorrect behavior when just setting up the compiler instance since in such a case, we want to hard exit -1 since this means that a test has not properly setup the compiler instance itself. It is better to hard fail and have the test maintainer just update its command line arguments as appropriate.
1 parent ce68d74 commit 4fb8a20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/DriverTool/sil_opt_main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,11 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
864864
std::string InstanceSetupError;
865865
if (CI.setup(Invocation, InstanceSetupError)) {
866866
llvm::errs() << InstanceSetupError << '\n';
867-
return finishDiagProcessing(1);
867+
// Rather than finish Diag processing, exit -1 here to show we failed to
868+
// setup here. The reason we do this is if the setup fails, we want to fail
869+
// hard. We shouldn't be testing that we setup correctly with
870+
// -verify/etc. We should be testing that later.
871+
exit(-1);
868872
}
869873

870874
CI.performSema();

0 commit comments

Comments
 (0)