[llvm] r176963 - No functionality change. Use unreachable in getCUOffset.

Manman Ren mren at apple.com
Wed Mar 13 11:41:28 PDT 2013


Author: mren
Date: Wed Mar 13 13:41:27 2013
New Revision: 176963

URL: http://llvm.org/viewvc/llvm-project?rev=176963&view=rev
Log:
No functionality change. Use unreachable in getCUOffset.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=176963&r1=176962&r2=176963&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Mar 13 13:41:27 2013
@@ -1889,13 +1889,15 @@ void DwarfUnits::emitUnits(DwarfDebug *D
 
 /// For a given compile unit DIE, returns offset from beginning of debug info.
 unsigned DwarfUnits::getCUOffset(DIE *Die) {
+  assert(Die->getTag() == dwarf::DW_TAG_compile_unit  &&
+         "Input DIE should be compile unit in getCUOffset.");
   for (SmallVector<CompileUnit *, 1>::iterator I = CUs.begin(),
        E = CUs.end(); I != E; ++I) {
     CompileUnit *TheCU = *I;
     if (TheCU->getCUDie() == Die)
       return TheCU->getDebugInfoOffset();
   }
-  return 0;
+  llvm_unreachable("The compile unit DIE should belong to CUs in DwarfUnits.");
 }
 
 // Emit the debug info section.





More information about the llvm-commits mailing list