summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-04-22 19:47:26 +0000
committerRui Ueyama <ruiu@google.com>2014-04-22 19:47:26 +0000
commit7ff1eb23a2f2da122ede0b61374df12c8058fb82 (patch)
tree02235775b84b489e7ab54838646551ec24acb36b /include
parent8c8fae7268121d10ae4203062fc3ffe79759dbd3 (diff)
downloadllvm-7ff1eb23a2f2da122ede0b61374df12c8058fb82.tar.gz
llvm-7ff1eb23a2f2da122ede0b61374df12c8058fb82.tar.bz2
llvm-7ff1eb23a2f2da122ede0b61374df12c8058fb82.tar.xz
No need to check condition after grow()
r206916 was not logically the same as the previous code because the goto statements did not create loop. This should be the same as the previous code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/SmallVector.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h
index 2409ecf9b6..1afa4a21b0 100644
--- a/include/llvm/ADT/SmallVector.h
+++ b/include/llvm/ADT/SmallVector.h
@@ -223,14 +223,14 @@ protected:
public:
void push_back(const T &Elt) {
- while (this->EndX >= this->CapacityX)
+ if (this->EndX >= this->CapacityX)
this->grow();
::new ((void*) this->end()) T(Elt);
this->setEnd(this->end()+1);
}
void push_back(T &&Elt) {
- while (this->EndX >= this->CapacityX)
+ if (this->EndX >= this->CapacityX)
this->grow();
::new ((void*) this->end()) T(::std::move(Elt));
this->setEnd(this->end()+1);
@@ -327,7 +327,7 @@ protected:
}
public:
void push_back(const T &Elt) {
- while (this->EndX >= this->CapacityX)
+ if (this->EndX >= this->CapacityX)
this->grow();
memcpy(this->end(), &Elt, sizeof(T));
this->setEnd(this->end()+1);
@@ -481,7 +481,7 @@ public:
assert(I >= this->begin() && "Insertion iterator is out of bounds.");
assert(I <= this->end() && "Inserting past the end of the vector.");
- while (this->EndX >= this->CapacityX) {
+ if (this->EndX >= this->CapacityX) {
size_t EltNo = I-this->begin();
this->grow();
I = this->begin()+EltNo;
@@ -511,7 +511,7 @@ public:
assert(I >= this->begin() && "Insertion iterator is out of bounds.");
assert(I <= this->end() && "Inserting past the end of the vector.");
- while (this->EndX >= this->CapacityX) {
+ if (this->EndX >= this->CapacityX) {
size_t EltNo = I-this->begin();
this->grow();
I = this->begin()+EltNo;