[llvm] [BOLT][DWARF][NFC] Split DIEBuilder::finish (PR #101244)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 17:15:49 PDT 2024


================
@@ -761,10 +761,18 @@ void DWARFRewriter::updateDebugInfo() {
               : std::optional<std::string>(opts::DwarfOutputPath.c_str());
       std::string DWOName = DIEBlder.updateDWONameCompDir(
           *StrOffstsWriter, *StrWriter, *CU, DwarfOutputPath, std::nullopt);
+      auto DWODIEBuilderPtr = std::make_unique<DIEBuilder>(
+          BC, &(**SplitCU).getContext(), DebugNamesTable, CU);
+      DWODIEBuildersByCU.emplace_back(std::move(DWODIEBuilderPtr));
+      DIEBuilder &DWODIEBuilder = *DWODIEBuildersByCU.back().get();
       if (CU->getVersion() >= 5)
         StrOffstsWriter->finalizeSection(*CU, DIEBlder);
       processSplitCU(*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
-                     AddressWriter, DWOName, DwarfOutputPath);
+                     AddressWriter, DWOName, DwarfOutputPath, DWODIEBuilder);
+    }
+    for (std::unique_ptr<DIEBuilder> &DWODIEBuilderPtr : DWODIEBuildersByCU) {
+      DIEBuilder &DWODIEBuilder = *DWODIEBuilderPtr.get();
----------------
ayermolo wrote:

You can just do DWODIEBuilderPtr->updateDebugNamesTable()

https://github.com/llvm/llvm-project/pull/101244


More information about the llvm-commits mailing list