aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/regex
diff options
context:
space:
mode:
authorvarconst <varconsteq@gmail.com>2023-06-27 16:40:39 -0700
committervarconst <varconsteq@gmail.com>2023-06-28 15:10:31 -0700
commitcd0ad4216cb962f160b1b0054df6f72ce6f9f766 (patch)
tree98f2f5f3ae1c721e9e954d374fe2b316ee86be96 /libcxx/include/regex
parent699e0bed4bfead826e210025bf33e5a1997c018b (diff)
downloadllvm-cd0ad4216cb962f160b1b0054df6f72ce6f9f766.zip
llvm-cd0ad4216cb962f160b1b0054df6f72ce6f9f766.tar.gz
llvm-cd0ad4216cb962f160b1b0054df6f72ce6f9f766.tar.bz2
[libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT_UNCATEGORIZED`.
Replace most uses of `_LIBCPP_ASSERT` with `_LIBCPP_ASSERT_UNCATEGORIZED`. This is done as a prerequisite to introducing hardened mode to libc++. The idea is to make enabling assertions an opt-in with (somewhat) fine-grained controls over which categories of assertions are enabled. The vast majority of assertions are currently uncategorized; the new macro will allow turning on `_LIBCPP_ASSERT` (the underlying mechanism for all kinds of assertions) without enabling all the uncategorized assertions (in the future; this patch preserves the current behavior). Differential Revision: https://reviews.llvm.org/D153816
Diffstat (limited to 'libcxx/include/regex')
-rw-r--r--libcxx/include/regex14
1 files changed, 7 insertions, 7 deletions
diff --git a/libcxx/include/regex b/libcxx/include/regex
index d72c5e1..fd364cb 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -5533,38 +5533,38 @@ public:
_LIBCPP_INLINE_VISIBILITY
difference_type length(size_type __sub = 0) const
{
- _LIBCPP_ASSERT(ready(), "match_results::length() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready");
return (*this)[__sub].length();
}
_LIBCPP_INLINE_VISIBILITY
difference_type position(size_type __sub = 0) const
{
- _LIBCPP_ASSERT(ready(), "match_results::position() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready");
return _VSTD::distance(__position_start_, (*this)[__sub].first);
}
_LIBCPP_INLINE_VISIBILITY
string_type str(size_type __sub = 0) const
{
- _LIBCPP_ASSERT(ready(), "match_results::str() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready");
return (*this)[__sub].str();
}
_LIBCPP_INLINE_VISIBILITY
const_reference operator[](size_type __n) const
{
- _LIBCPP_ASSERT(ready(), "match_results::operator[]() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready");
return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
}
_LIBCPP_INLINE_VISIBILITY
const_reference prefix() const
{
- _LIBCPP_ASSERT(ready(), "match_results::prefix() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready");
return __prefix_;
}
_LIBCPP_INLINE_VISIBILITY
const_reference suffix() const
{
- _LIBCPP_ASSERT(ready(), "match_results::suffix() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready");
return __suffix_;
}
@@ -5704,7 +5704,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
const char_type* __fmt_first, const char_type* __fmt_last,
regex_constants::match_flag_type __flags) const
{
- _LIBCPP_ASSERT(ready(), "match_results::format() called when not ready");
+ _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready");
if (__flags & regex_constants::format_sed)
{
for (; __fmt_first != __fmt_last; ++__fmt_first)