mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-16 18:30:52 +00: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:
parent
14ce118a05
commit
961a187a7a
@ -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