summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-size/llvm-size.cpp
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
commit64f7a995b0f3b213e353486c5b6c6132f9bb124d (patch)
tree6d641e95e4c2fc1e7aee95366641b8c00d0c9ac9 /llvm/tools/llvm-size/llvm-size.cpp
parent3c3d52cb76dcd43f1f217dc31c0590f948be4398 (diff)
downloadbcm5719-llvm-64f7a995b0f3b213e353486c5b6c6132f9bb124d.tar.gz
bcm5719-llvm-64f7a995b0f3b213e353486c5b6c6132f9bb124d.zip
Fix llvm-size to exit with non zero when it can’t open a file.
rdar://26027819 llvm-svn: 268313
Diffstat (limited to 'llvm/tools/llvm-size/llvm-size.cpp')
-rw-r--r--llvm/tools/llvm-size/llvm-size.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp
index 1be173bdf54..e3b487c388f 100644
--- a/llvm/tools/llvm-size/llvm-size.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud