[llvm-objdump] Call exit(1) on error, i.e. fail early.
authorDavide Italiano <davide@freebsd.org>
Wed, 5 Aug 2015 07:18:31 +0000 (07:18 +0000)
committerDavide Italiano <davide@freebsd.org>
Wed, 5 Aug 2015 07:18:31 +0000 (07:18 +0000)
commit281c1b093e6caa9151b47b326808f8c2b73afe84
treede81e78cbd6ba0fcad17aae742b217faaddfc943
parentbf1c3155a497b9324172c248cef7d16cab4401a2
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244019 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-objdump/COFFDump.cpp
tools/llvm-objdump/MachODump.cpp
tools/llvm-objdump/llvm-objdump.cpp
tools/llvm-objdump/llvm-objdump.h