summaryrefslogtreecommitdiffstats
path: root/libcxx/include/regex
Commit message (Collapse)AuthorAgeFilesLines
* Rename __is_foo_iterator traits to reflect their Cpp17 nature.Eric Fiselier2019-11-181-4/+4
| | | | | | | | | With the upcoming introduction of iterator concepts in ranges, the meaning of "__is_contiguous_iterator" changes drastically. Currently we intend it to mean "does it have this iterator category", but it could now also mean "does it meet the requirements of this concept", and these can be different.
* [libc++] Validate the entire regex is consumedMark de Wever2019-11-091-11/+21
| | | | | | | This change would have warned about the bug found in D62451. No unit tests since the exception should never throw. Differential Revision: https://reviews.llvm.org/D62452
* Add a missing default parameter to regex::assign. This is LWG3296; reviewed ↵Marshall Clow2019-09-251-6/+6
| | | | | | as https://reviews.llvm.org/D67944 llvm-svn: 372896
* [libc++] Keep __regex_word in sync with ctype_baseMikhail Maltsev2019-06-141-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The class ctype_base in the header <__locale> contains masks for character classification functions, which are kept in sync with platform's C library, hence it contains many special cases. The value of the bit mask __regex_word in the header <regex> must not clash with those bit masks. Currently the default case (i.e. unknown platform/C library) is handled incorrectly: the __regex_word clashes with ctype_base::punct. To avoid replicating the whole list of platforms in <regex> this patch defines __regex_word in <__locale>, so that it is always kept in sync with other masks. Reviewers: ldionne, mclow.lists, EricWF Reviewed By: ldionne Subscribers: krytarowski, christof, dexonsmith, pbarrio, simon_tatham, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D63284 llvm-svn: 363363
* [NFC][libcxx] Remove trailing whitespaceLouis Dionne2019-05-291-10/+10
| | | | | | It's incredibly annoying when trying to create diffs llvm-svn: 361981
* Fix an incorrect 'Throws' in the regex code. Add a test for the new ↵Marshall Clow2019-05-281-1/+1
| | | | | | behavior. Reviewed as https://reviews.llvm.org/D61828. Thanks to Mark for the catch and the fix. llvm-svn: 361887
* Add '_LIBCPP_ASSERT(ready())' to several match_results method that have this ↵Marshall Clow2019-04-261-6/+27
| | | | | | precondtion. Fix several tests which did not honor this precondition. Thanks to Andrey Maksimov for pointing this out. llvm-svn: 359324
* Fix PR#35967: '<regex> syntax_option_type is not a proper bitmask' Sadly, ↵Marshall Clow2019-03-281-12/+44
| | | | | | this is an ABI break, so it's only available if you define either '_LIBCPP_ABI_VERSION > 2' or '_LIBCPP_ABI_UNSTABLE' or '_LIBCPP_ABI_REGEX_CONSTANTS_NONZERO' and rebuild your dylib. llvm-svn: 357190
* Change a couple of '&' to addressof(). NFCMarshall Clow2019-01-241-3/+3
| | | | llvm-svn: 352007
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. 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: 351648
* [regex] Use distinct __regex_word on NetBSDMichal Gorny2018-12-161-0/+4
| | | | | | | | | | NetBSD defines character classes up to 0x2000. Use 0x8000 as a safe __regex_word that hopefully will not collide with other values in the foreseeable future. Differential Revision: https://reviews.llvm.org/D55657 llvm-svn: 349293
* Fix even more Clang warnings.Eric Fiselier2018-10-011-2/+2
| | | | | | | This patch disables shift-sign-overflow warnings for now. It also fixes most -Wfloat-equal warnings and -Wextra-semi warnings. llvm-svn: 343438
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* [libc++] Fix handling of negated character classes in regexLouis Dionne2018-08-241-9/+6
| | | | | | | | | | | | | | | | Summary: This commit fixes a regression introduced in r316095, where we don't match inverted character classes when there's no negated characrers in the []'s. rdar://problem/43060054 Reviewers: mclow.lists, timshen, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50534 llvm-svn: 340609
* [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | _LIBCPP_INLINE_VISIBILITY Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Note that this commit had originally been applied in r336369 and then reverted in r336382 because of unforeseen problems. Both of these problems have now been fixed. Reviewers: EricWF, mclow.lists Subscribers: christof, dexonsmith, erikvanderpoel Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336866
* Revert "[libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by ↵Louis Dionne2018-07-051-1/+1
| | | | | | | | | | | | | | | _LIBCPP_INLINE_VISIBILITY" This reverts commit r336369. The commit had two problems: 1. __pbump was marked as _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY instead of _LIBCPP_INLINE_VISIBILITY, which lead to two symbols being added in the dylib and the check-cxx-abilist failing. 2. The LLDB tests started failing because they undefine `_LIBCPP_INLINE_VISIBILITY`. I need to figure out why they do that and fix the tests before we can go forward with this change. llvm-svn: 336382
* [libc++] Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITYLouis Dionne2018-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: We never actually mean to always inline a function -- all the uses of the macro I could find are actually attempts to control the visibility of symbols. This is better described by _LIBCPP_INLINE_VISIBILITY, which is actually always defined the same. This change is orthogonal to the decision of what we're actually going to do with _LIBCPP_INLINE_VISIBILITY -- it just simplifies things by having one canonical way of doing things. Reviewers: EricWF Subscribers: christof, llvm-commits, dexonsmith, erikvanderpoel, mclow.lists Differential Revision: https://reviews.llvm.org/D48892 llvm-svn: 336369
* Implement deduction guides for basic_regexMarshall Clow2018-05-231-0/+14
| | | | llvm-svn: 333050
* [libcxx] Correctly handle invalid regex character class namesMikhail Maltsev2018-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: Currently when a regular expression contains an invalid character class name std::regex constructors throw an std::regex_error with std::regex_constants::error_brack code. This patch changes the code to std::regex_constants::error_ctype and adds a test. Reviewers: EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42291 llvm-svn: 323322
* More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in ↵Marshall Clow2017-11-161-4/+4
| | | | | | match_results. <regex> llvm-svn: 318375
* Rename identifiers named `__output`Alexander Richardson2017-11-141-33/+33
| | | | | | | | | | | | | | | | Summary: In the CHERI clang compiler __output and __input are keywords and therefore we can't compile libc++ with our compiler. Reviewers: mclow.lists, EricWF, theraven Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39537 llvm-svn: 318144
* Fix an unsigned integer overflow in regex that lead to a bad memory access. ↵Marshall Clow2017-10-191-5/+11
| | | | | | Found by OSS-Fuzz llvm-svn: 316191
* Fix UB - signed integer overflow in regex. Thanks to Tim Shen for the patch. ↵Marshall Clow2017-10-191-0/+2
| | | | | | Reviewed as https://reviews.llvm.org/D39066 llvm-svn: 316172
* Fix regex bug with ^\W. Thanks to Tim Shen for the patch. Reviewed as ↵Marshall Clow2017-10-181-12/+18
| | | | | | https://reviews.llvm.org/D37955 llvm-svn: 316095
* Apply D28224: 'Throw exception after too many steps' Fixes PR#20291. Thanks ↵Marshall Clow2017-09-121-0/+20
| | | | | | to Tim Shen for the patch llvm-svn: 313056
* Fix a bug in regex_Iterator where it would report zero-length matches ↵Marshall Clow2017-07-051-1/+1
| | | | | | forever. Reported as http://llvm.org/PR33681. Thanks to Karen Arutyunov for the report. llvm-svn: 307171
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-2/+6
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Cleanup _LIBCPP_HAS_NO_<c++11-features> macro usage in regexEric Fiselier2017-04-181-11/+11
| | | | llvm-svn: 300627
* Work around recent -Wshadow changes in ClangEric Fiselier2017-04-041-1/+0
| | | | llvm-svn: 299407
* Replace identifiers called `__out` because Windows.h #defines it.Eric Fiselier2017-01-071-33/+33
| | | | | | | | Windows is greedy and it defines the identifier `__out` as a macro. This patch renames all conflicting libc++ identifiers in order to correctly work on Windows. llvm-svn: 291345
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-8/+8
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* Fix bug #31387 - not checking end iterator when parsing decimal escape. ↵Marshall Clow2016-12-241-1/+2
| | | | | | Thanks to Karen for the report. llvm-svn: 290500
* fix sign comparison warningsEric Fiselier2016-12-241-15/+15
| | | | llvm-svn: 290469
* [libcxx] Make regex_match backtrack when search failsTim Shen2016-10-271-10/+33
| | | | | | | | | | | | | | | | Summary: Fixes PR19851. alg.re.match/ecma.pass.cpp still XFAILS on linux, but after commenting out locale-related tests, it passes. I don't have a freebsd machine to produce a full pass. Reviewers: mclow.lists Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D26026 llvm-svn: 285352
* [libcxx] Support std::regex_constants::match_not_nullTim Shen2016-10-211-0/+18
| | | | | | | | | | | | Summary: Fixes PR21597. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25595 llvm-svn: 284881
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-3/+2
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctorHubert Tong2016-08-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: The synopsis in C++11 subclause 28.8 [re.regex] has: ``` basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); ``` The default argument is added to libc++ by this change. Reviewers: mclow.lists, rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22702 Reapplies r277966. Patch by Jason Liu! llvm-svn: 277968
* Revert r277966. Forgot patch attribution.Hubert Tong2016-08-071-2/+2
| | | | llvm-svn: 277967
* [libcxx] Add "flag" default arg: basic_regex ptr_size_flag ctorHubert Tong2016-08-071-2/+2
| | | | | | | | | | | | | | | | | | | Summary: The synopsis in C++11 subclause 28.8 [re.regex] has: ``` basic_regex(const charT* p, size_t len, flag_type f = regex_constants::ECMAScript); ``` The default argument is added to libc++ by this change. Reviewers: mclow.lists, rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22702 llvm-svn: 277966
* [libcxx] basic_regex: add traits_type, string_typeHubert Tong2016-08-021-0/+4
| | | | | | | | | | | | | | | | | Summary: In the synopsis in C++11 subclause 28.8 [re.regex], `basic_regex` is specified to have member typedefs `traits_type` and `string_type`. This change adds them to libc++. Reviewers: mclow.lists, rsmith, hubert.reinterpretcast Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D22698 Patch by Jason Liu! llvm-svn: 277526
* [libcxx] Fix definition of regex_traits::__regex_word on big-endian glibc ↵Daniel Sanders2016-02-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | systems Summary: On glibc, the bits used for the various character classes is endian dependant (see _ISbit() in ctypes.h) but __regex_word does not account for this and uses a spare bit that isn't spare on big-endian. On big-endian, it overlaps with the bit for graphic characters which causes '-', '@', etc. to be considered a word character. Fixed this by defining the value using _ISbit(15) on MIPS glibc systems. We've restricted this to MIPS for now to avoid the risk of introducing failures in other targets. Fixes PR26476. Reviewers: hans, mclow.lists Subscribers: dsanders, cfe-commits Differential Revision: http://reviews.llvm.org/D17132 llvm-svn: 261088
* re.results.form: Format out-of-range subexpression references as nullDuncan P. N. Exon Smith2016-02-031-4/+4
| | | | | | | | | | Rather than crashing in match_results::format() when a reference to a marked subexpression is out of range, format the subexpression as empty (i.e., replace it with an empty string). Note that match_results::operator[]() has a range-check and returns a null match in this case, so this just re-uses that logic. llvm-svn: 259682
* Fix PR#26175. Thanks to Josh Petrie for the report and the patch. Reviewed ↵Marshall Clow2016-01-191-0/+3
| | | | | | as http://reviews.llvm.org/D16262 llvm-svn: 258107
* Cleanup: move visibility/linkage attributes to the first declaration.Evgeniy Stepanov2015-11-071-1/+2
| | | | | | | | | | | | This change moves visibility attributes from out-of-class method definitions to in-class declaration. This is needed for a switch to attribute((internal_linkage)) (see http://reviews.llvm.org/D13925) which can only appear on the first declaration. This change does not touch istream/ostream/streambuf. They are handled separately in http://reviews.llvm.org/D14409. llvm-svn: 252385
* Fix a crasher found by libFuzzerMarshall Clow2015-08-241-0/+2
| | | | llvm-svn: 245849
* Make regex and any assert when they should throw an exception _but_ the user ↵Marshall Clow2015-08-171-1/+4
| | | | | | has decreed 'no exceptions'. This matches the behavior of string and vector llvm-svn: 245239
* Consolidate a bunch of #ifdef _LIBCPP_NO_EXCEPTIONS .. #endif blocks into a ↵Marshall Clow2015-07-281-165/+64
| | | | | | single template function. NFC llvm-svn: 243415
* Detect and throw on a class of bad regexes that we mistakenly accepted ↵Marshall Clow2015-07-231-0/+8
| | | | | | before. Thanks to Trevor Smigiel for the report llvm-svn: 243030
* Fix initializer list order in <regex> to be correctEric Fiselier2015-07-221-3/+3
| | | | llvm-svn: 242864
* Remove unused typedefs in random and regexEric Fiselier2015-07-181-1/+0
| | | | llvm-svn: 242628
OpenPOWER on IntegriCloud