diff options
author | John McCall <rjmccall@apple.com> | 2010-09-02 21:55:03 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-09-02 21:55:03 +0000 |
commit | 2a9a2dba4c02e7eea3aeba2be5dc1fc377d5aa5c (patch) | |
tree | c92f5dd9011c0d82d09f0fa599ba91e59576c6ab /lib/Support/SmallVector.cpp | |
parent | 55945607667e71dc1d4d32cffa60e3b817f2f3ef (diff) |
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.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/SmallVector.cpp b/lib/Support/SmallVector.cpp index 2e17af8641..a89f149576 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; |