aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/SmallVector.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-09-02 21:55:03 +0000
committerJohn McCall <rjmccall@apple.com>2010-09-02 21:55:03 +0000
commitd2f7d53a421d34b3e0fb7fbb82dd69ec651c8067 (patch)
treec92f5dd9011c0d82d09f0fa599ba91e59576c6ab /lib/Support/SmallVector.cpp
parent4c81494635f176877d26bdf1c3ba9663b047f21d (diff)
downloadexternal_llvm-d2f7d53a421d34b3e0fb7fbb82dd69ec651c8067.zip
external_llvm-d2f7d53a421d34b3e0fb7fbb82dd69ec651c8067.tar.gz
external_llvm-d2f7d53a421d34b3e0fb7fbb82dd69ec651c8067.tar.bz2
After some discussion with djg, teach SmallVector to grow from a zero
capacity and remove the workaround in SmallVector<T,0>. There are some theoretical benefits to a N->2N+1 growth policy anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/SmallVector.cpp')
-rw-r--r--lib/Support/SmallVector.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/SmallVector.cpp b/lib/Support/SmallVector.cpp
index 2e17af8..a89f149 100644
--- a/lib/Support/SmallVector.cpp
+++ b/lib/Support/SmallVector.cpp
@@ -18,7 +18,7 @@ using namespace llvm;
/// on POD-like datatypes and is out of line to reduce code duplication.
void SmallVectorBase::grow_pod(size_t MinSizeInBytes, size_t TSize) {
size_t CurSizeBytes = size_in_bytes();
- size_t NewCapacityInBytes = 2 * capacity_in_bytes();
+ size_t NewCapacityInBytes = 2 * capacity_in_bytes() + TSize; // Always grow.
if (NewCapacityInBytes < MinSizeInBytes)
NewCapacityInBytes = MinSizeInBytes;