diff options
author | Jim Laskey <jlaskey@mac.com> | 2006-10-04 10:40:15 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2006-10-04 10:40:15 +0000 |
commit | 0c0feb9d5f208cde7c0f61899333da913018f17f (patch) | |
tree | d041af629950aeec627fc41abdfb39a927ebea5d /lib/CodeGen/DwarfWriter.cpp | |
parent | 83e6c9925e86cc6d89cf31ae536ec8eee20e72eb (diff) |
More long term solution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r-- | lib/CodeGen/DwarfWriter.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index 32079f2200..aa393f3678 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -1259,17 +1259,27 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc, CompileUnit *Unit) { Unit->getDie()->AddChild(Die); return Die; } - + // Check for pre-existence. DIE *&Slot = Unit->getDieMapSlotFor(TyDesc); if (Slot) return Slot; + // Type DIE result. + DIE *Ty = NULL; + + // Short cut for handling subprogram types (not really a TyDesc.) + if (SubprogramDesc *SubprogramTy = dyn_cast<SubprogramDesc>(TyDesc)) { + Slot = Ty = new DIE(DW_TAG_pointer_type); + Ty->AddUInt(DW_AT_byte_size, 0, TAI->getAddressSize()); + Ty->AddString(DW_AT_name, DW_FORM_string, SubprogramTy->getName()); + Context->AddChild(Ty); + return Slot; + } + // Get core information. const std::string &Name = TyDesc->getName(); uint64_t Size = TyDesc->getSize() >> 3; - DIE *Ty = NULL; - if (BasicTypeDesc *BasicTy = dyn_cast<BasicTypeDesc>(TyDesc)) { // Fundamental types like int, float, bool Slot = Ty = new DIE(DW_TAG_base_type); @@ -1526,14 +1536,8 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc, CompileUnit *Unit) { } default: break; } - } else if (SubprogramDesc *SubprogramTy = dyn_cast<SubprogramDesc>(TyDesc)) { - Slot = Ty = new DIE(DW_TAG_pointer_type); - Ty->AddUInt(DW_AT_byte_size, 0, TAI->getAddressSize()); - Ty->AddString(DW_AT_name, DW_FORM_string, SubprogramTy->getName()); - Context->AddChild(Ty); - return Slot; } - + assert(Ty && "Type not supported yet"); // Add size if non-zero (derived types don't have a size.) |