[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


================
@@ -405,11 +406,8 @@ void DebugAddrWriter::AddressForDWOCU::dump() {
 }
 uint32_t DebugAddrWriter::getIndexFromAddress(uint64_t Address, DWARFUnit &CU) {
   std::lock_guard<std::mutex> Lock(WriterMutex);
-  const uint64_t CUID = getCUID(CU);
-  if (!AddressMaps.count(CUID))
-    AddressMaps[CUID] = AddressForDWOCU();
-
-  AddressForDWOCU &Map = AddressMaps[CUID];
+  if (Map.begin() == Map.end())
+    Map.empty = true;
----------------
ayermolo wrote:

This whole Map.empty logic seems reversed to me. Once getIndexFromAddress is called, it should be false.
Also make it private and add setter/getter.

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


More information about the llvm-commits mailing list