Skip to content

Commit bc41b0a

Browse files
authored
[lldb][Symtab][NFCI] Replace vector::swap with shrink_to_fit (llvm#70918)
Replaces the old idiom (of swapping the container to shrink it) with the newer STL alternative. Similar transition in LLDB was done in: https://reviews.llvm.org/D47492
1 parent ba31ed4 commit bc41b0a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lldb/source/Symbol/Symtab.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,7 @@ void Symtab::Finalize() {
10101010
// Calculate the size of symbols inside InitAddressIndexes.
10111011
InitAddressIndexes();
10121012
// Shrink to fit the symbols so we don't waste memory
1013-
if (m_symbols.capacity() > m_symbols.size()) {
1014-
collection new_symbols(m_symbols.begin(), m_symbols.end());
1015-
m_symbols.swap(new_symbols);
1016-
}
1013+
m_symbols.shrink_to_fit();
10171014
SaveToCache();
10181015
}
10191016

0 commit comments

Comments
 (0)