[llvm-objdump] Use report_fatal_error() if we can't find a target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254654 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Davide Italiano 2015-12-03 22:13:40 +00:00
parent 9f51f8f7e7
commit 0956a120f5

View File

@ -282,10 +282,8 @@ static const Target *getTarget(const ObjectFile *Obj = nullptr) {
std::string Error; std::string Error;
const Target *TheTarget = TargetRegistry::lookupTarget(ArchName, TheTriple, const Target *TheTarget = TargetRegistry::lookupTarget(ArchName, TheTriple,
Error); Error);
if (!TheTarget) { if (!TheTarget)
errs() << ToolName << ": " << Error; report_fatal_error("can't find target: " + Error);
return nullptr;
}
// Update the triple name and return the found target. // Update the triple name and return the found target.
TripleName = TheTriple.getTriple(); TripleName = TheTriple.getTriple();
@ -805,10 +803,6 @@ static bool getHidden(RelocationRef RelRef) {
static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
const Target *TheTarget = getTarget(Obj); const Target *TheTarget = getTarget(Obj);
// getTarget() will have already issued a diagnostic if necessary, so
// just bail here if it failed.
if (!TheTarget)
return;
// Package up features to be passed to target/subtarget // Package up features to be passed to target/subtarget
std::string FeaturesStr; std::string FeaturesStr;