[llvm] 713c2b4 - [DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print type dies.

Alexey Lapshin via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 05:21:10 PST 2022


Author: Alexey Lapshin
Date: 2022-01-14T16:19:08+03:00
New Revision: 713c2b47a07d4f0e02f4a891b2738ee0faed7ce1

URL: https://github.com/llvm/llvm-project/commit/713c2b47a07d4f0e02f4a891b2738ee0faed7ce1
DIFF: https://github.com/llvm/llvm-project/commit/713c2b47a07d4f0e02f4a891b2738ee0faed7ce1.diff

LOG: [DebugInfo][DWARF][NFC] Refactor DWARFTypePrinter usages. Create functions to print type dies.

This patch creates functions which might be used to dump types.
This functionality was already implemented by  DWARFTypePrinter.
Now it could be reused. It will help D96035, which uses DWARFTypePrinter.

Differential Revision: https://reviews.llvm.org/D117134

Added: 
    

Modified: 
    llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
    llvm/lib/DebugInfo/DWARF/DWARFDie.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
index 0d4fe9aec8d03..f731d440a35b9 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -470,6 +470,10 @@ inline std::reverse_iterator<DWARFDie::iterator> DWARFDie::rend() const {
   return std::make_reverse_iterator(begin());
 }
 
+void dumpTypeQualifiedName(const DWARFDie &DIE, raw_ostream &OS);
+void dumpTypeUnqualifiedName(const DWARFDie &DIE, raw_ostream &OS,
+                             std::string *OriginalFullName = nullptr);
+
 } // end namespace llvm
 
 #endif // LLVM_DEBUGINFO_DWARF_DWARFDIE_H

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 08f6c16457606..ec7889a3728ab 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -772,7 +772,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
     DWARFDie D = resolveReferencedType(Die, FormValue);
     if (D && !D.isNULL()) {
       OS << Space << "\"";
-      DWARFTypePrinter(OS).appendQualifiedName(D);
+      dumpTypeQualifiedName(D, OS);
       OS << '"';
     }
   } else if (Attr == DW_AT_APPLE_property_attribute) {
@@ -808,7 +808,7 @@ void DWARFDie::getFullName(raw_string_ostream &OS,
     return;
   if (getTag() == DW_TAG_GNU_template_parameter_pack)
     return;
-  DWARFTypePrinter(OS).appendUnqualifiedName(*this, OriginalFullName);
+  dumpTypeUnqualifiedName(*this, OS, OriginalFullName);
 }
 
 bool DWARFDie::isSubprogramDIE() const { return getTag() == DW_TAG_subprogram; }
@@ -1270,3 +1270,16 @@ bool DWARFAttribute::mayHaveLocationExpr(dwarf::Attribute Attr) {
     return false;
   }
 }
+
+namespace llvm {
+
+void dumpTypeQualifiedName(const DWARFDie &DIE, raw_ostream &OS) {
+  DWARFTypePrinter(OS).appendQualifiedName(DIE);
+}
+
+void dumpTypeUnqualifiedName(const DWARFDie &DIE, raw_ostream &OS,
+                             std::string *OriginalFullName) {
+  DWARFTypePrinter(OS).appendUnqualifiedName(DIE, OriginalFullName);
+}
+
+} // namespace llvm


        


More information about the llvm-commits mailing list