Lenny Maiorani
6cf081cbe5
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.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28 20:20:12 +00:00
Lenny Maiorani
437ef0cfb7
Implements StringRef::compare with bounds. It is behaves similarly to strncmp(). Unit tests also included.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129582 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 17:56:50 +00:00
Chris Lattner
7a2bdde0a0
Fix a ton of comment typos found by codespell. Patch by
...
Luis Felipe Strano Moraes!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
Jay Foad
40f8f6264d
PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
...
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 08:25:19 +00:00
Michael J. Spencer
63c133b67d
Support/ADT/StringRef: Add find_last_of.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:27:35 +00:00
Michael J. Spencer
326990f1eb
Fix Whitespace.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120166 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 04:16:08 +00:00
Ted Kremenek
13302ec089
Fix memory leak in StringRef::edit_distance(). 'Allocated' could be leaked on an early return.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118370 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-07 06:09:02 +00:00
Douglas Gregor
5ee568ac27
Extend StringRef's edit-distance algorithm to permit an upper bound on the allowed edit distance
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 22:13:48 +00:00
Benjamin Kramer
837bccd052
StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112189 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:25:35 +00:00
Benjamin Kramer
0043e35b82
Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 14:21:08 +00:00
Benjamin Kramer
250eb005d9
Avoid O(n*m) complexity in StringRef::find_first(_not)_of(StringRef).
...
- Cache used characters in a bitset to reduce memory overhead to just 32 bytes.
- On my core2 this code is faster except when the checked string was very short
(smaller than the list of delimiters).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 18:16:08 +00:00
Jakob Stoklund Olesen
160a3bf74d
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, ...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 21:47:28 +00:00
John McCall
1e7ad3993d
Add an override to StringRef::getAsInteger which parses into an APInt.
...
It gets its own implementation totally divorced from the (presumably
performance-sensitive) routines which parse into a uint64_t.
Add APInt::operator|=(uint64_t), which is situationally much better than
using a full APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 09:55:58 +00:00
Douglas Gregor
2772ea831c
More trivial optimizations to a function well outside the critical path
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92896 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 02:24:06 +00:00
Douglas Gregor
ad6b6da8aa
Switch StringRef::edit_distance over to using raw pointers, since both
...
std::vector and llvm::SmallVector have annoying performance
tradeoffs. No, I don't expect this to matter, and now it won't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 00:51:54 +00:00
Douglas Gregor
7e54d5b156
Document the edit-distance algorithm used in StringRef, switch it over
...
to SmallVector, and add a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 04:24:34 +00:00
Douglas Gregor
441c8b4ad1
Implement edit distance for StringRef
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-30 17:23:44 +00:00
Daniel Dunbar
58ce7acb4f
Use StringRef::min instead of std::min.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89372 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-19 18:53:18 +00:00
Benjamin Kramer
05872ea804
Add compare_lower and equals_lower methods to StringRef. Switch all users of
...
StringsEqualNoCase (from StringExtras.h) to it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-12 20:36:59 +00:00
Daniel Dunbar
64066bd8b5
Add From arguments to StringRef search functions, and tweak doxyments.
...
Also, add unittests for find_first_of and find_first_not_of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-11 00:28:53 +00:00
Daniel Dunbar
2928c83b01
Pass StringRef by value.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 10:58:06 +00:00
Daniel Dunbar
77696bebbc
Workaround what I believe is an MSVC bug where it emits a definition for a
...
static const class member into each translation unit, with external linkage???
- If someone understands this issue better, please clue me in, I haven't
consulted the standard yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82516 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 03:34:40 +00:00
Chris Lattner
6441e547cc
simplify as daniel suggests
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 22:56:43 +00:00
Chris Lattner
05a32c8ab1
move a couple non-trivial methods out of line, add new
...
find_first_of/find_first_of methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 01:22:16 +00:00
Chris Lattner
63c6b7dc67
add some more overloads of StringRef::getAsInteger for
...
common and useful integer types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 23:58:48 +00:00
Chris Lattner
cea1438cf5
provide a "strtoull" operation that works on StringRef's.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-19 19:47:14 +00:00
Daniel Dunbar
e65512809a
Add StringRef::{rfind, rsplit}
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-16 22:38:48 +00:00