Dan Gohman
66ee3816ef
Some versions of GCC don't like non-static data members in sizeof
...
in this context.
llvm-svn: 92731
2010-01-05 15:28:21 +00:00
Dan Gohman
090f279ac5
Add a SmallBitVector class, which mimics BitVector but uses only
...
a single pointer (PointerIntPair) member. In "small" mode, the
pointer field is reinterpreted as a set of bits. In "large" mode,
the pointer points to a heap-allocated object.
Also, give BitVector empty and swap functions.
And, add some simple unittests for BitVector and SmallBitVector.
llvm-svn: 92730
2010-01-05 15:04:49 +00:00
Douglas Gregor
301af636d3
Implement edit distance for StringRef
...
llvm-svn: 92309
2009-12-30 17:23:44 +00:00
John McCall
75f1b8beeb
Implement support for converting to string at "natural precision", and fix some
...
major bugs in long-precision conversion.
llvm-svn: 92150
2009-12-24 23:18:09 +00:00
John McCall
c71c44ec7f
Add accessors for the largest-magnitude, smallest-magnitude, and
...
smallest-normalized-magnitude values in a given FP semantics.
Provide an APFloat-to-string conversion which I am quite ready to admit could
be much more efficient.
llvm-svn: 92126
2009-12-24 08:56:26 +00:00
David Greene
32ec2e9057
Convert debug messages to use dbgs(). Generally this means
...
s/errs/dbgs/g except for certain special cases.
llvm-svn: 92005
2009-12-23 17:18:22 +00:00
Chris Lattner
609eded2e8
add a helper ctor.
...
llvm-svn: 91819
2009-12-21 07:15:15 +00:00
Eli Friedman
fe6a796851
Change StringRef::startswith and StringRef::endswith to versions which are a
...
bit more verbose, but optimize to much shorter code.
llvm-svn: 91817
2009-12-21 06:49:24 +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
Chris Lattner
587962c667
Remove isPod() from DenseMapInfo, splitting it out to its own
...
isPodLike type trait. This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.
llvm-svn: 91421
2009-12-15 07:26:43 +00:00
John McCall
9ebba8d98e
Names from dependent base classes are not found by unqualified lookup.
...
llvm-svn: 91407
2009-12-15 03:10:26 +00:00
Gabor Greif
8508c1f18e
Simplify this class by removing the result cache.
...
This change removes the DefaultConstructible
and CopyAssignable constraints on the template
parameter T (the first one).
The second template parameter (R) is defaulted to be
identical to the first and controls the result type.
By specifying it to be (const T&) additionally the
CopyConstructible constraint on T can be removed.
This allows to use StringSwitch e.g. for llvm::Constant
instances.
Regarding the other review feedback regarding performance
because of taking pointers, this class should be completely
optimizable like before, since all methods are inline and
the pointer dereferencing and result value caching should be
possible behind the scenes by the "as-if" rule.
llvm-svn: 91123
2009-12-11 15:30:07 +00:00
Daniel Dunbar
a8dc0ca084
DeltaAlgorithm: Add a virtual destructor and home.
...
llvm-svn: 90957
2009-12-09 07:19:48 +00:00
Daniel Dunbar
b7c5aa749a
Remove unneeded ';' and a class/struct mismatch (noticed by clang).
...
llvm-svn: 90934
2009-12-09 02:58:09 +00:00
Chris Lattner
c9a91632e1
remove extraneous comma clang warns about
...
llvm-svn: 90707
2009-12-06 16:58:41 +00:00
Daniel Dunbar
63e2201f3e
Add an implementation of the delta debugging algorithm.
...
- This is a pretty slow / memory intensive implementation, and I will likely
change it to an iterative model, but it works.
llvm-svn: 90447
2009-12-03 11:12:42 +00:00
Gabor Greif
234d7dbe09
typo
...
llvm-svn: 90236
2009-12-01 15:53:33 +00:00
Gabor Greif
e65e0b8591
demonstrate usage of Cases() mapping several strings to the same value; remove trailing spaces
...
llvm-svn: 90230
2009-12-01 12:53:56 +00:00
Tobias Grosser
246c05c351
Remove forgotten ShortNames in Trie and CompilationGraph
...
llvm-svn: 90135
2009-11-30 13:14:13 +00:00
Daniel Dunbar
bd57261f1f
Allow SmallString to implicitly convert to StringRef.
...
llvm-svn: 89529
2009-11-21 02:01:24 +00:00
Benjamin Kramer
3213126b9a
cstdlib is not automatically included with StringRef anymore.
...
llvm-svn: 89359
2009-11-19 16:08:04 +00:00
Benjamin Kramer
3e24786569
Remove the now obsolete algorithm include from StringRef.h.
...
llvm-svn: 89354
2009-11-19 15:48:14 +00:00
Torok Edwin
2d2fb3f6ec
Workaround PR5482, because all the gcc versions that I had were miscompiling StringRef:
...
4.2.4, 4.3.4, 4.4.2.
The workaround is to use a local min/max implementation that takes an integer
param, and not a reference to integer param (like std::min does).
llvm-svn: 89352
2009-11-19 15:39:50 +00:00
Edward O'Callaghan
fb2393159b
Add PS3 Triple class, Credit to John Thompson.
...
llvm-svn: 89339
2009-11-19 11:59:00 +00:00
Daniel Dunbar
034c929118
Twine: Stores kinds as uchar instead of bitfield to be friendlier to the
...
optimizer.
llvm-svn: 89278
2009-11-19 00:04:43 +00:00
Viktor Kutuzov
1452b67541
Added getArchNameForAssembler method to the Triple class for which returns OS and Vendor independent target assembler arch.
...
llvm-svn: 89122
2009-11-17 18:48:27 +00:00
Nuno Lopes
44429689aa
add Case() with 5 args
...
llvm-svn: 89099
2009-11-17 15:35:39 +00:00
Duncan Sands
3ced5472c3
1. Allow SCCIterator to work with GraphT types that are constant.
...
2. Allow SCCIterator to work with inverse graphs.
3. Fix an incorrect comment in GraphTraits.h (the type in the comment
was given as GraphType* when it is actually const GraphType &).
Patch by Patrick Alexander Simmons.
llvm-svn: 89091
2009-11-17 10:54:25 +00:00
Eric Christopher
3877235021
Fix unused variables warnings.
...
llvm-svn: 88977
2009-11-16 22:34:32 +00:00
Chris Lattner
89c83b159c
add a version of array_pod_sort that takes a custom comparator function.
...
llvm-svn: 88861
2009-11-15 19:52:43 +00:00
Edward O'Callaghan
c672c34d7a
Add PSP OS Target to Triple, Credit to Bruno Cardoso Lopes.
...
llvm-svn: 88849
2009-11-15 10:18:17 +00:00
Dan Gohman
30f404fb4a
Use .data() instead of .c_str() when nul-termination is not needed.
...
llvm-svn: 88703
2009-11-13 21:55:31 +00:00
Rafael Espindola
11ceba8119
Switch to smallvector. Also fix issue with using unsigend for MaxSplit.
...
llvm-svn: 87068
2009-11-13 02:18:25 +00:00
Rafael Espindola
22f040b797
Add a new split method to StringRef that puts the substrings in a vector.
...
llvm-svn: 87058
2009-11-13 01:24:40 +00:00
Daniel Dunbar
880dfd38d8
StringRef(const char*) should not be used to turn null pointers into empty
...
strings.
llvm-svn: 87031
2009-11-12 21:26:11 +00:00
Benjamin Kramer
da70783da7
Add compare_lower and equals_lower methods to StringRef. Switch all users of
...
StringsEqualNoCase (from StringExtras.h) to it.
llvm-svn: 87020
2009-11-12 20:36:59 +00:00
Daniel Dunbar
da387a1c25
Add StringRef::split(StringRef), to complement StringRef::split(char).
...
llvm-svn: 86803
2009-11-11 05:19:11 +00:00