1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
llvm-mirror/unittests
Chandler Carruth e9c3d2d316 [ADT] Fix a confusing interface spec and some annoying peculiarities
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
2015-09-10 07:51:37 +00:00
..
ADT [ADT] Fix a confusing interface spec and some annoying peculiarities 2015-09-10 07:51:37 +00:00
Analysis [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
AsmParser Fix PR 24633 - Handle undef values when parsing standalone constants. 2015-09-09 13:44:33 +00:00
Bitcode Fix memory leak in unit test of Bitcode/BitReaderTest.cpp 2015-08-03 21:23:51 +00:00
CodeGen AsmPrinter: Use an intrusively linked list for DIE::Children 2015-06-25 23:52:10 +00:00
DebugInfo Fix compilation of PDBApiTest. 2015-05-01 20:51:49 +00:00
ExecutionEngine [PM/AA] Rebuild LLVM's alias analysis infrastructure in a way compatible 2015-09-09 17:55:00 +00:00
IR DI: Set DILexicalBlock columns >= 65536 to 0/unknown 2015-08-28 22:58:50 +00:00
LineEditor Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
Linker Linker: Move distinct MDNodes instead of cloning 2015-08-03 17:09:38 +00:00
MC [cleanup] Re-sort all the #include lines in LLVM using 2015-01-14 11:23:27 +00:00
Option Modify ParseArgs to return the InputArgList by value - there's no need for dynamic allocation/ownership here 2015-06-22 22:06:37 +00:00
ProfileData InstrProf: Add a test for multiple copies of the same with different hashes 2015-06-22 23:56:53 +00:00
Support [ADT] Switch a bunch of places in LLVM that were doing single-character 2015-09-10 06:12:31 +00:00
Transforms [RemoveDuplicatePHINodes] Start over after removing a PHI. 2015-09-02 19:52:23 +00:00
CMakeLists.txt AsmParser: Require a terminating null character when creating memory buffer. 2015-05-20 20:41:27 +00:00
Makefile AsmParser: Require a terminating null character when creating memory buffer. 2015-05-20 20:41:27 +00:00
Makefile.unittest