[llvm-objdump] Call exit(1) on error, i.e. fail early.

Previously we kept going on partly corrupted input, which might result
in garbage being printed, or even worse, random crashes.
Rafael mentioned that this is the GNU behavior as well, but after some
discussion we both agreed it's probably better to emit a reasonable
error message and exit. As a side-effect of this commit, now we don't
rely on global state for error codes anymore. objdump was the last tool
in the toolchain which needed to be converted. Hopefully the old behavior
won't sneak into the tree again.

llvm-svn: 244019
This commit is contained in:
Davide Italiano
2015-08-05 07:18:31 +00:00
parent 650d7f7dd5
commit ccd53feee2
4 changed files with 42 additions and 89 deletions

View File

@@ -55,7 +55,7 @@ extern cl::opt<bool> UnwindInfo;
extern cl::opt<bool> PrintImmHex;
// Various helper functions.
bool error(std::error_code ec);
void error(std::error_code ec);
bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b);
void ParseInputMachO(StringRef Filename);
void printCOFFUnwindInfo(const object::COFFObjectFile* o);