[llvm-commits] patch: SmallVector fix outstanding issue via unit test

Ryan Flynn parseerror at gmail.com
Wed Jul 8 17:36:38 PDT 2009


the copy constructor for SmallVector.resize(N) was being called N+1 times.
the unit test was modified to account for this 'unexplained' behavior.

resize() is creating a temporary object of type T for the sole purpose
of using it as a copy constructor for elements via construct_range()

i created an overloaded version of construct_range() omitting the T obj
parameter and call T's default constructor instead, a more efficient
equivalent to copy-constructing an object which is itself default-
constructed.

also removed temporary variable 'E' from SmallVector operator==, it is
equivalent to member 'End' which already exists.

also added 'const' to SmallVector's {construct,destruct}_range()
method parameters where possible.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SmallVector-fix-unittest-and-optimize.patch
Type: text/x-diff
Size: 1927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090708/43083531/attachment.patch>


More information about the llvm-commits mailing list