No functionality change. Use unreachable in getCUOffset.
authorManman Ren <mren@apple.com>
Wed, 13 Mar 2013 18:41:27 +0000 (18:41 +0000)
committerManman Ren <mren@apple.com>
Wed, 13 Mar 2013 18:41:27 +0000 (18:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176963 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 2da0bb336431258222470fa48fac8a2e78c29a57..b169602b0ecb8f5ac8d4f368e4c16a2ba287c0cd 100644 (file)
@@ -1889,13 +1889,15 @@ void DwarfUnits::emitUnits(DwarfDebug *DD,
 
 /// 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.