[llvm] r257570 - [llvm-readobj] Remove dead code. Add an assertion instead.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 20:11:37 PST 2016


Author: davide
Date: Tue Jan 12 22:11:36 2016
New Revision: 257570

URL: http://llvm.org/viewvc/llvm-project?rev=257570&view=rev
Log:
[llvm-readobj] Remove dead code. Add an assertion instead.

When we arrive at the end of the function, the validation of
the object has been done already. In theory, so, we should never
arrive here with something broken as the object isn't mutated.
Practice sometimes proves theory to be wrong, so leave an assertion
instead, as suggested by David Blaikie, to catch bugs.

Modified:
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=257570&r1=257569&r2=257570&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Tue Jan 12 22:11:36 2016
@@ -1651,8 +1651,9 @@ void llvm::ParseInputMachO(StringRef Fil
     } else
       errs() << "llvm-objdump: '" << Filename << "': "
              << "Object is not a Mach-O file type.\n";
-  } else
-    report_error(Filename, object_error::invalid_file_type);
+    return;
+  }
+  llvm_unreachable("Input object can't be invalid at this point");
 }
 
 typedef std::pair<uint64_t, const char *> BindInfoEntry;




More information about the llvm-commits mailing list