Commit Graph

78 Commits

Author SHA1 Message Date
Marshall Clow 538fec0e59 Fix for PR22061 by K-ballo
llvm-svn: 227384
2015-01-28 22:22:35 +00:00
Marshall Clow 9db9069cf3 Make regex::assign not clobber the regex in case of failure. Fixes PR#22213
llvm-svn: 225799
2015-01-13 16:49:52 +00:00
Marshall Clow b04058e8c1 Implement LWG 2217 - operator==(sub_match, string) slices on embedded '\0's
llvm-svn: 224292
2014-12-15 23:57:56 +00:00
Dan Albert 15c010a37e Base regex code on char_class_type.
__get_classname() and __bracket_expression were assuming that
char_class_type was ctype_base::mask rather than using
regex_traits<_CharT>::char_class_type.

This change allows char_class_type to be defined to something other than
ctype_base::mask so that the implementation will still work for
platforms with an 8-bit ctype mask (such as Android and OpenBSD).

llvm-svn: 214201
2014-07-29 19:23:39 +00:00
Marshall Clow 9393b5113b Fix Bug 19678 - libc++ does not correctly handle the regex: '[^\0]*'
llvm-svn: 209307
2014-05-21 16:29:50 +00:00
Marshall Clow 16da324051 Implement LWG issue 2306: match_results::reference should be value_type&, not const value_type&. This is a general move by the LWG to have the reference type of read-only containers be a non-const reference; however, there are no methods that return a non-const reference to a match_result entry, so there's no worries about getting a non-const reference to a constant object.
llvm-svn: 202214
2014-02-26 01:56:31 +00:00
Marshall Clow 7d35711187 Implement LWG Issues #2329 and #2332 - disallow iterators into temporary regexes and regexes into temporary strings
llvm-svn: 201717
2014-02-19 21:21:11 +00:00
Marshall Clow 9aafa898f9 Update __parse_DUP_COUNT and __parse_BACKREF to use the traits class to recognize digits. Fixes PR18514
llvm-svn: 199541
2014-01-18 03:40:03 +00:00
Marshall Clow 54f6bd59f5 Fix a bug in regex_token_iterator's copy constructor. Caught by Bob Wilson.
llvm-svn: 199122
2014-01-13 17:47:08 +00:00
Marshall Clow 79b0fee3c6 Fix PR18404 - 'Bug in regex_token_iterator::operator++(int) implementation'. Enhance the tests for regex_token_iterator and regex_iterator.
llvm-svn: 198878
2014-01-09 18:25:57 +00:00
Marshall Clow e604469e5c Patch by GM: apparently '__value' (two underscores) is a special name in Visual Studio, so rename the private method in <regex> with that name. GM's patch used '___value' (three underscores), but I changed that to '__regex_traits_value' because I've been burned in the past by identifiers that appear identical but are not.
llvm-svn: 193087
2013-10-21 15:43:25 +00:00
Howard Hinnant fc88dbd298 Debug mode for string. This commit also marks the first time libc++ debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib.
llvm-svn: 189114
2013-08-23 17:37:05 +00:00
Howard Hinnant f0544c2086 Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Howard Hinnant 7491a16031 Bill Fisher: This patch fixes a bug where std::regex in ECMAScript mode was ignoring capture groups inside lookahead assertions.
For example, matching /(?=(a))(a)/ to "a" should yield two captures: \1 = "a", \2 = "a"

llvm-svn: 186954
2013-07-23 16:18:04 +00:00
Howard Hinnant 22161401df Bill Fisher: This patch fixes an ill-formed comparison when parsing control escapes, e.g. "\cA\ca". The code will now throw an error_escape exception for invalid control sequences like "\c:" or "\c".
I've added the test cases to bad_escape.pass.cpp.

llvm-svn: 186335
2013-07-15 18:21:11 +00:00
Howard Hinnant c815a4e297 Bill Fisher: This patch fixes a less likely case where '\b' can back up into invalid memory, when driven by a regex_iterator (for case 1, see r185273 or http://llvm.org/bugs/show_bug.cgi?id=16240)
The attached test program also supplies a test for the case 1 fix in r185273.

llvm-svn: 186089
2013-07-11 15:32:55 +00:00
Howard Hinnant dbdeb153d8 Bill Fisher: This patch fixes a bug where regex_iterator doesn't indicate when it's restarting in the middle of a string. This bug causes /^a/ to match in the middle of the string "aaaaaaa", during iteration.
My patch uses  to communicate when  is false.

llvm-svn: 185950
2013-07-09 17:29:09 +00:00
Howard Hinnant 43bbdd29de Bill Fisher: This patch fixes a bug where the regex parser doesn't advance the pointer after reading the third character of an octal escape (in awk mode).
That is, regex{"\141", awk} results in the regular expression /a1/ instead of just /a/.

llvm-svn: 185449
2013-07-02 17:43:31 +00:00
Howard Hinnant 660f2ae422 Prevent '\b' from backing up into invalid memory. Fixes http://llvm.org/bugs/show_bug.cgi?id=16240. Sorry, I can not think of a good test case for this one, except by running valgrind as reported in the bug.
llvm-svn: 185273
2013-06-29 23:45:43 +00:00
Howard Hinnant 3f75953d82 Provide missing '{' in parsing extended quoted characters. This fixes http://llvm.org/bugs/show_bug.cgi?id=16135
llvm-svn: 185211
2013-06-28 20:31:05 +00:00
Howard Hinnant 8d1e822432 William Fisher: A bug in __lookahead::exec causes /(?=^)b/ to match ab. When makes a recursive call to , it passes true for the value of . This causes a beginning-of-line anchor (^) inside a lookahead assertion to match anywhere in the text. This fixes http://llvm.org/bugs/show_bug.cgi?id=11118
llvm-svn: 185196
2013-06-28 19:11:23 +00:00
Howard Hinnant 21246e3314 Bill Fisher: Fix for failing to throw an exception in regex when parsing an invalid escape sequence. This fixes http://llvm.org/bugs/show_bug.cgi?id=16023
llvm-svn: 185192
2013-06-28 18:57:30 +00:00
Marshall Clow 1c2c986796 Fix undefined behavior in syntax_option_type::operator~ and match_flag_type::operator./a.out Found by UBSan
llvm-svn: 177693
2013-03-22 02:13:55 +00:00
Howard Hinnant c60bf548c5 Albert Wong: definition for regex_traits<_CharT>::__regex_word.
llvm-svn: 176640
2013-03-07 19:38:08 +00:00
Howard Hinnant 6e41256f68 No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant 16694b5df5 Zhang Xiongpang: Add definitions for const data members. Fixes http://llvm.org/bugs/show_bug.cgi?id=14585.
llvm-svn: 170026
2012-12-12 21:14:28 +00:00
Argyrios Kyrtzidis 88db3171dd Don't neglect to "return *this".
llvm-svn: 165860
2012-10-13 02:03:45 +00:00
Howard Hinnant aeb85680fb Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you send me a patch to CREDITS.TXT?
llvm-svn: 163862
2012-09-14 00:39:16 +00:00
Howard Hinnant 42be98ab54 noexcept and constexpr applied to <regex>.
llvm-svn: 160594
2012-07-21 01:31:58 +00:00
Howard Hinnant c206366fd7 Quash a whole bunch of warnings
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant c003db1fca Further macro protection by replacing _[A-Z] with _[A-Z]p
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Howard Hinnant ab4f438239 Add protection from min/max macros
llvm-svn: 145407
2011-11-29 16:45:27 +00:00
Howard Hinnant 073458b1ab Windows support by Ruben Van Boxem.
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant 2a4812fd04 Fix <rdar://problem/10255403> match_results::begin() is off by one
llvm-svn: 141494
2011-10-08 14:36:16 +00:00
Howard Hinnant 54976f2619 Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
llvm-svn: 137522
2011-08-12 21:56:02 +00:00
Howard Hinnant ce48a1137d _STD -> _VSTD to avoid macro clash on windows
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant ce53420e37 Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
llvm-svn: 133008
2011-06-14 19:58:17 +00:00
Howard Hinnant 382600ff97 Jonathan Sauer found a bug in the way ^ was handled
llvm-svn: 128350
2011-03-26 20:02:27 +00:00
Howard Hinnant a0fe8c436e Chris Jefferson noted many places where function calls needed to be qualified (thanks Chris).
llvm-svn: 125510
2011-02-14 19:12:38 +00:00
Howard Hinnant 966b5a3157 N3158 Missing preconditions for default-constructed match_result objects
llvm-svn: 121282
2010-12-08 21:07:55 +00:00
Howard Hinnant 412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant 3e84caaebb visibility-decoration.
llvm-svn: 114647
2010-09-23 15:13:20 +00:00
Howard Hinnant 7609c9b665 Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
llvm-svn: 113086
2010-09-04 23:28:19 +00:00
Howard Hinnant b3371f6f49 Fixing whitespace problems
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Howard Hinnant 86550b0038 [re.alg.replace]. This finishes all of <regex>. That being said, <regex> is exceptionally difficult to thoroughly test. If anyone has the ability to test this, combined with the interest to do so, now would be a good time. :-)
llvm-svn: 111333
2010-08-18 00:13:08 +00:00
Howard Hinnant 14dcd3d1ff [re.tokiter]
llvm-svn: 111278
2010-08-17 20:42:03 +00:00
Howard Hinnant 2bf1fd99b1 [re.regiter]
llvm-svn: 111178
2010-08-16 20:21:16 +00:00
Howard Hinnant 48b242a275 Everything under [re.results]
llvm-svn: 111074
2010-08-14 18:14:02 +00:00
Howard Hinnant 5cd6658798 Everything under [re.regex]
llvm-svn: 111024
2010-08-13 18:11:23 +00:00
Howard Hinnant 54b409fdb9 now works with -fno-exceptions and -fno-rtti
llvm-svn: 110828
2010-08-11 17:04:31 +00:00