[llvm] [BOLT][DWARF][NFC] Remove unnecessary SectionOffset (PR #97841)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 10:59:09 PDT 2024


================
@@ -166,15 +165,20 @@ uint64_t DebugRangesSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
   // Reading the SectionOffset and updating it should be atomic to guarantee
   // unique and correct offsets in patches.
   std::lock_guard<std::mutex> Lock(WriterMutex);
-  const uint32_t EntryOffset = SectionOffset;
-  SectionOffset += writeAddressRanges(*RangesStream.get(), Ranges);
+  const uint32_t EntryOffset = RangesBuffer->size();
+  writeAddressRanges(*RangesStream.get(), Ranges);
 
   return EntryOffset;
 }
 
 uint64_t DebugRangesSectionWriter::getSectionOffset() {
   std::lock_guard<std::mutex> Lock(WriterMutex);
-  return SectionOffset;
+  return RangesBuffer->size();
+}
+
+void DebugRangesSectionWriter::appendToRangeBuffer(
+    const DebugBufferVector &CUBuffer) {
+  *RangesStream << CUBuffer;
----------------
aaupov wrote:

This looks duplicated and the function below still sets SectionOffset - can you please check?

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


More information about the llvm-commits mailing list