[PATCH] D150256: [NFC]add mov constructor to DIEValue

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 01:36:35 PDT 2023


XinWang10 created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150256

Files:
  llvm/include/llvm/CodeGen/DIE.h
  llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
  llvm/lib/DWARFLinker/DWARFLinker.cpp
  llvm/lib/DWARFLinker/DWARFStreamer.cpp


Index: llvm/lib/DWARFLinker/DWARFStreamer.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -976,11 +976,13 @@
     bool hasDWARFv5Header = false;
     for (auto &V : OutputUnitDIE->values()) {
       if (V.getAttribute() == dwarf::DW_AT_macro_info) {
-        V = DIEValue(V.getAttribute(), V.getForm(), DIEInteger(OutOffset));
+        V = std::move(
+            DIEValue(V.getAttribute(), V.getForm(), DIEInteger(OutOffset)));
         break;
       } else if (V.getAttribute() == dwarf::DW_AT_macros) {
         hasDWARFv5Header = true;
-        V = DIEValue(V.getAttribute(), V.getForm(), DIEInteger(OutOffset));
+        V = std::move(
+            DIEValue(V.getAttribute(), V.getForm(), DIEInteger(OutOffset)));
         break;
       }
     }
Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1125,11 +1125,11 @@
              : static_cast<DIEValueList *>(Block);
 
   if (Loc)
-    Value = DIEValue(dwarf::Attribute(AttrSpec.Attr),
-                     dwarf::Form(AttrSpec.Form), Loc);
+    Value = std::move(DIEValue(dwarf::Attribute(AttrSpec.Attr),
+                               dwarf::Form(AttrSpec.Form), Loc));
   else
-    Value = DIEValue(dwarf::Attribute(AttrSpec.Attr),
-                     dwarf::Form(AttrSpec.Form), Block);
+    Value = std::move(DIEValue(dwarf::Attribute(AttrSpec.Attr),
+                               dwarf::Form(AttrSpec.Form), Block));
 
   // If the block is a DWARF Expression, clone it into the temporary
   // buffer using cloneExpression(), otherwise copy the data directly.
@@ -1866,7 +1866,7 @@
 static void patchStmtList(DIE &Die, DIEInteger Offset) {
   for (auto &V : Die.values())
     if (V.getAttribute() == dwarf::DW_AT_stmt_list) {
-      V = DIEValue(V.getAttribute(), V.getForm(), Offset);
+      V = std::move(DIEValue(V.getAttribute(), V.getForm(), Offset));
       return;
     }
 
Index: llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
===================================================================
--- llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
+++ llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
@@ -34,7 +34,8 @@
     assert(I);
     const auto &Old = *I;
     assert(Old.getType() == DIEValue::isInteger);
-    *I = DIEValue(Old.getAttribute(), Old.getForm(), DIEInteger(New));
+    *I =
+        std::move(DIEValue(Old.getAttribute(), Old.getForm(), DIEInteger(New)));
   }
 
   uint64_t get() const {
Index: llvm/include/llvm/CodeGen/DIE.h
===================================================================
--- llvm/include/llvm/CodeGen/DIE.h
+++ llvm/include/llvm/CodeGen/DIE.h
@@ -463,6 +463,11 @@
     copyVal(X);
   }
 
+  DIEValue(DIEValue &&X) : Ty(X.Ty), Attribute(X.Attribute), Form(X.Form) {
+    copyVal(X);
+    X.Ty = isNone;
+  }
+
   DIEValue &operator=(const DIEValue &X) {
     if (this == &X)
       return *this;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150256.520932.patch
Type: text/x-patch
Size: 3100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230510/ea854b86/attachment.bin>


More information about the llvm-commits mailing list