Skip to content

Commit f88b2c8

Browse files
committed
Add an assertion and prefer a crash over an infinite loop.
llvm-svn: 226588
1 parent 2d53c31 commit f88b2c8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/IR/DebugInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,15 @@ bool DISubprogram::Verify() const {
527527
while ((IA = DL.getInlinedAt()))
528528
DL = DebugLoc::getFromDILocation(IA);
529529
DL.getScopeAndInlinedAt(Scope, IA);
530+
assert(Scope && "debug location has no scope");
530531
assert(!IA);
531532
while (!DIDescriptor(Scope).isSubprogram()) {
532533
DILexicalBlockFile D(Scope);
533534
Scope = D.isLexicalBlockFile()
534535
? D.getScope()
535536
: DebugLoc::getFromDILexicalBlock(Scope).getScope();
537+
if (!Scope)
538+
llvm_unreachable("lexical block file has no scope");
536539
}
537540
if (!DISubprogram(Scope).describes(F))
538541
return false;

0 commit comments

Comments
 (0)