[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp

Jim Laskey jlaskey at apple.com
Wed Oct 4 03:40:30 PDT 2006



Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.77 -> 1.78
---
Log message:

More long term solution

---
Diffs of the changes:  (+14 -10)

 DwarfWriter.cpp |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.77 llvm/lib/CodeGen/DwarfWriter.cpp:1.78
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.77	Tue Oct  3 20:43:13 2006
+++ llvm/lib/CodeGen/DwarfWriter.cpp	Wed Oct  4 05:40:15 2006
@@ -1259,17 +1259,27 @@
     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 @@
     }
     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.)






More information about the llvm-commits mailing list