| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with the StringRef::split method when used with a MaxSplit argument
other than '-1' (which nobody really does today, but which should
actually work).
The spec claimed both to split up to MaxSplit times, but also to append
<= MaxSplit strings to the vector. One of these doesn't make sense.
Given the name "MaxSplit", let's go with it being a max over how many
*splits* occur, which means the max on how many strings get appended is
MaxSplit+1. I'm not actually sure the implementation correctly provided
this logic either, as it used a really opaque loop structure.
The implementation was also playing weird games with nullptr in the data
field to try to rely on a totally opaque hidden property of the split
method that returns a pair. Nasty IMO.
Replace all of this with what is (IMO) simpler code that doesn't use the
pair returning split method, and instead just finds each separator and
appends directly. I think this is a lot easier to read, and it most
definitely matches the spec. Added some tests that exercise the corner
cases around StringRef() and StringRef("") that all now pass.
I'll start using this in code in the next commit.
llvm-svn: 247249
|
|
|
|
|
|
|
|
|
|
|
| |
on StringRef. Finding and splitting on a single character is
substantially faster than doing it on even a single character StringRef
-- we immediately get to a *very* tuned memchr call this way.
Even nicer, we get to this even in a debug build, shaving 18% off the
runtime of TripleTest.Normalization, helping PR23676 some more.
llvm-svn: 247244
|
|
|
|
|
|
| |
While there make array_lengthof constexpr if we have support for it.
llvm-svn: 206112
|
|
|
|
|
|
|
|
|
| |
Now to copy a string into a BumpPtrAllocator and get a StringRef to the copy:
StringRef myCopy = myStr.copy(myAllocator);
llvm-svn: 200885
|
|
|
|
|
|
|
|
|
|
|
| |
There are a couple of interesting things here that we want to check over
(particularly the expecting asserts in StringRef) and get right for general use
in ADT so hold back on this one. For clang we have a workable templated
solution to use in the meanwhile.
This reverts commit r200187.
llvm-svn: 200194
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(1) Add llvm_expect(), an asserting macro that can be evaluated as a constexpr
expression as well as a runtime assert or compiler hint in release builds. This
technique can be used to construct functions that are both unevaluated and
compiled depending on usage.
(2) Update StringRef using llvm_expect() to preserve runtime assertions while
extending the same checks to static asserts in C++11 builds that support the
feature.
(3) Introduce ConstStringRef, a strong subclass of StringRef that references
compile-time constant strings. It's convertible to, but not from, ordinary
StringRef and thus can be used to add compile-time safety to various interfaces
in LLVM and clang that only accept fixed inputs such as diagnostic format
strings that tend to get misused.
llvm-svn: 200187
|
|
|
|
|
|
|
|
|
|
| |
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.
Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.
llvm-svn: 198685
|
|
|
|
|
|
|
|
|
| |
startswith_lower is ocassionally useful and I think worth adding.
endwith_lower is added for completeness.
Differential Revision: http://llvm-reviews.chandlerc.com/D2041
llvm-svn: 193706
|
|
|
|
| |
llvm-svn: 193550
|
|
|
|
|
|
| |
separator between each two elements.
llvm-svn: 189846
|
|
|
|
| |
llvm-svn: 169250
|
|
|
|
| |
llvm-svn: 165147
|
|
|
|
|
|
|
|
| |
not "unsigned long long".
while there add more test cases.
llvm-svn: 165140
|
|
|
|
|
|
| |
rejected
llvm-svn: 165136
|
|
|
|
| |
llvm-svn: 156652
|
|
|
|
| |
llvm-svn: 152522
|
|
|
|
|
|
|
|
| |
it would fail with {,u}int64_t on x86-64 Linux.
This also removes code duplication.
llvm-svn: 152517
|
|
|
|
| |
llvm-svn: 152003
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Thanks to Alexandru Dura and Jonas Paulsson for finding it.
llvm-svn: 140859
|
|
|
|
|
|
| |
and it is just as easy to use StringRef::substr() preceding StringRef::compare() to achieve the same thing.
llvm-svn: 130430
|
|
|
|
|
|
| |
strncmp(). Unit tests also included.
llvm-svn: 129582
|
|
|
|
| |
llvm-svn: 124366
|
|
|
|
|
|
| |
characters > 127.
llvm-svn: 112189
|
|
|
|
|
|
| |
consistent with compare in corner cases.
llvm-svn: 112185
|
|
|
|
|
|
|
| |
This means that our Registers are now ordered R7, R8, R9, R10, R12, ...
Not R1, R10, R11, R12, R2, R3, ...
llvm-svn: 104745
|
|
|
|
|
| |
warning: comparison between signed and unsigned integer expressions
llvm-svn: 92359
|
|
|
|
|
|
| |
to SmallVector, and add a unit test.
llvm-svn: 92340
|
|
|
|
|
|
|
| |
will be found by argument-dependent lookup. As with the previous
commit, GCC is allowing ill-formed code.
llvm-svn: 92146
|
|
|
|
|
|
| |
bit more verbose, but optimize to much shorter code.
llvm-svn: 91817
|
|
|
|
| |
llvm-svn: 89357
|
|
|
|
|
|
|
| |
- I plan on fixing/workarounding this, but until then I'd like the bots to stay
green.
llvm-svn: 89077
|
|
|
|
|
|
|
|
| |
one into
"a" + 0.
llvm-svn: 87084
|
|
|
|
| |
llvm-svn: 87068
|
|
|
|
| |
llvm-svn: 87058
|
|
|
|
|
|
| |
Also, add unittests for find_first_of and find_first_not_of.
llvm-svn: 86770
|
|
|
|
| |
llvm-svn: 82087
|
|
|
|
| |
llvm-svn: 79356
|
|
|
|
| |
llvm-svn: 79354
|
|
|
|
|
|
| |
Also, regroup functions.
llvm-svn: 78712
|
|
|
|
|
|
| |
and efficient on a StringRef.
llvm-svn: 77117
|
|
|
|
| |
llvm-svn: 76754
|
|
|
|
| |
llvm-svn: 76559
|
|
llvm-svn: 76543
|