Gracefully handle imbalanced inline function begin and end markers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73426 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-06-15 21:45:50 +00:00
parent 2077e18caf
commit 11a407f43f
3 changed files with 86 additions and 2 deletions

View File

@ -1850,7 +1850,14 @@ unsigned DwarfDebug::RecordInlinedFnEnd(DISubprogram &SP) {
}
SmallVector<DbgScope *, 8> &Scopes = I->second;
assert(!Scopes.empty() && "We should have at least one debug scope!");
if (Scopes.empty()) {
// Returned ID is 0 if this is unbalanced "end of inlined
// scope". This could happen if optimizer eats dbg intrinsics
// or "beginning of inlined scope" is not recoginized due to
// missing location info. In such cases, ignore this region.end.
return 0;
}
DbgScope *Scope = Scopes.back(); Scopes.pop_back();
unsigned ID = MMI->NextLabelID();
MMI->RecordUsedDbgLabel(ID);