summaryrefslogtreecommitdiff
path: root/lib/Support/StringRef.cpp
Commit message (Collapse)AuthorAge
* Add {start,end}with_lower methods to StringRef.Rui Ueyama2013-10-30
| | | | | | | | | startswith_lower is ocassionally useful and I think worth adding. endwith_lower is added for completeness. Differential Revision: http://llvm-reviews.chandlerc.com/D2041 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193706 91177308-0d34-0410-b5e6-96231b3b80d8
* Added const qualifier to StringRef::edit_distance member functionDmitri Gribenko2013-08-24
| | | | | | | Patch by Ismail Pazarbasi. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189162 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r185852.Manman Ren2013-07-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185861 91177308-0d34-0410-b5e6-96231b3b80d8
* StringRef: add DenseMapInfo for StringRef.Manman Ren2013-07-08
| | | | | | | | | Remove the implementation in include/llvm/Support/YAMLTraits.h. Added a DenseMap type DITypeHashMap in DebugInfo.h: DenseMap<std::pair<StringRef, unsigned>, MDNode*> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185852 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve overflow detection in StringRef::getAsUnsignedInteger().Nick Kledzik2012-10-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165038 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support/StringRef] Add find_last_not_of and {r,l,}trim.Michael J. Spencer2012-05-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156652 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't die with an assertion if the Result bitwidth is already correct. ThisChris Lattner2012-04-23
| | | | | | | fixes an assert reading "1239123123123123" when the result is already 64-bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155329 91177308-0d34-0410-b5e6-96231b3b80d8
* No need for "else if" after a return. Autosense "0o123" as octal inChris Lattner2012-04-21
| | | | | | | StringRef::getAsInteger git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155298 91177308-0d34-0410-b5e6-96231b3b80d8
* Make StringRef::getAsInteger work with all integer types. Before this changeMichael J. Spencer2012-03-10
| | | | | | | | it would fail with {,u}int64_t on x86-64 Linux. This also removes code duplication. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152517 91177308-0d34-0410-b5e6-96231b3b80d8
* Add generic support for hashing StringRef objects using the new hashing library.Chandler Carruth2012-03-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152003 91177308-0d34-0410-b5e6-96231b3b80d8
* Workaround a miscompilation by gcc-4.3 that showed up as a failureDuncan Sands2012-02-24
| | | | | | | of the StringRef.Split2 unittest on 32 bit machines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151358 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the implementation of StringRef::split out of StringExtras.cppDuncan Sands2012-02-21
| | | | | | | and into StringRef.cpp, which is where the other StringRef stuff is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151054 91177308-0d34-0410-b5e6-96231b3b80d8
* Add function for computing the edit distance of two arrays.Kaelyn Uhrain2012-02-15
| | | | | | | | Accomplished by moving the body of StringRef::edit_distance into a separate function that accepts two ArrayRefs, and making StringRef::edit_distance a wrapper around the new function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150621 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo.Benjamin Kramer2011-11-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143890 91177308-0d34-0410-b5e6-96231b3b80d8
* ADT/StringRef: Add ::lower() and ::upper() methods.Daniel Dunbar2011-11-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143880 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix handling of the From parameter in StringRef::find.Benjamin Kramer2011-10-17
| | | | | | Enable bounds checking to catch this kind of bug earlier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142247 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a bad char heuristic to StringRef::find.Benjamin Kramer2011-10-15
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142061 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in compare_numeric().Jakob Stoklund Olesen2011-09-30
| | | | | | Thanks to Alexandru Dura and Jonas Paulsson for finding it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140859 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove bounded StringRef::compare() since nothing but Clang SA was using it ↵Lenny Maiorani2011-04-28
| | | | | | 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
* Implements StringRef::compare with bounds. It is behaves similarly to ↵Lenny Maiorani2011-04-15
| | | | | | strncmp(). Unit tests also included. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129582 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-15
| | | | | | | | Luis Felipe Strano Moraes! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-07
| | | | | | | | 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
* Support/ADT/StringRef: Add find_last_of.Michael J. Spencer2010-11-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120495 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Whitespace.Michael J. Spencer2010-11-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120166 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix memory leak in StringRef::edit_distance(). 'Allocated' could be leaked ↵Ted Kremenek2010-11-07
| | | | | | on an early return. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118370 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend StringRef's edit-distance algorithm to permit an upper bound on the ↵Douglas Gregor2010-10-19
| | | | | | allowed edit distance git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116867 91177308-0d34-0410-b5e6-96231b3b80d8
* StringRef::compare_numeric also differed from StringRef::compare for ↵Benjamin Kramer2010-08-26
| | | | | | characters > 127. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112189 91177308-0d34-0410-b5e6-96231b3b80d8
* Do unsigned char comparisons in StringRef::compare_lower to be more ↵Benjamin Kramer2010-08-26
| | | | | | consistent with compare in corner cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112185 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid O(n*m) complexity in StringRef::find_first(_not)_of(StringRef).Benjamin Kramer2010-08-23
| | | | | | | | | - 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
* Add StringRef::compare_numeric and use it to sort TableGen register records.Jakob Stoklund Olesen2010-05-26
| | | | | | | 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
* Add an override to StringRef::getAsInteger which parses into an APInt.John McCall2010-02-28
| | | | | | | | | | | | 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
* More trivial optimizations to a function well outside the critical pathDouglas Gregor2010-01-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92896 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch StringRef::edit_distance over to using raw pointers, since bothDouglas Gregor2010-01-07
| | | | | | | | 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
* Document the edit-distance algorithm used in StringRef, switch it overDouglas Gregor2009-12-31
| | | | | | | to SmallVector, and add a unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement edit distance for StringRefDouglas Gregor2009-12-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92309 91177308-0d34-0410-b5e6-96231b3b80d8
* Use StringRef::min instead of std::min.Daniel Dunbar2009-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89372 91177308-0d34-0410-b5e6-96231b3b80d8
* Add compare_lower and equals_lower methods to StringRef. Switch all users ofBenjamin Kramer2009-11-12
| | | | | | | StringsEqualNoCase (from StringExtras.h) to it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87020 91177308-0d34-0410-b5e6-96231b3b80d8
* Add From arguments to StringRef search functions, and tweak doxyments.Daniel Dunbar2009-11-11
| | | | | | 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
* Pass StringRef by value.Daniel Dunbar2009-11-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
* Workaround what I believe is an MSVC bug where it emits a definition for aDaniel Dunbar2009-09-22
| | | | | | | | 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
* simplify as daniel suggestsChris Lattner2009-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82415 91177308-0d34-0410-b5e6-96231b3b80d8
* move a couple non-trivial methods out of line, add new Chris Lattner2009-09-20
| | | | | | | find_first_of/find_first_of methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82347 91177308-0d34-0410-b5e6-96231b3b80d8
* add some more overloads of StringRef::getAsInteger forChris Lattner2009-09-19
| | | | | | | common and useful integer types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82338 91177308-0d34-0410-b5e6-96231b3b80d8
* provide a "strtoull" operation that works on StringRef's.Chris Lattner2009-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82322 91177308-0d34-0410-b5e6-96231b3b80d8
* Add StringRef::{rfind, rsplit}Daniel Dunbar2009-09-16
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82087 91177308-0d34-0410-b5e6-96231b3b80d8