summaryrefslogtreecommitdiff
path: root/tools/llvm-size/llvm-size.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-size/llvm-size.cpp')
-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;
}