diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2014-01-18 03:40:03 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2014-01-18 03:40:03 +0000 |
| commit | 9aafa898f967533ac3de491ce9bf80c222696686 (patch) | |
| tree | f109e09f2142f76e89193c6effdbc961debad28d /libcxx/include/regex | |
| parent | 5b9e5b596172fd40fb8852dfb23e3555ae497590 (diff) | |
| download | bcm5719-llvm-9aafa898f967533ac3de491ce9bf80c222696686.tar.gz bcm5719-llvm-9aafa898f967533ac3de491ce9bf80c222696686.zip | |
Update __parse_DUP_COUNT and __parse_BACKREF to use the traits class to recognize digits. Fixes PR18514
llvm-svn: 199541
Diffstat (limited to 'libcxx/include/regex')
| -rw-r--r-- | libcxx/include/regex | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libcxx/include/regex b/libcxx/include/regex index b7416f81c24..8c95145fe0b 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -3310,10 +3310,14 @@ basic_regex<_CharT, _Traits>::__parse_BACKREF(_ForwardIterator __first, _ForwardIterator __temp = _VSTD::next(__first); if (__temp != __last) { - if (*__first == '\\' && '1' <= *__temp && *__temp <= '9') - { - __push_back_ref(*__temp - '0'); - __first = ++__temp; + if (*__first == '\\') + { + int __val = __traits_.value(*__temp, 10); + if (__val >= 1 && __val <= 9) + { + __push_back_ref(__val); + __first = ++__temp; + } } } } @@ -4052,14 +4056,19 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first, _ForwardIterator __last, int& __c) { - if (__first != __last && '0' <= *__first && *__first <= '9') + if (__first != __last ) { - __c = *__first - '0'; - for (++__first; __first != __last && '0' <= *__first && *__first <= '9'; - ++__first) + int __val = __traits_.value(*__first, 10); + if ( __val != -1 ) { - __c *= 10; - __c += *__first - '0'; + __c = __val; + for (++__first; + __first != __last && ( __val = __traits_.value(*__first, 10)) != -1; + ++__first) + { + __c *= 10; + __c += __val; + } } } return __first; |

