summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/SmallVectorTest.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2017-06-02 17:24:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2017-06-02 17:24:26 +0000
commitb6b42e018a808818df9ceecee57ff7b176a68a2b (patch)
treec8d69fef4ecd1a6e60aebf34602f016ef28ed32b /llvm/unittests/ADT/SmallVectorTest.cpp
parent0f02bbc6f4f24c71120147a11fc2edd27acc5b6d (diff)
downloadbcm5719-llvm-b6b42e018a808818df9ceecee57ff7b176a68a2b.tar.gz
bcm5719-llvm-b6b42e018a808818df9ceecee57ff7b176a68a2b.zip
Tidy up a bit of r304516, use SmallVector::assign rather than for loop
This might give a few better opportunities to optimize these to memcpy rather than loops - also a few minor cleanups (StringRef-izing, templating (to avoid std::function indirection), etc). The SmallVector::assign(iter, iter) could be improved with the use of SFINAE, but the (iter, iter) ctor and append(iter, iter) need it to and don't have it - so, workaround it for now rather than bothering with the added complexity. (also, as noted in the added FIXME, these assign ops could potentially be optimized better at least for non-trivially-copyable types) llvm-svn: 304566
Diffstat (limited to 'llvm/unittests/ADT/SmallVectorTest.cpp')
-rw-r--r--llvm/unittests/ADT/SmallVectorTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/SmallVectorTest.cpp b/llvm/unittests/ADT/SmallVectorTest.cpp
index 7367ad470e3..ca6391024f2 100644
--- a/llvm/unittests/ADT/SmallVectorTest.cpp
+++ b/llvm/unittests/ADT/SmallVectorTest.cpp
@@ -424,6 +424,16 @@ TYPED_TEST(SmallVectorTest, AssignTest) {
this->assertValuesInOrder(this->theVector, 2u, 77, 77);
}
+// Assign test
+TYPED_TEST(SmallVectorTest, AssignRangeTest) {
+ SCOPED_TRACE("AssignTest");
+
+ this->theVector.push_back(Constructable(1));
+ int arr[] = {1, 2, 3};
+ this->theVector.assign(std::begin(arr), std::end(arr));
+ this->assertValuesInOrder(this->theVector, 3u, 1, 2, 3);
+}
+
// Move-assign test
TYPED_TEST(SmallVectorTest, MoveAssignTest) {
SCOPED_TRACE("MoveAssignTest");
OpenPOWER on IntegriCloud