[llvm] r348961 - DebugInfo/DWARF: Refactor type dumping to dump types, rather than DIEs that reference types

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 12 11:33:08 PST 2018


Author: dblaikie
Date: Wed Dec 12 11:33:08 2018
New Revision: 348961

URL: http://llvm.org/viewvc/llvm-project?rev=348961&view=rev
Log:
DebugInfo/DWARF: Refactor type dumping to dump types, rather than DIEs that reference types

This lays the foundation for dumping types not referenced by DW_AT_type
attributes (in the near-term, that'll be DW_AT_containing_type for a
DW_TAG_ptr_to_member_type - in the future, potentially dumping the
pretty printed name next to the DW_TAG for the type, rather than only
when the type is referenced from elsewhere)

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=348961&r1=348960&r2=348961&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp Wed Dec 12 11:33:08 2018
@@ -155,9 +155,7 @@ static void dumpTypeTagName(raw_ostream
 }
 
 /// Recursively dump the DIE type name when applicable.
-static void dumpTypeName(raw_ostream &OS, const DWARFDie &Die) {
-  DWARFDie D = Die.getAttributeValueAsReferencedDie(DW_AT_type);
-
+static void dumpTypeName(raw_ostream &OS, const DWARFDie &D) {
   if (!D.isValid())
     return;
 
@@ -181,7 +179,7 @@ static void dumpTypeName(raw_ostream &OS
   }
 
   // Follow the DW_AT_type if possible.
-  dumpTypeName(OS, D);
+  dumpTypeName(OS, D.getAttributeValueAsReferencedDie(DW_AT_type));
 
   switch (T) {
   case DW_TAG_array_type: {
@@ -295,7 +293,7 @@ static void dumpAttribute(raw_ostream &O
       OS << Space << "\"" << Name << '\"';
   } else if (Attr == DW_AT_type) {
     OS << Space << "\"";
-    dumpTypeName(OS, Die);
+    dumpTypeName(OS, Die.getAttributeValueAsReferencedDie(formValue));
     OS << '"';
   } else if (Attr == DW_AT_APPLE_property_attribute) {
     if (Optional<uint64_t> OptVal = formValue.getAsUnsignedConstant())




More information about the llvm-commits mailing list