aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringRefTest.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-12-07 16:20:18 -0800
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-12-08 13:57:48 -0800
commitca451d3fa40ebbd35c702ba698e9e5f29e8ed69b (patch)
treed51b6a792bb057aef2a3ff2f953636de08ea559c /llvm/unittests/ADT/StringRefTest.cpp
parent1225c8a06103e029a4b2ebb782a175ab1e011cbe (diff)
downloadllvm-ca451d3fa40ebbd35c702ba698e9e5f29e8ed69b.zip
llvm-ca451d3fa40ebbd35c702ba698e9e5f29e8ed69b.tar.gz
llvm-ca451d3fa40ebbd35c702ba698e9e5f29e8ed69b.tar.bz2
ADT: Add SmallVectorImpl::truncate() to replace uses of set_size()
Add `SmallVectorImpl::truncate()`, a variant of `resize()` that cannot increase the size. - Compared to `resize()`, this has no code path for growing the allocation and can be better optimized. - Compared to `set_size()`, this formally calls destructors, and does not skip any constructors. - Compared to `pop_back_n()`, this takes the new desired size, which in many contexts is more intuitive than the number of elements to remove. The immediate motivation is to pair this with `resize_for_overwrite()` to remove uses of `set_size()`, which can then be made private. Differential Revision: https://reviews.llvm.org/D115383
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
0 files changed, 0 insertions, 0 deletions