[llvm-objdump] Use report_fatal_error() if we can't find a target.
authorDavide Italiano <davide@freebsd.org>
Thu, 3 Dec 2015 22:13:40 +0000 (22:13 +0000)
committerDavide Italiano <davide@freebsd.org>
Thu, 3 Dec 2015 22:13:40 +0000 (22:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254654 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/llvm-objdump.cpp

index 54f24d7a00ff2791c6f05395c5b81d3767bb452a..069425429d16d9251d8d4360c383cabae958892f 100644 (file)
@@ -282,10 +282,8 @@ static const Target *getTarget(const ObjectFile *Obj = nullptr) {
   std::string Error;
   const Target *TheTarget = TargetRegistry::lookupTarget(ArchName, TheTriple,
                                                          Error);
-  if (!TheTarget) {
-    errs() << ToolName << ": " << Error;
-    return nullptr;
-  }
+  if (!TheTarget)
+    report_fatal_error("can't find target: " + Error);
 
   // Update the triple name and return the found target.
   TripleName = TheTriple.getTriple();
@@ -805,10 +803,6 @@ static bool getHidden(RelocationRef RelRef) {
 
 static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
   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
   std::string FeaturesStr;