aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-nm
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-03 15:46:03 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-03 15:46:03 +0000
commit40d40dd44edbac3c20a4f3305f208ab48c2c219a (patch)
treef5782d0be8e4d05ddb0bbe26f994ef44c5141539 /tools/llvm-nm
parentf6b67dc7f8ed87443dc03856e789f42ba72ecaa8 (diff)
downloadexternal_llvm-40d40dd44edbac3c20a4f3305f208ab48c2c219a.zip
external_llvm-40d40dd44edbac3c20a4f3305f208ab48c2c219a.tar.gz
external_llvm-40d40dd44edbac3c20a4f3305f208ab48c2c219a.tar.bz2
Make llvm-nm return 1 on error.
This is a small compatibility improvement with gnu nm and makes llvm-nm more useful as a testing tool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-nm')
-rw-r--r--tools/llvm-nm/llvm-nm.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index cb46520..c33289b 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -121,6 +121,8 @@ namespace {
bool MultipleFiles = false;
+ bool HadError = false;
+
std::string ToolName;
}
@@ -132,6 +134,7 @@ static void error(Twine message, Twine path = Twine()) {
static bool error(error_code ec, Twine path = Twine()) {
if (ec) {
error(ec.message(), path);
+ HadError = true;
return true;
}
return false;
@@ -429,6 +432,7 @@ static void DumpSymbolNamesFromFile(std::string &Filename) {
} else {
errs() << ToolName << ": " << Filename << ": "
<< "unrecognizable file type\n";
+ HadError = true;
return;
}
}
@@ -463,5 +467,9 @@ int main(int argc, char **argv) {
std::for_each(InputFilenames.begin(), InputFilenames.end(),
DumpSymbolNamesFromFile);
+
+ if (HadError)
+ return 1;
+
return 0;
}