summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/RegexTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Fix llvm-special-case-list-fuzzer regexp exceptionVlad Tsyrklevich2017-10-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Original oss-fuzz report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3727#c2 The minimized test case that causes this failure: 5b 5b 5b 3d 47 53 00 5b 3d 5d 5b 5d 0a [[[=GS.[=][]. Note the string "=GS\x00". The failure happens because the code is searching the string against an array of known collated names. "GS\x00" is a hit, but since len takes into account an extra NUL byte, indexing into cp->name[len] goes one byte past it's allocated memory. Fix this to use a strlen(cp->name) comparison to account for NUL bytes in the input. Reviewers: pcc Reviewed By: pcc Subscribers: hctim, kcc Differential Revision: https://reviews.llvm.org/D39380 llvm-svn: 316786
* [Support] - Fix possible crash in match() of llvm::Regex.George Rimar2016-09-021-0/+9
| | | | | | | | | | | | Crash was possible if match() method was called on object that was moved or object created with empty constructor. Testcases updated. DIfferential revision: https://reviews.llvm.org/D24123 llvm-svn: 280473
* [LLVM/Support] - Create no-arguments constructor for llvm::RegexGeorge Rimar2016-09-011-0/+9
| | | | | | | | | This is useful when need to defer the construction, e.g. using Regex as a member of class. Differential revision: https://reviews.llvm.org/D24101 llvm-svn: 280339
* [C++11] Remove uses of LLVM_HAS_RVALUE_REFERENCES from the unittests.Chandler Carruth2014-03-011-2/+0
| | | | llvm-svn: 202583
* Make llvm::Regex non-copyable but movable.David Blaikie2014-01-021-0/+15
| | | | | | Based on a patch by Maciej Piechotka. llvm-svn: 198334
* Swap around EXPECT_EQ() arguments orders for more natural gtest Failure messagesAlp Toker2013-12-121-8/+8
| | | | | | | | | Somewhat counterintuitively the first arg in gtest is treated as the expectation. No change to the tests themselves. llvm-svn: 197124
* Add missing escape characters to the new Regex::escape() functionAlp Toker2013-12-121-0/+5
| | | | | | | | | The old AddFixedStringToRegEx() it was based on got away with this for the longest time, but the problem became easy to spot after the cleanup in r197096. Also add a quick unit test to cover regex escaping. llvm-svn: 197121
* Fix off-by-one error in Regex::isValidAlexey Samsonov2013-08-081-0/+8
| | | | llvm-svn: 187992
* Introduce Regex::isLiteralERE function.Peter Collingbourne2013-08-051-0/+15
| | | | | | | | | This will be used to implement an optimisation for literal entries in special case lists. Differential Revision: http://llvm-reviews.chandlerc.com/D1278 llvm-svn: 187731
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-1/+1
| | | | llvm-svn: 169250
* Add backreference matching capabilities to Support/Regex, withEli Bendersky2012-11-281-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | appropriate unit tests. This change in itself is not expected to affect any functionality at this point, but it will serve as a stepping stone to improve FileCheck's variable matching capabilities. Luckily, our regex implementation already supports backreferences, although a bit of hacking is required to enable it. It supports both Basic Regular Expressions (BREs) and Extended Regular Expressions (EREs), without supporting backrefs for EREs, following POSIX strictly in this respect. And EREs is what we actually use (rightly). This is contrary to many implementations (including the default on Linux) of POSIX regexes, that do allow backrefs in EREs. Adding backref support to our EREs is a very simple change in the regcomp parsing code. I fail to think of significant cases where it would clash with existing things, and can bring more versatility to the regexes we write. There's always the danger of a backref in a specially crafted regex causing exponential matching times, but since we mainly use them for testing purposes I don't think it's a big problem. [it can also be placed behind a flag specific to FileCheck, if needed]. For more details, see: * http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-November/055840.html * http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/156878.html llvm-svn: 168802
* Add Regex::sub, for doing regular expression substitution with backreferences.Daniel Dunbar2010-02-171-0/+29
| | | | llvm-svn: 96503
* remove support for "NoSub" from regex. It seems like a minor optimizationChris Lattner2009-09-261-4/+4
| | | | | | and makes the API more annoying. Add a Regex::getNumMatches() method. llvm-svn: 82877
* add and document regex support for FileCheck. You can now do stuff like:Chris Lattner2009-09-241-0/+1
| | | | | | | | ; CHECK: movl {{%e[a-z][xi]}}, %eax or whatever. llvm-svn: 82717
* Add regular expression matching support, based on OpenBSD regexec()/regcomp()Torok Edwin2009-08-301-0/+64
implementation. llvm-svn: 80493
OpenPOWER on IntegriCloud