[PATCH] D102891: [llvm-reduce] Exit when input module is malformed
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 25 10:01:20 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG472c009139ea: [llvm-reduce] Exit when input module is malformed (authored by langston-barrett, committed by aeubanks).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102891/new/
https://reviews.llvm.org/D102891
Files:
llvm/test/tools/llvm-reduce/fail-file-open.test
llvm/tools/llvm-reduce/llvm-reduce.cpp
Index: llvm/tools/llvm-reduce/llvm-reduce.cpp
===================================================================
--- llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -116,6 +116,10 @@
std::unique_ptr<Module> OriginalProgram =
parseInputFile(InputFilename, Context);
+ if (!OriginalProgram) {
+ return 1;
+ }
+
// Initialize test environment
TestRunner Tester(TestFilename, TestArguments);
Tester.setProgram(std::move(OriginalProgram));
Index: llvm/test/tools/llvm-reduce/fail-file-open.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-reduce/fail-file-open.test
@@ -0,0 +1,5 @@
+# RUN: not llvm-reduce --test=echo %s.NotAFileInTestingDir 2>&1 | FileCheck %s
+
+This file will not be read. An invalid file path is fed to llvm-reduce.
+
+# CHECK: llvm-reduce: {{.*}}.NotAFileInTestingDir: error:
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102891.347716.patch
Type: text/x-patch
Size: 948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210525/33ff45db/attachment.bin>
More information about the llvm-commits
mailing list