Update libcxx

llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6
This commit is contained in:
Jakub Konka committed 2020-12-16 12:18:55 +01:00
1 parent 1e66ac5755
commit f9a11fbfaf
106 files changed
+5346 -4751

No files matched your search

+122 -51
View File
@@ -32,7 +32,8 @@ enum syntax_option_type
extended = unspecified,
awk = unspecified,
grep = unspecified,
egrep = unspecified
egrep = unspecified,
multiline = unspecified
};
constexpr syntax_option_type operator~(syntax_option_type f);
@@ -142,6 +143,7 @@ public:
static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
static constexpr regex_constants::syntax_option_type multiline = regex_constants::multiline;
// construct/copy/destroy:
basic_regex();
@@ -802,7 +804,9 @@ enum syntax_option_type
extended = 1 << 5,
awk = 1 << 6,
grep = 1 << 7,
egrep = 1 << 8
egrep = 1 << 8,
// 1 << 9 may be used by ECMAScript
multiline = 1 << 10
};
inline _LIBCPP_CONSTEXPR
@@ -1982,24 +1986,33 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const
// __l_anchor
template <class _CharT>
class __l_anchor
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool __is_eol(_CharT c)
{
return c == '\r' || c == '\n';
}
template <class _CharT>
class __l_anchor_multiline
: public __owns_one_state<_CharT>
{
typedef __owns_one_state<_CharT> base;
bool __multiline;
public:
typedef _VSTD::__state<_CharT> __state;
_LIBCPP_INLINE_VISIBILITY
__l_anchor(__node<_CharT>* __s)
: base(__s) {}
__l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
: base(__s), __multiline(__multiline) {}
virtual void __exec(__state&) const;
};
template <class _CharT>
void
__l_anchor<_CharT>::__exec(__state& __s) const
__l_anchor_multiline<_CharT>::__exec(__state& __s) const
{
if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
!(__s.__flags_ & regex_constants::match_not_bol))
@@ -2007,6 +2020,13 @@ __l_anchor<_CharT>::__exec(__state& __s) const
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
else if (__multiline &&
!__s.__at_first_ &&
__is_eol(*_VSTD::prev(__s.__current_)))
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
else
{
__s.__do_ = __state::__reject;
@@ -2017,24 +2037,26 @@ __l_anchor<_CharT>::__exec(__state& __s) const
// __r_anchor
template <class _CharT>
class __r_anchor
class __r_anchor_multiline
: public __owns_one_state<_CharT>
{
typedef __owns_one_state<_CharT> base;
bool __multiline;
public:
typedef _VSTD::__state<_CharT> __state;
_LIBCPP_INLINE_VISIBILITY
__r_anchor(__node<_CharT>* __s)
: base(__s) {}
__r_anchor_multiline(bool __multiline, __node<_CharT>* __s)
: base(__s), __multiline(__multiline) {}
virtual void __exec(__state&) const;
};
template <class _CharT>
void
__r_anchor<_CharT>::__exec(__state& __s) const
__r_anchor_multiline<_CharT>::__exec(__state& __s) const
{
if (__s.__current_ == __s.__last_ &&
!(__s.__flags_ & regex_constants::match_not_eol))
@@ -2042,6 +2064,11 @@ __r_anchor<_CharT>::__exec(__state& __s) const
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
else if (__multiline && __is_eol(*__s.__current_))
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
}
else
{
__s.__do_ = __state::__reject;
@@ -2448,7 +2475,7 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
{
const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
const bool __in_neg_chars =
std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
_VSTD::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
__neg_chars_.end();
if (!(__in_neg_mask || __in_neg_chars))
{
@@ -2507,7 +2534,17 @@ __exit:
template <class _CharT, class _Traits> class __lookahead;
template <class _CharT, class _Traits = regex_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS basic_regex
class _LIBCPP_TEMPLATE_VIS basic_regex;
typedef basic_regex<char> regex;
typedef basic_regex<wchar_t> wregex;
template <class _CharT, class _Traits>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(regex)
_LIBCPP_PREFERRED_NAME(wregex)
basic_regex
{
public:
// types:
@@ -2541,17 +2578,18 @@ public:
static const regex_constants::syntax_option_type awk = regex_constants::awk;
static const regex_constants::syntax_option_type grep = regex_constants::grep;
static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
basic_regex()
: __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(nullptr)
{}
_LIBCPP_INLINE_VISIBILITY
explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(nullptr)
{
__init(__p, __p + __traits_.length(__p));
}
@@ -2559,7 +2597,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(nullptr)
{
__init(__p, __p + __len);
}
@@ -2571,7 +2609,7 @@ public:
explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(nullptr)
{
__init(__p.begin(), __p.end());
}
@@ -2581,7 +2619,7 @@ public:
basic_regex(_ForwardIterator __first, _ForwardIterator __last,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(nullptr)
{
__init(__first, __last);
}
@@ -2590,7 +2628,7 @@ public:
basic_regex(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
__end_(nullptr)
{
__init(__il.begin(), __il.end());
}
@@ -2707,6 +2745,12 @@ private:
_LIBCPP_INLINE_VISIBILITY
unsigned __loop_count() const {return __loop_count_;}
_LIBCPP_INLINE_VISIBILITY
bool __use_multiline() const
{
return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
}
template <class _ForwardIterator>
void
__init(_ForwardIterator __first, _ForwardIterator __last);
@@ -4119,7 +4163,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
__first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
++__first)
{
if (__c >= std::numeric_limits<int>::max() / 10)
if (__c >= numeric_limits<int>::max() / 10)
__throw_regex_error<regex_constants::error_badbrace>();
__c *= 10;
__c += __val;
@@ -4383,7 +4427,7 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
for (++__first;
__first != __last && '0' <= *__first && *__first <= '9'; ++__first)
{
if (__v >= std::numeric_limits<unsigned>::max() / 10)
if (__v >= numeric_limits<unsigned>::max() / 10)
__throw_regex_error<regex_constants::error_backref>();
__v = 10 * __v + *__first - '0';
}
@@ -4746,7 +4790,7 @@ template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_l_anchor()
{
__end_->first() = new __l_anchor<_CharT>(__end_->first());
__end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
@@ -4754,7 +4798,7 @@ template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_r_anchor()
{
__end_->first() = new __r_anchor<_CharT>(__end_->first());
__end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
@@ -4845,13 +4889,21 @@ basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
typedef basic_regex<char> regex;
typedef basic_regex<wchar_t> wregex;
// sub_match
typedef sub_match<const char*> csub_match;
typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<string::const_iterator> ssub_match;
typedef sub_match<wstring::const_iterator> wssub_match;
template <class _BidirectionalIterator>
class _LIBCPP_TEMPLATE_VIS sub_match
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(csub_match)
_LIBCPP_PREFERRED_NAME(wcsub_match)
_LIBCPP_PREFERRED_NAME(ssub_match)
_LIBCPP_PREFERRED_NAME(wssub_match)
sub_match
: public pair<_BidirectionalIterator, _BidirectionalIterator>
{
public:
@@ -4886,11 +4938,6 @@ public:
{return str().compare(__s);}
};
typedef sub_match<const char*> csub_match;
typedef sub_match<const wchar_t*> wcsub_match;
typedef sub_match<string::const_iterator> ssub_match;
typedef sub_match<wstring::const_iterator> wssub_match;
template <class _BiIter>
inline _LIBCPP_INLINE_VISIBILITY
bool
@@ -5273,8 +5320,19 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
return __os << __m.str();
}
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<string::const_iterator> smatch;
typedef match_results<wstring::const_iterator> wsmatch;
template <class _BidirectionalIterator, class _Allocator>
class _LIBCPP_TEMPLATE_VIS match_results
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(cmatch)
_LIBCPP_PREFERRED_NAME(wcmatch)
_LIBCPP_PREFERRED_NAME(smatch)
_LIBCPP_PREFERRED_NAME(wsmatch)
match_results
{
public:
typedef _Allocator allocator_type;
@@ -5556,7 +5614,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
'0' <= __fmt_first[1] && __fmt_first[1] <= '9')
{
++__fmt_first;
if (__idx >= std::numeric_limits<size_t>::max() / 10)
if (__idx >= numeric_limits<size_t>::max() / 10)
__throw_regex_error<regex_constants::error_escape>();
__idx = 10 * __idx + *__fmt_first - '0';
}
@@ -5594,11 +5652,6 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
swap(__ready_, __m.__ready_);
}
typedef match_results<const char*> cmatch;
typedef match_results<const wchar_t*> wcmatch;
typedef match_results<string::const_iterator> smatch;
typedef match_results<wstring::const_iterator> wsmatch;
template <class _BidirectionalIterator, class _Allocator>
bool
operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
@@ -6182,7 +6235,21 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS regex_iterator
class _LIBCPP_TEMPLATE_VIS regex_iterator;
typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
template <class _BidirectionalIterator, class _CharT, class _Traits>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(cregex_iterator)
_LIBCPP_PREFERRED_NAME(wcregex_iterator)
_LIBCPP_PREFERRED_NAME(sregex_iterator)
_LIBCPP_PREFERRED_NAME(wsregex_iterator)
regex_iterator
{
public:
typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6291,17 +6358,26 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
return *this;
}
typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<const wchar_t*> wcregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
// regex_token_iterator
template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS regex_token_iterator
class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
typedef regex_token_iterator<const char*> cregex_token_iterator;
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
template <class _BidirectionalIterator, class _CharT, class _Traits>
class
_LIBCPP_TEMPLATE_VIS
_LIBCPP_PREFERRED_NAME(cregex_token_iterator)
_LIBCPP_PREFERRED_NAME(wcregex_token_iterator)
_LIBCPP_PREFERRED_NAME(sregex_token_iterator)
_LIBCPP_PREFERRED_NAME(wsregex_token_iterator)
regex_token_iterator
{
public:
typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6367,7 +6443,7 @@ public:
regex_constants::match_flag_type __m =
regex_constants::match_default);
#if _LIBCPP_STD_VER > 11
template <std::size_t _Np>
template <size_t _Np>
regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b,
const regex_type&& __re,
@@ -6579,11 +6655,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
return *this;
}
typedef regex_token_iterator<const char*> cregex_token_iterator;
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
// regex_replace
template <class _OutputIterator, class _BidirectionalIterator,