diff options
author | Devang Patel <dpatel@apple.com> | 2009-01-20 18:35:14 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-01-20 18:35:14 +0000 |
commit | eab4a2e8ac909b0ca420380634403616566d63fa (patch) | |
tree | e3b25a542c2c197b1e27583927db44bf1bff2138 | |
parent | 24b66a83ca8c80417ad7523c35ece709a7e6599c (diff) | |
download | external_llvm-eab4a2e8ac909b0ca420380634403616566d63fa.zip external_llvm-eab4a2e8ac909b0ca420380634403616566d63fa.tar.gz external_llvm-eab4a2e8ac909b0ca420380634403616566d63fa.tar.bz2 |
Enable debug info for enums.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62594 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index d3d2ded..fa05c68 100644 --- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -1752,13 +1752,18 @@ private: 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 @@ private: /// 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. |