[llvm] [BOLT][DWARF][NFC] Refactor address writers (PR #98094)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 17:40:22 PDT 2024


================
@@ -1628,6 +1634,16 @@ void DWARFRewriter::finalizeCompileUnits(DIEBuilder &DIEBlder,
                                          CUOffsetMap &CUMap,
                                          const std::list<DWARFUnit *> &CUs) {
   for (DWARFUnit *CU : CUs) {
+    auto AddressWriterIterator = AddressWritersByCU.find(CU->getOffset());
+    assert(AddressWriterIterator != AddressWritersByCU.end() &&
+           "AddressWriter does not exist for CU");
+    auto &AddressWriter = AddressWriterIterator->second;
+    AddressWriter->update();
+    AddressWriter->updateAddrBase(DIEBlder, *CU, AddrWriter->finalize().size());
+    if (AddressWriter->isInitialized()) {
+      AddressSectionBuffer AddressSectionContents = AddressWriter->finalize();
+      AddrWriter->appendToAddressBuffer(AddressSectionContents);
----------------
ayermolo wrote:

Maybe rename AddrWriter to something like FinalAddrWriter or CombinedAddrWriter.

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


More information about the llvm-commits mailing list