[Lldb-commits] [PATCH] D139379: [llvm][dwwarf] Change CU/TU index to 64-bit

Alexander Yermolovich via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 5 18:01:35 PST 2022


ayermolo added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h:115
+    private:
+      uint64_t Fields[2];
+
----------------
dblaikie wrote:
> How come this became an array? Rather than keeping it as two named fields?
So I can provide a generic set interface to be used in llvm-dwp and on bolt side. Maybe there is another way of doing it in c++? I also didn't want to make it overly complicated. 

// Write the offsets.
  writeIndexTable(Out, ContributionOffsets, IndexEntries,
                  DWARFUnitIndex::Entry::SectionContribution::OffsetFieldIndex);

  // Write the lengths.
  writeIndexTable(Out, ContributionOffsets, IndexEntries,
                  DWARFUnitIndex::Entry::SectionContribution::LengthFieldIndex);


```
void writeIndexTable(MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
                     const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
                     unsigned Index) {
  for (const auto &E : IndexEntries)
    for (size_t I = 0; I != std::size(E.second.Contributions); ++I)
      if (ContributionOffsets[I])
        Out.emitIntValue((E.second.Contributions[I].getField32(Index)), 4);
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139379/new/

https://reviews.llvm.org/D139379



More information about the lldb-commits mailing list