[llvm-commits] [llvm] r62594 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Devang Patel
dpatel at apple.com
Tue Jan 20 10:35:14 PST 2009
Author: dpatel
Date: Tue Jan 20 12:35:14 2009
New Revision: 62594
URL: http://llvm.org/viewvc/llvm-project?rev=62594&view=rev
Log:
Enable debug info for enums.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=62594&r1=62593&r2=62594&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Tue Jan 20 12:35:14 2009
@@ -1752,13 +1752,18 @@
case DW_TAG_array_type:
ConstructArrayTypeDIE(DW_Unit, Buffer, &CTy);
break;
- //FIXME - Enable this.
- // case DW_TAG_enumeration_type:
- // DIArray Elements = CTy.getTypeArray();
- // // Add enumerators to enumeration type.
- // for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i)
- // ConstructEnumTypeDIE(Buffer, &Elements.getElement(i));
- // break;
+ case DW_TAG_enumeration_type:
+ {
+ DIArray Elements = CTy.getTypeArray();
+ // Add enumerators to enumeration type.
+ for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {
+ DIE *ElemDie = NULL;
+ DIEnumerator Enum(Elements.getElement(i).getGV());
+ ElemDie = ConstructEnumTypeDIE(DW_Unit, &Enum);
+ Buffer.AddChild(ElemDie);
+ }
+ }
+ break;
case DW_TAG_subroutine_type:
{
// Add prototype flag.
@@ -1874,14 +1879,13 @@
/// ConstructEnumTypeDIE - Construct enum type DIE from
/// DIEnumerator.
- void ConstructEnumTypeDIE(CompileUnit *DW_Unit,
- DIE &Buffer, DIEnumerator *ETy) {
+ DIE *ConstructEnumTypeDIE(CompileUnit *DW_Unit, DIEnumerator *ETy) {
DIE *Enumerator = new DIE(DW_TAG_enumerator);
AddString(Enumerator, DW_AT_name, DW_FORM_string, ETy->getName());
int64_t Value = ETy->getEnumValue();
AddSInt(Enumerator, DW_AT_const_value, DW_FORM_sdata, Value);
- Buffer.AddChild(Enumerator);
+ return Enumerator;
}
/// CreateGlobalVariableDIE - Create new DIE using GV.
More information about the llvm-commits
mailing list