[llvm] [BOLT] Remove redundant calls to std::unique_ptr<T>::get (NFC) (PR #139403)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat May 10 12:36:00 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/139403

None

>From ae5844e88fc2e7e060ef5c82f0de4715bab236bd Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 25 Mar 2025 00:24:37 -0700
Subject: [PATCH] [BOLT] Remove redundant calls to std::unique_ptr<T>::get
 (NFC)

---
 bolt/include/bolt/Core/BinaryContext.h        |  2 +-
 bolt/include/bolt/Core/BinaryFunction.h       |  4 ++--
 bolt/include/bolt/Core/DIEBuilder.h           |  2 +-
 bolt/lib/Core/DIEBuilder.cpp                  |  8 +++----
 bolt/lib/Core/DebugData.cpp                   | 12 +++++-----
 bolt/lib/Core/DebugNames.cpp                  |  4 ++--
 bolt/lib/Core/ParallelUtilities.cpp           |  2 +-
 bolt/lib/Passes/AsmDump.cpp                   |  4 ++--
 bolt/lib/Passes/RetpolineInsertion.cpp        |  2 +-
 bolt/lib/Rewrite/DWARFRewriter.cpp            | 24 +++++++++----------
 bolt/lib/Rewrite/MachORewriteInstance.cpp     |  6 ++---
 bolt/lib/Rewrite/RewriteInstance.cpp          |  6 ++---
 bolt/lib/RuntimeLibs/RuntimeLibrary.cpp       |  8 +++----
 bolt/lib/Target/AArch64/AArch64MCSymbolizer.h |  2 +-
 bolt/lib/Target/X86/X86MCSymbolizer.h         |  2 +-
 bolt/unittests/Core/BinaryContext.cpp         |  4 ++--
 bolt/unittests/Core/MCPlusBuilder.cpp         |  4 ++--
 bolt/unittests/Core/MemoryMaps.cpp            |  4 ++--
 18 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 88313a61ec13e..64e524e2f13d7 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -1499,7 +1499,7 @@ class BinaryContext {
     MCEInstance.LocalCtx.reset(
         new MCContext(*TheTriple, AsmInfo.get(), MRI.get(), STI.get()));
     MCEInstance.LocalMOFI.reset(
-        TheTarget->createMCObjectFileInfo(*MCEInstance.LocalCtx.get(),
+        TheTarget->createMCObjectFileInfo(*MCEInstance.LocalCtx,
                                           /*PIC=*/!HasFixedLoadAddress));
     MCEInstance.LocalCtx->setObjectFileInfo(MCEInstance.LocalMOFI.get());
     MCEInstance.MCE.reset(
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index d140202ee295f..c237f4a9d3b44 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -867,7 +867,7 @@ class BinaryFunction {
   /// Returns if BinaryDominatorTree has been constructed for this function.
   bool hasDomTree() const { return BDT != nullptr; }
 
-  BinaryDominatorTree &getDomTree() { return *BDT.get(); }
+  BinaryDominatorTree &getDomTree() { return *BDT; }
 
   /// Constructs DomTree for this function.
   void constructDomTree();
@@ -875,7 +875,7 @@ class BinaryFunction {
   /// Returns if loop detection has been run for this function.
   bool hasLoopInfo() const { return BLI != nullptr; }
 
-  const BinaryLoopInfo &getLoopInfo() { return *BLI.get(); }
+  const BinaryLoopInfo &getLoopInfo() { return *BLI; }
 
   bool isLoopFree() {
     if (!hasLoopInfo())
diff --git a/bolt/include/bolt/Core/DIEBuilder.h b/bolt/include/bolt/Core/DIEBuilder.h
index bd22c536c56fc..32e455ad3030a 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -137,7 +137,7 @@ class DIEBuilder {
   std::unordered_map<std::string, uint32_t> NameToIndexMap;
 
   /// Returns current state of the DIEBuilder
-  State &getState() { return *BuilderState.get(); }
+  State &getState() { return *BuilderState; }
 
   /// Resolve the reference in DIE, if target is not loaded into IR,
   /// pre-allocate it. \p RefCU will be updated to the Unit specific by \p
diff --git a/bolt/lib/Core/DIEBuilder.cpp b/bolt/lib/Core/DIEBuilder.cpp
index 80ad583e079d4..136c23d50df64 100644
--- a/bolt/lib/Core/DIEBuilder.cpp
+++ b/bolt/lib/Core/DIEBuilder.cpp
@@ -292,10 +292,10 @@ void DIEBuilder::buildTypeUnits(DebugStrOffsetsWriter *StrOffsetWriter,
 
   getState().Type = ProcessingType::DWARF4TUs;
   for (std::unique_ptr<DWARFUnit> &DU : CU4TURanges)
-    registerUnit(*DU.get(), false);
+    registerUnit(*DU, false);
 
   for (std::unique_ptr<DWARFUnit> &DU : CU4TURanges)
-    constructFromUnit(*DU.get());
+    constructFromUnit(*DU);
 
   DWARFContext::unit_iterator_range CURanges =
       isDWO() ? DwarfContext->dwo_info_section_units()
@@ -308,7 +308,7 @@ void DIEBuilder::buildTypeUnits(DebugStrOffsetsWriter *StrOffsetWriter,
   for (std::unique_ptr<DWARFUnit> &DU : CURanges) {
     if (!DU->isTypeUnit())
       continue;
-    registerUnit(*DU.get(), false);
+    registerUnit(*DU, false);
   }
 
   for (DWARFUnit *DU : getState().DWARF5TUVector) {
@@ -335,7 +335,7 @@ void DIEBuilder::buildCompileUnits(const bool Init) {
   for (std::unique_ptr<DWARFUnit> &DU : CURanges) {
     if (DU->isTypeUnit())
       continue;
-    registerUnit(*DU.get(), false);
+    registerUnit(*DU, false);
   }
 
   // Using DULIst since it can be modified by cross CU refrence resolution.
diff --git a/bolt/lib/Core/DebugData.cpp b/bolt/lib/Core/DebugData.cpp
index bd8aa807f1aae..e11be499f2c34 100644
--- a/bolt/lib/Core/DebugData.cpp
+++ b/bolt/lib/Core/DebugData.cpp
@@ -142,7 +142,7 @@ DebugRangesSectionWriter::DebugRangesSectionWriter() {
 
 void DebugRangesSectionWriter::initSection() {
   // Adds an empty range to the buffer.
-  writeAddressRanges(*RangesStream.get(), DebugAddressRangesVector{});
+  writeAddressRanges(*RangesStream, DebugAddressRangesVector{});
 }
 
 uint64_t DebugRangesSectionWriter::addRanges(
@@ -169,7 +169,7 @@ uint64_t DebugRangesSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
   // unique and correct offsets in patches.
   std::lock_guard<std::mutex> Lock(WriterMutex);
   const uint32_t EntryOffset = RangesBuffer->size();
-  writeAddressRanges(*RangesStream.get(), Ranges);
+  writeAddressRanges(*RangesStream, Ranges);
 
   return EntryOffset;
 }
@@ -321,8 +321,8 @@ void DebugRangeListsSectionWriter::finalizeSection() {
                            llvm::endianness::little);
 
   std::unique_ptr<DebugBufferVector> Header = getDWARF5Header(
-      {static_cast<uint32_t>(SizeOfArraySection + CUBodyBuffer.get()->size()),
-       5, 8, 0, static_cast<uint32_t>(RangeEntries.size())});
+      {static_cast<uint32_t>(SizeOfArraySection + CUBodyBuffer->size()), 5, 8,
+       0, static_cast<uint32_t>(RangeEntries.size())});
   *RangesStream << *Header;
   *RangesStream << *CUArrayBuffer;
   *RangesStream << *CUBodyBuffer;
@@ -747,8 +747,8 @@ void DebugLoclistWriter::finalizeDWARF5(DIEBuilder &DIEBldr, DIE &Die) {
         llvm::endianness::little);
 
   std::unique_ptr<DebugBufferVector> Header = getDWARF5Header(
-      {static_cast<uint32_t>(SizeOfArraySection + LocBodyBuffer.get()->size()),
-       5, 8, 0, NumberOfEntries});
+      {static_cast<uint32_t>(SizeOfArraySection + LocBodyBuffer->size()), 5, 8,
+       0, NumberOfEntries});
   *LocStream << *Header;
   *LocStream << *LocArrayBuffer;
   *LocStream << *LocBodyBuffer;
diff --git a/bolt/lib/Core/DebugNames.cpp b/bolt/lib/Core/DebugNames.cpp
index 82cabe689eb14..aa1c8f3d42d4b 100644
--- a/bolt/lib/Core/DebugNames.cpp
+++ b/bolt/lib/Core/DebugNames.cpp
@@ -648,8 +648,8 @@ void DWARF5AcceleratorTable::writeEntries() {
         if (const auto Iter = EntryRelativeOffsets.find(*ParentOffset);
             Iter != EntryRelativeOffsets.end()) {
           const uint64_t PatchOffset = Entry->getPatchOffset();
-          uint32_t *Ptr = reinterpret_cast<uint32_t *>(
-              &EntriesBuffer.get()->data()[PatchOffset]);
+          uint32_t *Ptr =
+              reinterpret_cast<uint32_t *>(&EntriesBuffer->data()[PatchOffset]);
           *Ptr = Iter->second;
         } else {
           BC.errs() << "BOLT-WARNING: [internal-dwarf-warning]: Could not find "
diff --git a/bolt/lib/Core/ParallelUtilities.cpp b/bolt/lib/Core/ParallelUtilities.cpp
index 3a8a7dc0aee7b..0f13aa11a5fb1 100644
--- a/bolt/lib/Core/ParallelUtilities.cpp
+++ b/bolt/lib/Core/ParallelUtilities.cpp
@@ -103,7 +103,7 @@ inline unsigned estimateTotalCost(const BinaryContext &BC,
 } // namespace
 
 ThreadPoolInterface &getThreadPool(const unsigned ThreadsCount) {
-  if (ThreadPoolPtr.get())
+  if (ThreadPoolPtr)
     return *ThreadPoolPtr;
 
   if (ThreadsCount > 1)
diff --git a/bolt/lib/Passes/AsmDump.cpp b/bolt/lib/Passes/AsmDump.cpp
index ffc920af1c41f..c0be0116f20fb 100644
--- a/bolt/lib/Passes/AsmDump.cpp
+++ b/bolt/lib/Passes/AsmDump.cpp
@@ -175,7 +175,7 @@ void dumpFunction(const BinaryFunction &BF) {
       // Dump pseudo instructions (CFI)
       if (BC.MIB->isPseudo(Instr)) {
         if (BC.MIB->isCFI(Instr))
-          dumpCFI(BF, Instr, *MAP.get());
+          dumpCFI(BF, Instr, *MAP);
         continue;
       }
 
@@ -227,7 +227,7 @@ void dumpFunction(const BinaryFunction &BF) {
   OS << "# Jump tables\n";
   // Print all jump tables.
   for (auto &JTI : BF.jumpTables())
-    dumpJumpTableSymbols(OS, JTI.second, *MAP.get(), LastSection);
+    dumpJumpTableSymbols(OS, JTI.second, *MAP, LastSection);
 
   OS << "# BinaryData\n";
   // Print data references.
diff --git a/bolt/lib/Passes/RetpolineInsertion.cpp b/bolt/lib/Passes/RetpolineInsertion.cpp
index f8702893a222b..98e5a8fba6454 100644
--- a/bolt/lib/Passes/RetpolineInsertion.cpp
+++ b/bolt/lib/Passes/RetpolineInsertion.cpp
@@ -78,7 +78,7 @@ BinaryFunction *createNewRetpoline(BinaryContext &BC,
                                    const IndirectBranchInfo &BrInfo,
                                    bool R11Available) {
   auto &MIB = *BC.MIB;
-  MCContext &Ctx = *BC.Ctx.get();
+  MCContext &Ctx = *BC.Ctx;
   LLVM_DEBUG(dbgs() << "BOLT-DEBUG: Creating a new retpoline function["
                     << RetpolineTag << "]\n");
 
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 308881081321a..9c9bdefe08429 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -500,13 +500,13 @@ static void emitDWOBuilder(const std::string &DWOName,
          SplitCU.getContext().dwo_info_section_units()) {
       if (!CU->isTypeUnit())
         continue;
-      emitUnit(DWODIEBuilder, *Streamer, *CU.get());
+      emitUnit(DWODIEBuilder, *Streamer, *CU);
     }
     emitUnit(DWODIEBuilder, *Streamer, SplitCU);
   } else {
     for (std::unique_ptr<llvm::DWARFUnit> &CU :
          SplitCU.getContext().dwo_compile_units())
-      emitUnit(DWODIEBuilder, *Streamer, *CU.get());
+      emitUnit(DWODIEBuilder, *Streamer, *CU);
 
     // emit debug_types sections for dwarf4
     for (DWARFUnit *CU : DWODIEBuilder.getDWARF4TUVector())
@@ -685,8 +685,8 @@ void DWARFRewriter::updateDebugInfo() {
     DebugLocWriter &DebugLocWriter =
         *LocListWritersByCU[LocListWritersIndexByCU[Unit.getOffset()]].get();
     DebugRangesSectionWriter &RangesSectionWriter =
-        Unit.getVersion() >= 5 ? *RangeListsSectionWriter.get()
-                               : *LegacyRangesSectionWriter.get();
+        Unit.getVersion() >= 5 ? *RangeListsSectionWriter
+                               : *LegacyRangesSectionWriter;
     DebugAddrWriter &AddressWriter =
         *AddressWritersByCU[Unit.getOffset()].get();
     if (Unit.getVersion() >= 5)
@@ -698,7 +698,7 @@ void DWARFRewriter::updateDebugInfo() {
       if (!SplitCU)
         StrOffstsWriter->finalizeSection(Unit, DIEBlder);
     } else if (SplitCU) {
-      RangesBase = LegacyRangesSectionWriter.get()->getSectionOffset();
+      RangesBase = LegacyRangesSectionWriter->getSectionOffset();
     }
 
     updateUnitDebugInfo(Unit, DIEBlder, DebugLocWriter, RangesSectionWriter,
@@ -750,7 +750,7 @@ void DWARFRewriter::updateDebugInfo() {
       auto DWODIEBuilderPtr = std::make_unique<DIEBuilder>(
           BC, &(**SplitCU).getContext(), DebugNamesTable, CU);
       DIEBuilder &DWODIEBuilder =
-          *DWODIEBuildersByCU.emplace_back(std::move(DWODIEBuilderPtr)).get();
+          *DWODIEBuildersByCU.emplace_back(std::move(DWODIEBuilderPtr));
       if (CU->getVersion() >= 5)
         StrOffstsWriter->finalizeSection(*CU, DIEBlder);
       // Important to capture CU and SplitCU by value here, otherwise when the
@@ -1403,7 +1403,7 @@ void DWARFRewriter::updateLineTableOffsets(const MCAssembler &Asm) {
       continue;
 
     std::optional<uint64_t> StmtOffset =
-        GetStatementListValue(CU.get()->getUnitDIE());
+        GetStatementListValue(CU->getUnitDIE());
     if (!StmtOffset)
       continue;
 
@@ -1479,13 +1479,13 @@ CUOffsetMap DWARFRewriter::finalizeTypeSections(DIEBuilder &DIEBlder,
   for (std::unique_ptr<llvm::DWARFUnit> &CU : BC.DwCtx->info_section_units()) {
     if (!CU->isTypeUnit())
       continue;
-    updateLineTable(*CU.get());
-    emitUnit(DIEBlder, Streamer, *CU.get());
+    updateLineTable(*CU);
+    emitUnit(DIEBlder, Streamer, *CU);
     uint32_t StartOffset = CUOffset;
-    DIE *UnitDIE = DIEBlder.getUnitDIEbyUnit(*CU.get());
-    CUOffset += CU.get()->getHeaderSize();
+    DIE *UnitDIE = DIEBlder.getUnitDIEbyUnit(*CU);
+    CUOffset += CU->getHeaderSize();
     CUOffset += UnitDIE->getSize();
-    CUMap[CU.get()->getOffset()] = {StartOffset, CUOffset - StartOffset - 4};
+    CUMap[CU->getOffset()] = {StartOffset, CUOffset - StartOffset - 4};
   }
 
   // Emit Type Unit of DWARF 4 to .debug_type section
diff --git a/bolt/lib/Rewrite/MachORewriteInstance.cpp b/bolt/lib/Rewrite/MachORewriteInstance.cpp
index 335b7b42ddde5..a1c2cef601e43 100644
--- a/bolt/lib/Rewrite/MachORewriteInstance.cpp
+++ b/bolt/lib/Rewrite/MachORewriteInstance.cpp
@@ -108,21 +108,21 @@ Error MachORewriteInstance::setProfile(StringRef Filename) {
 void MachORewriteInstance::preprocessProfileData() {
   if (!ProfileReader)
     return;
-  if (Error E = ProfileReader->preprocessProfile(*BC.get()))
+  if (Error E = ProfileReader->preprocessProfile(*BC))
     report_error("cannot pre-process profile", std::move(E));
 }
 
 void MachORewriteInstance::processProfileDataPreCFG() {
   if (!ProfileReader)
     return;
-  if (Error E = ProfileReader->readProfilePreCFG(*BC.get()))
+  if (Error E = ProfileReader->readProfilePreCFG(*BC))
     report_error("cannot read profile pre-CFG", std::move(E));
 }
 
 void MachORewriteInstance::processProfileData() {
   if (!ProfileReader)
     return;
-  if (Error E = ProfileReader->readProfile(*BC.get()))
+  if (Error E = ProfileReader->readProfile(*BC))
     report_error("cannot read profile", std::move(E));
 }
 
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 1c24200059035..520bd67f7e5b1 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -3280,7 +3280,7 @@ void RewriteInstance::preprocessProfileData() {
     ProfileReader->setBAT(&*BAT);
   }
 
-  if (Error E = ProfileReader->preprocessProfile(*BC.get()))
+  if (Error E = ProfileReader->preprocessProfile(*BC))
     report_error("cannot pre-process profile", std::move(E));
 
   if (!BC->hasSymbolsWithFileName() && ProfileReader->hasLocalsWithFileName() &&
@@ -3335,7 +3335,7 @@ void RewriteInstance::processProfileDataPreCFG() {
   NamedRegionTimer T("processprofile-precfg", "process profile data pre-CFG",
                      TimerGroupName, TimerGroupDesc, opts::TimeRewrite);
 
-  if (Error E = ProfileReader->readProfilePreCFG(*BC.get()))
+  if (Error E = ProfileReader->readProfilePreCFG(*BC))
     report_error("cannot read profile pre-CFG", std::move(E));
 }
 
@@ -3346,7 +3346,7 @@ void RewriteInstance::processProfileData() {
   NamedRegionTimer T("processprofile", "process profile data", TimerGroupName,
                      TimerGroupDesc, opts::TimeRewrite);
 
-  if (Error E = ProfileReader->readProfile(*BC.get()))
+  if (Error E = ProfileReader->readProfile(*BC))
     report_error("cannot read profile", std::move(E));
 
   if (opts::PrintProfile || opts::PrintAll) {
diff --git a/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp b/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
index 8f5719e84ecea..98852ee691ceb 100644
--- a/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
+++ b/bolt/lib/RuntimeLibs/RuntimeLibrary.cpp
@@ -96,7 +96,7 @@ void RuntimeLibrary::loadLibrary(StringRef LibPath, BOLTLinker &Linker,
 
   if (Magic == file_magic::archive) {
     Error Err = Error::success();
-    object::Archive Archive(B.get()->getMemBufferRef(), Err);
+    object::Archive Archive(B->getMemBufferRef(), Err);
     for (const object::Archive::Child &C : Archive.children(Err)) {
       std::unique_ptr<object::Binary> Bin = cantFail(C.getAsBinary());
       if (object::ObjectFile *Obj = dyn_cast<object::ObjectFile>(&*Bin))
@@ -105,9 +105,9 @@ void RuntimeLibrary::loadLibrary(StringRef LibPath, BOLTLinker &Linker,
     check_error(std::move(Err), B->getBufferIdentifier());
   } else if (Magic == file_magic::elf_relocatable ||
              Magic == file_magic::elf_shared_object) {
-    std::unique_ptr<object::ObjectFile> Obj = cantFail(
-        object::ObjectFile::createObjectFile(B.get()->getMemBufferRef()),
-        "error creating in-memory object");
+    std::unique_ptr<object::ObjectFile> Obj =
+        cantFail(object::ObjectFile::createObjectFile(B->getMemBufferRef()),
+                 "error creating in-memory object");
     Linker.loadObject(Obj->getMemoryBufferRef(), MapSections);
   } else {
     errs() << "BOLT-ERROR: unrecognized library format: " << LibPath << "\n";
diff --git a/bolt/lib/Target/AArch64/AArch64MCSymbolizer.h b/bolt/lib/Target/AArch64/AArch64MCSymbolizer.h
index 859c57c7a2b55..153806a67f62c 100644
--- a/bolt/lib/Target/AArch64/AArch64MCSymbolizer.h
+++ b/bolt/lib/Target/AArch64/AArch64MCSymbolizer.h
@@ -33,7 +33,7 @@ class AArch64MCSymbolizer : public MCSymbolizer {
 
 public:
   AArch64MCSymbolizer(BinaryFunction &Function, bool CreateNewSymbols = true)
-      : MCSymbolizer(*Function.getBinaryContext().Ctx.get(), nullptr),
+      : MCSymbolizer(*Function.getBinaryContext().Ctx, nullptr),
         Function(Function), CreateNewSymbols(CreateNewSymbols) {}
 
   AArch64MCSymbolizer(const AArch64MCSymbolizer &) = delete;
diff --git a/bolt/lib/Target/X86/X86MCSymbolizer.h b/bolt/lib/Target/X86/X86MCSymbolizer.h
index 189941e949e33..c9c475b237b82 100644
--- a/bolt/lib/Target/X86/X86MCSymbolizer.h
+++ b/bolt/lib/Target/X86/X86MCSymbolizer.h
@@ -25,7 +25,7 @@ class X86MCSymbolizer : public MCSymbolizer {
 
 public:
   X86MCSymbolizer(BinaryFunction &Function, bool CreateNewSymbols = true)
-      : MCSymbolizer(*Function.getBinaryContext().Ctx.get(), nullptr),
+      : MCSymbolizer(*Function.getBinaryContext().Ctx, nullptr),
         Function(Function), CreateNewSymbols(CreateNewSymbols) {}
 
   X86MCSymbolizer(const X86MCSymbolizer &) = delete;
diff --git a/bolt/unittests/Core/BinaryContext.cpp b/bolt/unittests/Core/BinaryContext.cpp
index ba3e4ce099347..3fa0851d01e5a 100644
--- a/bolt/unittests/Core/BinaryContext.cpp
+++ b/bolt/unittests/Core/BinaryContext.cpp
@@ -53,8 +53,8 @@ struct BinaryContextTester : public testing::TestWithParam<Triple::ArchType> {
     Relocation::Arch = ObjFile->makeTriple().getArch();
     BC = cantFail(BinaryContext::createBinaryContext(
         ObjFile->makeTriple(), std::make_shared<orc::SymbolStringPool>(),
-        ObjFile->getFileName(), nullptr, true,
-        DWARFContext::create(*ObjFile.get()), {llvm::outs(), llvm::errs()}));
+        ObjFile->getFileName(), nullptr, true, DWARFContext::create(*ObjFile),
+        {llvm::outs(), llvm::errs()}));
     ASSERT_FALSE(!BC);
   }
 
diff --git a/bolt/unittests/Core/MCPlusBuilder.cpp b/bolt/unittests/Core/MCPlusBuilder.cpp
index 7016dec0e3574..af4cc9da9c9f4 100644
--- a/bolt/unittests/Core/MCPlusBuilder.cpp
+++ b/bolt/unittests/Core/MCPlusBuilder.cpp
@@ -64,8 +64,8 @@ struct MCPlusBuilderTester : public testing::TestWithParam<Triple::ArchType> {
     Relocation::Arch = ObjFile->makeTriple().getArch();
     BC = cantFail(BinaryContext::createBinaryContext(
         ObjFile->makeTriple(), std::make_shared<orc::SymbolStringPool>(),
-        ObjFile->getFileName(), nullptr, true,
-        DWARFContext::create(*ObjFile.get()), {llvm::outs(), llvm::errs()}));
+        ObjFile->getFileName(), nullptr, true, DWARFContext::create(*ObjFile),
+        {llvm::outs(), llvm::errs()}));
     ASSERT_FALSE(!BC);
     BC->initializeTarget(std::unique_ptr<MCPlusBuilder>(
         createMCPlusBuilder(GetParam(), BC->MIA.get(), BC->MII.get(),
diff --git a/bolt/unittests/Core/MemoryMaps.cpp b/bolt/unittests/Core/MemoryMaps.cpp
index 2e1bc4d280aed..b0cab5431bdd3 100644
--- a/bolt/unittests/Core/MemoryMaps.cpp
+++ b/bolt/unittests/Core/MemoryMaps.cpp
@@ -63,8 +63,8 @@ struct MemoryMapsTester : public testing::TestWithParam<Triple::ArchType> {
     Relocation::Arch = ObjFile->makeTriple().getArch();
     BC = cantFail(BinaryContext::createBinaryContext(
         ObjFile->makeTriple(), std::make_shared<orc::SymbolStringPool>(),
-        ObjFile->getFileName(), nullptr, true,
-        DWARFContext::create(*ObjFile.get()), {llvm::outs(), llvm::errs()}));
+        ObjFile->getFileName(), nullptr, true, DWARFContext::create(*ObjFile),
+        {llvm::outs(), llvm::errs()}));
     ASSERT_FALSE(!BC);
   }
 



More information about the llvm-commits mailing list