Chris Lattner
7420a283cf
disable SmallVectorImpl's copy constructor. This prevents a class
...
of base class slicing bugs reported on irc
llvm-svn: 106028
2010-06-15 18:59:43 +00:00
Duncan Sands
78593d094f
Add includes to get ptrdiff_t. This is needed by gcc-4.6 which has
...
done some more header trimming, resulting in cstdef being included
by less header files.
llvm-svn: 105786
2010-06-10 10:13:58 +00:00
Benjamin Kramer
d62b29412b
Use realloc instead of malloc+memcpy when growing a POD SmallVector. A smart
...
realloc implementation can try to expand the allocated memory block in-place,
avoiding the copy.
llvm-svn: 105605
2010-06-08 11:44:30 +00:00
Jim Grosbach
90ca622864
remove trailing whitespace
...
llvm-svn: 105333
2010-06-02 17:45:54 +00:00
Torok Edwin
9ddbae859f
Fix PR6910.
...
Limit alignment in SmallVector 8, otherwise GCC assumes 16 byte alignment.
opetaror new, and malloc only return 8-byte aligned memory on 32-bit Linux,
which cause a crash if code is compiled with -O3 (or -ftree-vectorize) and some
SmallVector code is vectorized.
llvm-svn: 102604
2010-04-29 06:43:12 +00:00
Dan Gohman
8d37faa2f7
Fix SmallVector's insert to handle non-random-access iterators.
...
llvm-svn: 99633
2010-03-26 18:53:37 +00:00
Benjamin Kramer
d6a976f1da
Fix a name clash that was breaking MSVC builds.
...
llvm-svn: 98852
2010-03-18 19:34:06 +00:00
Dan Gohman
24dc8de2a9
Fix a bug found by inspection; in the __GNUC__ code, the alignment
...
doesn't apply to the type, only to the variable, so subsequent uses
of U which expect it to be aligned weren't actually aligned.
llvm-svn: 98843
2010-03-18 18:40:47 +00:00
Chris Lattner
2e0b4ea606
tabs -> spaces.
...
llvm-svn: 91622
2009-12-17 21:23:46 +00:00
Steve Naroff
cbffdd23ee
Fix Windows build breakage...
...
llvm-svn: 91617
2009-12-17 20:39:34 +00:00
Eric Christopher
9219efa49e
Fix unused variable warning.
...
llvm-svn: 91609
2009-12-17 19:07:19 +00:00
Daniel Dunbar
9d1eac0cdd
Fix one more missing this-> to placate that picky clang++.
...
llvm-svn: 91536
2009-12-16 11:38:03 +00:00
Chris Lattner
4b21831c59
fix more missing this->'s to placate clang++
...
llvm-svn: 91531
2009-12-16 09:17:12 +00:00
Chris Lattner
ccad2e6bd4
Fix a missing this-> that clang++ notices.
...
llvm-svn: 91530
2009-12-16 09:09:54 +00:00
Chris Lattner
eee37b7ba5
now that libsystem no longer uses SmallVector, we can move
...
SmallVectorBase::grow_pod out of line, finally satisfying PR3758.
llvm-svn: 91529
2009-12-16 08:44:24 +00:00
Chris Lattner
7ea3176b0c
factor out the grow() method for all pod implementations into one
...
common function. It is still an inline method, which will be fixed next.
llvm-svn: 91526
2009-12-16 08:34:40 +00:00
Chris Lattner
bc295111a1
pull destroy_range and uninitialized_copy up to the
...
SmallVectorTemplateBase class, which allows us to statically
dispatch on isPodLike instead of dynamically.
llvm-svn: 91523
2009-12-16 08:09:23 +00:00
Chris Lattner
c9b5e915c2
sink most of the meat in smallvector back from SmallVectorTemplateCommon
...
down into SmallVectorImpl. This requires sprinking a ton of this->'s in,
but gives us a place to factor.
llvm-svn: 91522
2009-12-16 08:05:48 +00:00
Chris Lattner
19ee3f5216
substantial refactoring of SmallVector, now most code is in SmallVectorTemplateCommon,
...
and there is a new SmallVectorTemplateBase class in between it and SmallVectorImpl.
SmallVectorTemplateBase can be specialized based on isPodLike.
llvm-svn: 91518
2009-12-16 06:55:45 +00:00
Chris Lattner
b3db396df3
a few improvements:
...
1. Use std::equal instead of reinventing it.
2. don't run dtors in destroy_range if element is pod-like.
3. Use isPodLike to decide between memcpy/uninitialized_copy
instead of is_class. isPodLike is more generous in some cases.
llvm-svn: 91427
2009-12-15 08:34:01 +00:00
Chris Lattner
f4e5966cf1
hoist the begin/end/capacity members and a few trivial methods
...
up into the non-templated SmallVectorBase class.
llvm-svn: 91426
2009-12-15 08:29:22 +00:00
Chris Lattner
f1a0d32b5f
improve isPodLike to know that all non-class types are pod.
...
llvm-svn: 91425
2009-12-15 07:40:44 +00:00
Gabor Greif
cc8681cea3
Clean up the minor mess I caused with removing iterator.h. I shall take care of 80-col violations and the FIXME later. (Thanks goodness that I live in another continent, so the monkeypox did not strike me :-)
...
llvm-svn: 80224
2009-08-27 06:41:46 +00:00
Daniel Dunbar
6812c0db35
Add SmallVector::{capacity,set_size}.
...
- These allow clients to make use of the extra elements in the vector which
have already been allocated, without requiring them to be value initialized.
llvm-svn: 79433
2009-08-19 17:48:28 +00:00
Jay Foad
c934b656f9
Tighten up the asserts in SmallVector::operator[]().
...
If this causes any new assertion failures that I didn't catch in
testing, the fix is usually to change "&v[0]" to "v.data()" for some
SmallVector v.
llvm-svn: 72221
2009-05-21 19:48:58 +00:00
Jay Foad
2ca356aa76
Implement new SmallVector::data() methods.
...
llvm-svn: 72209
2009-05-21 09:00:37 +00:00
Owen Anderson
dd6babaa30
Fix for PR3946, in which SmallVector could behave strangely in corner cases.
...
Patch by Peter Johnson.
llvm-svn: 69785
2009-04-22 07:16:54 +00:00
Chris Lattner
09cab2de98
fix overflow checks in SmallVector:
...
"The code was doing "if (End+NumInputs > Capacity) ...". If End is
close to 0xFFFFFFFF and NumInputs is large, it'll overflow, the
condition will come out false, and the vector won't grow to
accommodate the new elements, and the program will crash in memmove."
Patch by Jeffrey Yasskin!
llvm-svn: 68277
2009-04-02 03:06:26 +00:00
Chris Lattner
9c7b21d369
Fix PR3860 by correcting a predicate.
...
llvm-svn: 67473
2009-03-22 19:22:53 +00:00
Misha Brukman
380e3db1b4
Fixed lint errors:
...
* Alphabetized #includes
* Removed trailing whitespace
* Wrapped or shortened lines over 80 chars
llvm-svn: 65181
2009-02-20 22:20:18 +00:00
Dan Gohman
30770ee7b3
Add explicit keywords.
...
llvm-svn: 64915
2009-02-18 16:37:45 +00:00
Misha Brukman
da77da48f3
Removed trailing whitespace.
...
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Cedric Venet
b260c282bc
Add explicit this-> for some member function in templated base class.
...
These call are probably dependent but VS with /Za don't seems to think so. We need to help him.
llvm-svn: 60978
2008-12-13 10:55:13 +00:00
Chris Lattner
5a1d7ab054
add a new pop_back_val method which returns the value popped. This is
...
heretical from a STL standpoint, but is oh-so-useful for things that
can't throw exceptions when copied, like, well, everything in LLVM.
llvm-svn: 60587
2008-12-05 07:11:05 +00:00
Dan Gohman
440dea174f
Implement a SmallVector insert method that can insert multiple
...
copies of a value, and add several additional utilities to make
SmallVector better conform to the Container concept.
llvm-svn: 57616
2008-10-16 00:15:24 +00:00
Rafael Espindola
efe64e5f1e
Add bound checks in SmallVector
...
llvm-svn: 56432
2008-09-22 10:06:26 +00:00
Dan Gohman
3b4af81381
Fix SmallVector's size calculation so that a size of 0 is
...
handled correctly, and change a few SmallVector uses to use
size 0 to more clearly reflect their intent.
llvm-svn: 55181
2008-08-22 16:07:55 +00:00
Owen Anderson
b307df554d
Add a value_type typedef to SmallVector, to make it more compatible with STL adapters.
...
llvm-svn: 54819
2008-08-15 18:45:51 +00:00
Dan Gohman
3755664b6d
Remove unnecessary static_casts.
...
llvm-svn: 53181
2008-07-07 18:08:20 +00:00
Seo Sanghyeon
0b4c1205fb
Compilation fix
...
llvm-svn: 52950
2008-07-01 05:27:28 +00:00
Dan Gohman
081848d881
Make SmallVector's grow use memcpy in common cases
...
instead of std::uninitialized_copy, which uses memmove.
llvm-svn: 52928
2008-06-30 21:45:13 +00:00
Dan Gohman
06ca992a01
Use plain operator new instead of new char[].
...
llvm-svn: 52927
2008-06-30 21:33:02 +00:00
Dan Gohman
b67e96f3aa
Add an operator< for SmallVector.
...
llvm-svn: 51791
2008-05-30 22:37:47 +00:00
Anton Korobeynikov
f77142326f
For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h"
...
llvm-svn: 51687
2008-05-29 17:41:17 +00:00
Bill Wendling
1866fa680f
Remove warnings about unused parameters and shadowed variables.
...
llvm-svn: 51266
2008-05-19 20:15:12 +00:00
Evan Cheng
d9353009b7
Fix more -Wshorten-64-to-32 warnings.
...
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Chris Lattner
27fa922841
Remove the SmallVector ctor that converts from a SmallVectorImpl. This
...
conversion open the door for many nasty implicit conversion issues, and
can be easily solved by initializing with (V.begin(), V.end()) when
needed.
This patch includes many small cleanups for sdisel also.
llvm-svn: 50340
2008-04-28 06:44:42 +00:00
Chris Lattner
89339f3a90
restore the copy ctor in SmallVector. This fixes serious
...
errors I introduced in my last patch.
llvm-svn: 50338
2008-04-28 06:32:08 +00:00
Chris Lattner
a03159bc35
generalize SmallVector copy ctor, there is no requirement for
...
the initialization vector to have the same fixed size, just the
same element type.
llvm-svn: 50334
2008-04-28 06:01:06 +00:00
David Greene
0ca05878fe
Iterators folloring a SmallVector erased element are invalidated so
...
don't access cached iterators from after the erased element.
Re-apply 49056 with SmallVector support.
llvm-svn: 49106
2008-04-02 18:24:46 +00:00