[PATCH] D64407: [DWARF] Simplify constructing of DWARFAttribute. NFC.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 9 05:47:22 PDT 2019


ikudrin created this revision.
ikudrin added reviewers: dblaikie, clayborg, Eugene.Zelenko.
Herald added a project: LLVM.

The first argument in the constructor was ignored, and the remaining arguments were always passed as their defaults.
This patch simplifies the class by moving all initializations to the members.


Repository:
  rL LLVM

https://reviews.llvm.org/D64407

Files:
  include/llvm/DebugInfo/DWARF/DWARFAttribute.h
  lib/DebugInfo/DWARF/DWARFDie.cpp


Index: lib/DebugInfo/DWARF/DWARFDie.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDie.cpp
+++ lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -663,7 +663,7 @@
 }
 
 DWARFDie::attribute_iterator::attribute_iterator(DWARFDie D, bool End)
-    : Die(D), AttrValue(0), Index(0) {
+    : Die(D), AttrValue(), Index(0) {
   auto AbbrDecl = Die.getAbbreviationDeclarationPtr();
   assert(AbbrDecl && "Must have abbreviation declaration");
   if (End) {
Index: include/llvm/DebugInfo/DWARF/DWARFAttribute.h
===================================================================
--- include/llvm/DebugInfo/DWARF/DWARFAttribute.h
+++ include/llvm/DebugInfo/DWARF/DWARFAttribute.h
@@ -27,12 +27,11 @@
   /// The debug info/types section byte size of the data for this attribute.
   uint32_t ByteSize = 0;
   /// The attribute enumeration of this attribute.
-  dwarf::Attribute Attr;
+  dwarf::Attribute Attr = dwarf::Attribute(0);
   /// The form and value for this attribute.
-  DWARFFormValue Value;
+  DWARFFormValue Value = dwarf::Form(0);
 
-  DWARFAttribute(uint32_t O, dwarf::Attribute A = dwarf::Attribute(0),
-                 dwarf::Form F = dwarf::Form(0)) : Attr(A), Value(F) {}
+  DWARFAttribute() = default;
 
   bool isValid() const {
     return Offset != 0 && Attr != dwarf::Attribute(0);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64407.208651.patch
Type: text/x-patch
Size: 1335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190709/50f2d6c5/attachment-0001.bin>


More information about the llvm-commits mailing list