diff --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h --- a/llvm/include/llvm/CodeGen/DIE.h +++ b/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; diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h b/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h --- a/llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h +++ b/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 { diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp --- a/llvm/lib/DWARFLinker/DWARFLinker.cpp +++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp @@ -1125,11 +1125,11 @@ : static_cast(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; } diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp --- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp +++ b/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; } }