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

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to