1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

Fix llvm-size to exit with non zero when it can’t open a file.

rdar://26027819

llvm-svn: 268313
This commit is contained in:
Kevin Enderby 2016-05-02 21:41:03 +00:00
parent 14ce118a05
commit 961a187a7a
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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;
}