aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/DwarfWriter.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-03-01 18:20:30 +0000
committerJim Laskey <jlaskey@mac.com>2006-03-01 18:20:30 +0000
commit92ae7403964e522267f557772e0eb408116e35ac (patch)
tree541e348f5a1c47cedd314c4fcf5e5fd4f3ea45d2 /lib/CodeGen/DwarfWriter.cpp
parent288fe0f74da02944e3a9b3fc2a751789482faf0b (diff)
Use context and not compile unit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index da4c75564a..5ce4349a96 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -967,7 +967,7 @@ DWLabel DwarfWriter::NewString(const std::string &String) {
/// NewBasicType - Creates a new basic type if necessary, then adds to the
/// owner.
/// FIXME - Should never be needed.
-DIE *DwarfWriter::NewBasicType(CompileUnit *Unit, Type *Ty) {
+DIE *DwarfWriter::NewBasicType(DIE *Context, Type *Ty) {
DIE *&Slot = TypeToDieMap[Ty];
if (Slot) return Slot;
@@ -1040,17 +1040,19 @@ DIE *DwarfWriter::NewBasicType(CompileUnit *Unit, Type *Ty) {
Slot->AddUInt (DW_AT_byte_size, 0, Size);
Slot->AddUInt (DW_AT_encoding, DW_FORM_data1, Encoding);
- // Add to context owner.
- Unit->getDie()->AddChild(Slot);
+ // Add to context.
+ Context->AddChild(Slot);
return Slot;
}
/// NewType - Create a new type DIE.
///
-DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc) {
+DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc) {
// FIXME - hack to get around NULL types short term.
- if (!TyDesc) return NewBasicType(Unit, Type::IntTy);
+ if (!TyDesc) return NewBasicType(Context, Type::IntTy);
+
+ // FIXME - Should handle other contexts that compile units.
// Check for pre-existence.
DIE *&Slot = DescToDieMap[TyDesc];
@@ -1085,7 +1087,7 @@ DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc) {
// Map to main type, void will not have a type.
if (TypeDesc *FromTy = DerivedTy->getFromType()) {
- Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Unit, FromTy));
+ Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Context, FromTy));
}
} else if (CompositeTypeDesc *CompTy = dyn_cast<CompositeTypeDesc>(TyDesc)) {
// Determine which composite type.
@@ -1106,7 +1108,7 @@ DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc) {
case DI_TAG_array: {
// Add element type.
if (TypeDesc *FromTy = CompTy->getFromType()) {
- Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Unit, FromTy));
+ Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Context, FromTy));
}
// Don't emit size attribute.
Size = 0;
@@ -1116,7 +1118,7 @@ DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc) {
IndexTy->AddUInt(DW_AT_byte_size, 0, 4);
IndexTy->AddUInt(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed);
// Add to context.
- Unit->getDie()->AddChild(IndexTy);
+ Context->AddChild(IndexTy);
// Add subranges to array type.
for(unsigned i = 0, N = Elements.size(); i < N; ++i) {
@@ -1166,7 +1168,7 @@ DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc) {
}
// Add to context owner.
- Unit->getDie()->AddChild(Ty);
+ Context->AddChild(Ty);
return Slot;
}
@@ -1226,7 +1228,7 @@ DIE *DwarfWriter::NewGlobalVariable(GlobalVariableDesc *GVD) {
unsigned Line = GVD->getLine();
// Get the global's type.
- DIE *Type = NewType(Unit, GVD->getTypeDesc());
+ DIE *Type = NewType(Unit->getDie(), GVD->getTypeDesc());
// Create the globale variable DIE.
DIE *VariableDie = new DIE(DW_TAG_variable);
@@ -1269,7 +1271,7 @@ DIE *DwarfWriter::NewSubprogram(SubprogramDesc *SPD) {
unsigned Line = 1;
// FIXME - faking the type for the time being.
- DIE *Type = NewBasicType(Unit, Type::IntTy);
+ DIE *Type = NewBasicType(Unit->getDie(), Type::IntTy);
DIE *SubprogramDie = new DIE(DW_TAG_subprogram);
SubprogramDie->AddString (DW_AT_name, DW_FORM_string, Name);