Chandler Carruth
ca99ad3f0d
Add generic support for hashing StringRef objects using the new hashing library.
...
llvm-svn: 152003
2012-03-04 10:55:27 +00:00
Benjamin Kramer
4d681d7dc4
Add a bad char heuristic to StringRef::find.
...
Based on Horspool's simplified version of Boyer-Moore. We use a constant-sized table of
uint8_ts to keep cache thrashing low, needles bigger than 255 bytes are uncommon anyways.
The worst case is still O(n*m) but we do a lot better on the average case now.
llvm-svn: 142061
2011-10-15 10:08:31 +00:00
Jakob Stoklund Olesen
c874e2d8fb
Fix a bug in compare_numeric().
...
Thanks to Alexandru Dura and Jonas Paulsson for finding it.
llvm-svn: 140859
2011-09-30 17:03:55 +00:00
Lenny Maiorani
367342e209
Remove bounded StringRef::compare() since nothing but Clang SA was using it and it is just as easy to use StringRef::substr() preceding StringRef::compare() to achieve the same thing.
...
llvm-svn: 130430
2011-04-28 20:20:12 +00:00
Lenny Maiorani
fad9d95722
Implements StringRef::compare with bounds. It is behaves similarly to strncmp(). Unit tests also included.
...
llvm-svn: 129582
2011-04-15 17:56:50 +00:00
Chris Lattner
2114b762de
Don't infinitely recurse! Patch by Marius Wachtler!
...
llvm-svn: 124366
2011-01-27 07:35:27 +00:00
Benjamin Kramer
9bf0380a54
StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
...
llvm-svn: 112189
2010-08-26 15:25:35 +00:00
Benjamin Kramer
b04d4af057
Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
...
llvm-svn: 112185
2010-08-26 14:21:08 +00:00
Jakob Stoklund Olesen
d1d7ed63ff
Add StringRef::compare_numeric and use it to sort TableGen register records.
...
This means that our Registers are now ordered R7, R8, R9, R10, R12, ...
Not R1, R10, R11, R12, R2, R3, ...
llvm-svn: 104745
2010-05-26 21:47:28 +00:00
Benjamin Kramer
738800dd1d
Silence compiler warning.
...
warning: comparison between signed and unsigned integer expressions
llvm-svn: 92359
2009-12-31 16:27:13 +00:00
Douglas Gregor
5639af4eac
Document the edit-distance algorithm used in StringRef, switch it over
...
to SmallVector, and add a unit test.
llvm-svn: 92340
2009-12-31 04:24:34 +00:00
Douglas Gregor
4ee2cf658c
Move the two definitions of operator<< into namespace llvm, so they
...
will be found by argument-dependent lookup. As with the previous
commit, GCC is allowing ill-formed code.
llvm-svn: 92146
2009-12-24 21:15:37 +00:00
Eli Friedman
00879d8faa
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
Benjamin Kramer
99b5bd9074
Reenable Split2 StringRef test with Apple gcc.
...
llvm-svn: 89357
2009-11-19 16:04:41 +00:00
Daniel Dunbar
1acdfbd60b
"XFAIL" the Split2 StringReft test with Apple gcc, which miscompiles it.
...
- I plan on fixing/workarounding this, but until then I'd like the bots to stay
green.
llvm-svn: 89077
2009-11-17 09:29:59 +00:00
Rafael Espindola
ff2c72b858
Distinguish "a," from "a". The first one splits into "a" + "" and the second one into
...
"a" + 0.
llvm-svn: 87084
2009-11-13 04:55:09 +00:00
Rafael Espindola
7c6854995d
Switch to smallvector. Also fix issue with using unsigend for MaxSplit.
...
llvm-svn: 87068
2009-11-13 02:18:25 +00:00
Rafael Espindola
d554e44092
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
9806e4ab20
Add From arguments to StringRef search functions, and tweak doxyments.
...
Also, add unittests for find_first_of and find_first_not_of.
llvm-svn: 86770
2009-11-11 00:28:53 +00:00
Daniel Dunbar
4498168753
Add StringRef::{rfind, rsplit}
...
llvm-svn: 82087
2009-09-16 22:38:48 +00:00
Daniel Dunbar
3828a99ba6
Fix pasto in StringRef::count(char)
...
llvm-svn: 79356
2009-08-18 18:34:22 +00:00
Daniel Dunbar
5736db6527
Add StringRef::count({char,StringRef})
...
llvm-svn: 79354
2009-08-18 18:26:35 +00:00
Daniel Dunbar
a1e04d43c4
StringRef: Add find(char) and find(StringRef).
...
Also, regroup functions.
llvm-svn: 78712
2009-08-11 20:47:15 +00:00
Daniel Dunbar
56563f33f7
Add StringRef::{slice, split}, two convenient string operations which are simple
...
and efficient on a StringRef.
llvm-svn: 77117
2009-07-26 03:18:15 +00:00
Daniel Dunbar
e23388b25c
Support writing a StringRef to a raw_ostream directly.
...
llvm-svn: 76754
2009-07-22 17:13:20 +00:00
Daniel Dunbar
1f982105a6
Add StringRef::{substr, startswith}.
...
llvm-svn: 76559
2009-07-21 09:18:49 +00:00
Daniel Dunbar
25f9fc5851
Add StringRef class, with fixes.
...
llvm-svn: 76543
2009-07-21 07:28:51 +00:00