mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-19 00:14:20 +00:00
Fix llvm-size to exit with non zero when it can’t open a file.
rdar://26027819 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268313 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0cd16495ba
commit
b6d0e4bd4c
@ -1,2 +1,2 @@
|
||||
RUN: llvm-size %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
|
||||
RUN: not llvm-size %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
|
||||
ENOENT: {{.*}}llvm-size{{(\.EXE|\.exe)?}}: error reading file: {{[Nn]}}o such file or directory
|
||||
|
@ -84,6 +84,8 @@ RadixShort(cl::desc("Print size in radix:"),
|
||||
static cl::list<std::string>
|
||||
InputFilenames(cl::Positional, cl::desc("<input files>"), cl::ZeroOrMore);
|
||||
|
||||
bool HadError = false;
|
||||
|
||||
static std::string ToolName;
|
||||
|
||||
/// If ec is not success, print the error and return true.
|
||||
@ -91,6 +93,7 @@ static bool error(std::error_code ec) {
|
||||
if (!ec)
|
||||
return false;
|
||||
|
||||
HadError = true;
|
||||
errs() << ToolName << ": error reading file: " << ec.message() << ".\n";
|
||||
errs().flush();
|
||||
return true;
|
||||
@ -757,5 +760,6 @@ int main(int argc, char **argv) {
|
||||
std::for_each(InputFilenames.begin(), InputFilenames.end(),
|
||||
printFileSectionSizes);
|
||||
|
||||
return 0;
|
||||
if (HadError)
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user