diff options
author | Devang Patel <dpatel@apple.com> | 2009-01-27 23:22:55 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-01-27 23:22:55 +0000 |
commit | 7009d24e8157dbe3689f7f44b64cedf6e1371b84 (patch) | |
tree | 852794398aab018eb3da023faf88caaeafdb3213 /lib/CodeGen/AsmPrinter/DwarfWriter.cpp | |
parent | 06efc02854a96a9f92edc3bf46b0451f488cf2e6 (diff) |
Add type DIE into appropriate context DIE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfWriter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 19edd95146..63fb68b5ec 100644 --- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -1687,9 +1687,23 @@ private: ConstructTypeDIE(DW_Unit, Buffer, DICompositeType(Ty.getGV())); } - // Add debug information entry to entity and unit. - DIE *Die = DW_Unit->AddDie(Buffer); - SetDIEntry(Slot, Die); + // Add debug information entry to entity and appropriate context. + DIE *Die = NULL; + DIDescriptor Context = Ty.getContext(); + if (!Context.isNull()) + Die = DW_Unit->getDieMapSlotFor(Context.getGV()); + + if (Die) { + DIE *Child = new DIE(Buffer); + Die->AddChild(Child); + Buffer.Detach(); + SetDIEntry(Slot, Child); + } + else { + Die = DW_Unit->AddDie(Buffer); + SetDIEntry(Slot, Die); + } + Entity->AddValue(DW_AT_type, DW_FORM_ref4, Slot); } |