[llvm] [BOLT][DWARF][NFC] Expose DebugStrOffsetsWriter::clear (PR #82548)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 16:43:20 PST 2024
https://github.com/ayermolo updated https://github.com/llvm/llvm-project/pull/82548
>From 0f6a77a893639b6affb8832ad997f1611c75f367 Mon Sep 17 00:00:00 2001
From: Alexander Yermolovich <ayermolo at meta.com>
Date: Wed, 21 Feb 2024 14:46:28 -0800
Subject: [PATCH] [BOLT][DWARF] Refactor DebugStrOffsetsWriter
Refactored clearning data structures in DebugStrOffsetsWriter into clear()
function and made initialize() public. This is for
https://github.com/llvm/llvm-project/pull/81062.
---
bolt/include/bolt/Core/DebugData.h | 8 +++++++-
bolt/lib/Core/DebugData.cpp | 3 +--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/bolt/include/bolt/Core/DebugData.h b/bolt/include/bolt/Core/DebugData.h
index 31a636ba2ce653..48b813a4ca11fe 100644
--- a/bolt/include/bolt/Core/DebugData.h
+++ b/bolt/include/bolt/Core/DebugData.h
@@ -450,10 +450,16 @@ class DebugStrOffsetsWriter {
return std::move(StrOffsetsBuffer);
}
-private:
/// Initializes Buffer and Stream.
void initialize(DWARFUnit &Unit);
+ /// Clear data.
+ void clear() {
+ IndexToAddressMap.clear();
+ StrOffsets.clear();
+ }
+
+private:
std::unique_ptr<DebugStrOffsetsBufferVector> StrOffsetsBuffer;
std::unique_ptr<raw_svector_ostream> StrOffsetsStream;
std::map<uint32_t, uint32_t> IndexToAddressMap;
diff --git a/bolt/lib/Core/DebugData.cpp b/bolt/lib/Core/DebugData.cpp
index 2942f0b9190fa2..a75016ede3090d 100644
--- a/bolt/lib/Core/DebugData.cpp
+++ b/bolt/lib/Core/DebugData.cpp
@@ -909,8 +909,7 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
}
StrOffsetSectionWasModified = false;
- IndexToAddressMap.clear();
- StrOffsets.clear();
+ clear();
}
void DebugStrWriter::create() {
More information about the llvm-commits
mailing list