From: Adrian Prantl Date: Tue, 20 Jan 2015 18:03:37 +0000 (+0000) Subject: Add an assertion and prefer a crash over an infinite loop. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=61b4b8088d2f0a592e19dcf870a727d72e2d0aa3;p=oota-llvm.git Add an assertion and prefer a crash over an infinite loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226588 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp index c5c11157971..0dd46b7619c 100644 --- a/lib/IR/DebugInfo.cpp +++ b/lib/IR/DebugInfo.cpp @@ -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;