Sink DwarfDebug::createScopeChildrenDIE down into DwarfCompileUnit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-10-09 18:24:28 +00:00
parent 54d63b4fd5
commit 5465cc6741
4 changed files with 31 additions and 28 deletions

View File

@ -330,31 +330,11 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
return !getLabelAfterInsn(Ranges.front().second);
}
DIE *DwarfDebug::createScopeChildrenDIE(
DwarfCompileUnit &TheCU, LexicalScope *Scope,
SmallVectorImpl<std::unique_ptr<DIE>> &Children,
unsigned *ChildScopeCount) {
DIE *ObjectPointer = nullptr;
for (DbgVariable *DV : ScopeVariables.lookup(Scope))
Children.push_back(TheCU.constructVariableDIE(*DV, *Scope, ObjectPointer));
unsigned ChildCountWithoutScopes = Children.size();
for (LexicalScope *LS : Scope->getChildren())
TheCU.constructScopeDIE(LS, Children);
if (ChildScopeCount)
*ChildScopeCount = Children.size() - ChildCountWithoutScopes;
return ObjectPointer;
}
DIE *DwarfDebug::createAndAddScopeChildren(DwarfCompileUnit &TheCU,
LexicalScope *Scope, DIE &ScopeDIE) {
// We create children when the scope DIE is not null.
SmallVector<std::unique_ptr<DIE>, 8> Children;
DIE *ObjectPointer = createScopeChildrenDIE(TheCU, Scope, Children);
DIE *ObjectPointer = TheCU.createScopeChildrenDIE(Scope, Children);
// Add children
for (auto &I : Children)
@ -1483,6 +1463,8 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
assert(ScopeVariables.empty());
assert(CurrentFnArguments.empty());
assert(DbgValues.empty());
// FIXME: This wouldn't be true in LTO with a -g (with inlining) CU followed
// by a -gmlt CU. Add a test and remove this assertion.
assert(AbstractVariables.empty());
LabelsBeforeInsn.clear();
LabelsAfterInsn.clear();