mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-02 09:33:59 +00:00
[Dwarf] early exit to avoid creating dangling DIEs
We used to create children DIEs for a scope, then check whether ScopeDIE is null. If ScopeDIE is null, the children DIEs will be dangling. Other DIEs can link to those dangling DIEs, which are not emitted at all, causing dwarf error. The current testing case is 4k lines, from MultiSource/BenchMark/McCat/09-vor. rdar://problem/13071959 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
108fb3202a
commit
8b15d74434
@ -540,6 +540,12 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
|
||||
if (!Scope || !Scope->getScopeNode())
|
||||
return NULL;
|
||||
|
||||
DIScope DS(Scope->getScopeNode());
|
||||
// Early return to avoid creating dangling variable|scope DIEs.
|
||||
if (!Scope->getInlinedAt() && DS.isSubprogram() && Scope->isAbstractScope() &&
|
||||
!TheCU->getDIE(DS))
|
||||
return NULL;
|
||||
|
||||
SmallVector<DIE *, 8> Children;
|
||||
DIE *ObjectPointer = NULL;
|
||||
|
||||
@ -565,7 +571,6 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
|
||||
for (unsigned j = 0, M = Scopes.size(); j < M; ++j)
|
||||
if (DIE *Nested = constructScopeDIE(TheCU, Scopes[j]))
|
||||
Children.push_back(Nested);
|
||||
DIScope DS(Scope->getScopeNode());
|
||||
DIE *ScopeDIE = NULL;
|
||||
if (Scope->getInlinedAt())
|
||||
ScopeDIE = constructInlinedScopeDIE(TheCU, Scope);
|
||||
|
Loading…
x
Reference in New Issue
Block a user