mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +00:00
blockfreq: Implement clear() explicitly
This was implicitly with copy assignment before, which fails to actually clear `std::vector<>`'s heap storage. Move assignment would work, but since MSVC can't imply those anyway, explicitly `clear()`-ing members makes more sense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206856 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aa866b9ae7
commit
153a265d01
@ -598,7 +598,11 @@ void Distribution::normalize() {
|
||||
}
|
||||
|
||||
void BlockFrequencyInfoImplBase::clear() {
|
||||
*this = BlockFrequencyInfoImplBase();
|
||||
// Swap with a default-constructed std::vector, since std::vector<>::clear()
|
||||
// does not actually clear heap storage.
|
||||
std::vector<FrequencyData>().swap(Freqs);
|
||||
std::vector<WorkingData>().swap(Working);
|
||||
std::vector<LoopData>().swap(PackagedLoops);
|
||||
}
|
||||
|
||||
/// \brief Clear all memory not needed downstream.
|
||||
|
Loading…
Reference in New Issue
Block a user