summaryrefslogtreecommitdiff
path: root/tools/llvm-size
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-05-02 21:41:03 +0000
committerKevin Enderby <enderby@apple.com>2016-05-02 21:41:03 +0000
commitb6d0e4bd4c3da927215e934e32c8001485ddcc6f (patch)
tree0ae493a91df56cce102ffa7f68366820858532e9 /tools/llvm-size
parent0cd16495bafecfe6918b460ef5c6bb196b162e66 (diff)
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
Diffstat (limited to 'tools/llvm-size')
-rw-r--r--tools/llvm-size/llvm-size.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/llvm-size/llvm-size.cpp b/tools/llvm-size/llvm-size.cpp
index 1be173bdf54..e3b487c388f 100644
--- a/tools/llvm-size/llvm-size.cpp
+++ b/tools/llvm-size/llvm-size.cpp
@@ -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;
}