[MCDwarf] Use emplace to avoid move assignment. NFC
authorFangrui Song <i@maskray.me>
Fri, 12 Aug 2022 05:05:49 +0000 (05:05 +0000)
committerTobias Hieta <tobias@hieta.se>
Tue, 16 Aug 2022 06:30:06 +0000 (08:30 +0200)
(cherry picked from commit b0c4cd35df89479ec152c1f79e18d0264dd276cc)

llvm/lib/MC/MCDwarf.cpp
llvm/unittests/MC/DwarfLineTableHeaders.cpp

index 4cbb9981fde2d3eb1e5f3c6c085cd2047fc374a7..91a636b6bd7151559aea587ea79ff0336f721561 100644 (file)
@@ -266,7 +266,7 @@ void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) {
   // In a v5 non-split line table, put the strings in a separate section.
   Optional<MCDwarfLineStr> LineStr;
   if (context.getDwarfVersion() >= 5)
-    LineStr = MCDwarfLineStr(context);
+    LineStr.emplace(context);
 
   // Switch to the section where the table will be emitted into.
   MCOS->switchSection(context.getObjectFileInfo()->getDwarfLineSection());
index 8ce6a03649a9a9f8ba4f6b858691d8970015c556..5b40df41e4291d3717096efcdba5c655d04f1713 100644 (file)
@@ -120,7 +120,7 @@ public:
     MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
     Optional<MCDwarfLineStr> LineStr(None);
     if (Ctx.getDwarfVersion() >= 5) {
-      LineStr = MCDwarfLineStr(Ctx);
+      LineStr.emplace(Ctx);
       Header.setRootFile("dir", "file", None, None);
     }
     MCSymbol *LineEndSym = Header.Emit(TheStreamer, Params, LineStr).second;