llvm-reduce: Fix crashing on file opening error for mir path
This commit is contained in:
committed by
Matt Arsenault
parent
7c2db66632
commit
e39e9d339c
@@ -0,0 +1,4 @@
|
||||
# REQUIRES: amdgpu-registered-target
|
||||
# RUN: not llvm-reduce -mtriple=amdgcn-amd-amdhsa --test FileCheck --test-arg %s --test-arg --input-file does-not-exist.mir 2>&1 | FileCheck -check-prefix=ERR %s
|
||||
|
||||
# ERR: {{.*}}llvm-reduce{{.*}}: No such file or directory
|
||||
@@ -300,6 +300,11 @@ parseReducerWorkItem(const char *ToolName, StringRef Filename,
|
||||
|
||||
if (IsMIR) {
|
||||
auto FileOrErr = MemoryBuffer::getFileOrSTDIN(Filename, /*IsText=*/true);
|
||||
if (std::error_code EC = FileOrErr.getError()) {
|
||||
WithColor::error(errs(), ToolName) << EC.message() << '\n';
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<MIRParser> MParser =
|
||||
createMIRParser(std::move(FileOrErr.get()), Ctxt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user