[llvm-branch-commits] [llvm] c439888 - [MCDwarf] Use emplace to avoid move assignment. NFC

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 15 23:31:12 PDT 2022


Author: Fangrui Song
Date: 2022-08-16T08:30:06+02:00
New Revision: c4398881f8ef60074415ecaf019cfe98a88275da

URL: https://github.com/llvm/llvm-project/commit/c4398881f8ef60074415ecaf019cfe98a88275da
DIFF: https://github.com/llvm/llvm-project/commit/c4398881f8ef60074415ecaf019cfe98a88275da.diff

LOG: [MCDwarf] Use emplace to avoid move assignment. NFC

(cherry picked from commit b0c4cd35df89479ec152c1f79e18d0264dd276cc)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 4cbb9981fde2d..91a636b6bd715 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<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());

diff  --git a/llvm/unittests/MC/DwarfLineTableHeaders.cpp b/llvm/unittests/MC/DwarfLineTableHeaders.cpp
index 8ce6a03649a9a..5b40df41e4291 100644
--- a/llvm/unittests/MC/DwarfLineTableHeaders.cpp
+++ b/llvm/unittests/MC/DwarfLineTableHeaders.cpp
@@ -120,7 +120,7 @@ class DwarfLineTableHeaders : public ::testing::Test {
     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;


        


More information about the llvm-branch-commits mailing list