[llvm] r226588 - Add an assertion and prefer a crash over an infinite loop.

Adrian Prantl aprantl at apple.com
Tue Jan 20 10:03:37 PST 2015


Author: adrian
Date: Tue Jan 20 12:03:37 2015
New Revision: 226588

URL: http://llvm.org/viewvc/llvm-project?rev=226588&view=rev
Log:
Add an assertion and prefer a crash over an infinite loop.

Modified:
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=226588&r1=226587&r2=226588&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Tue Jan 20 12:03:37 2015
@@ -527,12 +527,15 @@ bool DISubprogram::Verify() const {
         while ((IA = DL.getInlinedAt()))
           DL = DebugLoc::getFromDILocation(IA);
         DL.getScopeAndInlinedAt(Scope, IA);
+        assert(Scope && "debug location has no scope");
         assert(!IA);
         while (!DIDescriptor(Scope).isSubprogram()) {
           DILexicalBlockFile D(Scope);
           Scope = D.isLexicalBlockFile()
                       ? D.getScope()
                       : DebugLoc::getFromDILexicalBlock(Scope).getScope();
+          if (!Scope)
+            llvm_unreachable("lexical block file has no scope");
         }
         if (!DISubprogram(Scope).describes(F))
           return false;





More information about the llvm-commits mailing list