Skip to content

Commit 004c197

Browse files
authored
[BOLT][DWARF][NFC] Expose DebugStrOffsetsWriter::clear (#82548)
Refactored cod that clears data-structures in DebugStrOffsetsWriter into clear() function and made initialize() public. This is for #81062.
1 parent 640e781 commit 004c197

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

bolt/include/bolt/Core/DebugData.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,16 @@ class DebugStrOffsetsWriter {
450450
return std::move(StrOffsetsBuffer);
451451
}
452452

453-
private:
454453
/// Initializes Buffer and Stream.
455454
void initialize(DWARFUnit &Unit);
456455

456+
/// Clear data.
457+
void clear() {
458+
IndexToAddressMap.clear();
459+
StrOffsets.clear();
460+
}
461+
462+
private:
457463
std::unique_ptr<DebugStrOffsetsBufferVector> StrOffsetsBuffer;
458464
std::unique_ptr<raw_svector_ostream> StrOffsetsStream;
459465
std::map<uint32_t, uint32_t> IndexToAddressMap;

bolt/lib/Core/DebugData.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,7 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
909909
}
910910

911911
StrOffsetSectionWasModified = false;
912-
IndexToAddressMap.clear();
913-
StrOffsets.clear();
912+
clear();
914913
}
915914

916915
void DebugStrWriter::create() {

0 commit comments

Comments
 (0)