From b0c4cd35df89479ec152c1f79e18d0264dd276cc Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 12 Aug 2022 05:05:49 +0000 Subject: [PATCH] [MCDwarf] Use emplace to avoid move assignment. NFC --- llvm/lib/MC/MCDwarf.cpp | 2 +- llvm/unittests/MC/DwarfLineTableHeaders.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 4cbb9981fde2..91a636b6bd71 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -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 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()); diff --git a/llvm/unittests/MC/DwarfLineTableHeaders.cpp b/llvm/unittests/MC/DwarfLineTableHeaders.cpp index 8ce6a03649a9..5b40df41e429 100644 --- a/llvm/unittests/MC/DwarfLineTableHeaders.cpp +++ b/llvm/unittests/MC/DwarfLineTableHeaders.cpp @@ -120,7 +120,7 @@ public: MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams(); Optional 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;