DebugInfo: Sink constructImportedEntityDIE down into DwarfUnit from DwarfDebug.

It was just calling a bunch of DwarfUnit functions anyway, as can be
seen by the simplification of removing "TheCU" from all the function
calls in the implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219103 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-10-06 05:37:24 +00:00
parent f2eddd6694
commit d53f7f4b22
4 changed files with 34 additions and 36 deletions

View File

@ -1139,6 +1139,34 @@ void DwarfUnit::constructSubprogramArguments(DIE &Buffer, DITypeArray Args) {
}
}
std::unique_ptr<DIE>
DwarfUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
assert(Module.Verify() &&
"Use one of the MDNode * overloads to handle invalid metadata");
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module.getTag());
insertDIE(Module, IMDie.get());
DIE *EntityDie;
DIDescriptor Entity = resolve(Module.getEntity());
if (Entity.isNameSpace())
EntityDie = getOrCreateNameSpace(DINameSpace(Entity));
else if (Entity.isSubprogram())
EntityDie = getOrCreateSubprogramDIE(DISubprogram(Entity));
else if (Entity.isType())
EntityDie = getOrCreateTypeDIE(DIType(Entity));
else
EntityDie = getDIE(Entity);
assert(EntityDie);
addSourceLine(*IMDie, Module.getLineNumber(),
Module.getContext().getFilename(),
Module.getContext().getDirectory());
addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie);
StringRef Name = Module.getName();
if (!Name.empty())
addString(*IMDie, dwarf::DW_AT_name, Name);
return IMDie;
}
/// constructTypeDIE - Construct type DIE from DICompositeType.
void DwarfUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
// Add name if not anonymous or intermediate type.