[PATCH] D98194: 1/2: [nfc] llvm-dwarfdump: DWARFAbbreviationDeclaration::AttributeSpec -> DWARFAttribute

Jan Kratochvil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 23:32:31 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGba8907bf6f2c: [nfc] llvm-dwarfdump: DWARFAbbreviationDeclaration::AttributeSpec ->… (authored by jankratochvil).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98194/new/

https://reviews.llvm.org/D98194

Files:
  llvm/lib/DebugInfo/DWARF/DWARFDie.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -69,7 +69,7 @@
   }
 }
 
-static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
+static void dumpLocation(raw_ostream &OS, const DWARFFormValue &FormValue,
                          DWARFUnit *U, unsigned Indent,
                          DIDumpOptions DumpOpts) {
   DWARFContext &Ctx = U->getContext();
@@ -230,21 +230,22 @@
 }
 
 static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
-                          uint64_t *OffsetPtr, dwarf::Attribute Attr,
-                          dwarf::Form Form, unsigned Indent,
+                          const DWARFAttribute &AttrValue, unsigned Indent,
                           DIDumpOptions DumpOpts) {
   if (!Die.isValid())
     return;
   const char BaseIndent[] = "            ";
   OS << BaseIndent;
   OS.indent(Indent + 2);
+  dwarf::Attribute Attr = AttrValue.Attr;
   WithColor(OS, HighlightColor::Attribute) << formatv("{0}", Attr);
 
+  dwarf::Form Form = AttrValue.Value.getForm();
   if (DumpOpts.Verbose || DumpOpts.ShowForm)
     OS << formatv(" [{0}]", Form);
 
   DWARFUnit *U = Die.getDwarfUnit();
-  DWARFFormValue FormValue = DWARFFormValue::createFromUnit(Form, U, OffsetPtr);
+  const DWARFFormValue &FormValue = AttrValue.Value;
 
   OS << "\t(";
 
@@ -631,15 +632,14 @@
         OS << '\n';
 
         // Dump all data in the DIE for the attributes.
-        for (const auto &AttrSpec : AbbrevDecl->attributes()) {
-          if (AttrSpec.Form == DW_FORM_implicit_const) {
+        for (const DWARFAttribute &AttrValue : attributes()) {
+          if (AttrValue.Value.getForm() == DW_FORM_implicit_const) {
             // We are dumping .debug_info section ,
             // implicit_const attribute values are not really stored here,
             // but in .debug_abbrev section. So we just skip such attrs.
             continue;
           }
-          dumpAttribute(OS, *this, &offset, AttrSpec.Attr, AttrSpec.Form,
-                        Indent, DumpOpts);
+          dumpAttribute(OS, *this, AttrValue, Indent, DumpOpts);
         }
 
         DWARFDie child = getFirstChild();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98194.329223.patch
Type: text/x-patch
Size: 2283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210309/5a5cbb26/attachment.bin>


More information about the llvm-commits mailing list