diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-11-19 17:15:34 -0800 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2020-11-19 17:25:36 -0800 |
commit | 40e877264dc5bd9a025bc1fc0f01fb69a3f3cdc2 (patch) | |
tree | 7457e2030fbebfd46b3b1732c8427c798ed5588c /llvm/unittests/ADT/SmallVectorTest.cpp | |
parent | f7f0fe6184807a7085fee9e57ae47bc3e2617cdc (diff) | |
download | llvm-40e877264dc5bd9a025bc1fc0f01fb69a3f3cdc2.zip llvm-40e877264dc5bd9a025bc1fc0f01fb69a3f3cdc2.tar.gz llvm-40e877264dc5bd9a025bc1fc0f01fb69a3f3cdc2.tar.bz2 |
ADT: Weaken SmallVector::resize assertion from 5abf76fbe37380874a88cc9aa02164800e4e10f3
There's no need to check for reference invalidation when
`SmallVector::resize` is shrinking; the parameter isn't accessed.
Differential Revision: https://reviews.llvm.org/D91832
Diffstat (limited to 'llvm/unittests/ADT/SmallVectorTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/SmallVectorTest.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp index 1a61d23..74b6561 100644 --- a/llvm/unittests/ADT/SmallVectorTest.cpp +++ b/llvm/unittests/ADT/SmallVectorTest.cpp @@ -1051,9 +1051,13 @@ TYPED_TEST(SmallVectorReferenceInvalidationTest, PushBackMoved) { TYPED_TEST(SmallVectorReferenceInvalidationTest, Resize) { auto &V = this->V; (void)V; + int N = this->NumBuiltinElts(V); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST - EXPECT_DEATH(V.resize(2, V.back()), this->AssertionMessage); + EXPECT_DEATH(V.resize(N + 1, V.back()), this->AssertionMessage); #endif + + // No assertion when shrinking, since the parameter isn't accessed. + V.resize(N - 1, V.back()); } TYPED_TEST(SmallVectorReferenceInvalidationTest, Append) { |