Skip to content

Commit ae0e037

Browse files
committed
[libc++] Simplify the _LIBCPP_CONSTEXPR markings on starts_with() etc.
This came out of review comments on D110598. Differential Revision: https://reviews.llvm.org/D110637
1 parent 826d3ea commit ae0e037

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

libcxx/include/string

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,28 +1406,28 @@ public:
14061406
int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
14071407

14081408
#if _LIBCPP_STD_VER > 17
1409-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1410-
bool starts_with(__self_view __sv) const _NOEXCEPT
1409+
constexpr _LIBCPP_INLINE_VISIBILITY
1410+
bool starts_with(__self_view __sv) const noexcept
14111411
{ return __self_view(data(), size()).starts_with(__sv); }
14121412

1413-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1414-
bool starts_with(value_type __c) const _NOEXCEPT
1413+
constexpr _LIBCPP_INLINE_VISIBILITY
1414+
bool starts_with(value_type __c) const noexcept
14151415
{ return !empty() && _Traits::eq(front(), __c); }
14161416

1417-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1418-
bool starts_with(const value_type* __s) const _NOEXCEPT
1417+
constexpr _LIBCPP_INLINE_VISIBILITY
1418+
bool starts_with(const value_type* __s) const noexcept
14191419
{ return starts_with(__self_view(__s)); }
14201420

1421-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1422-
bool ends_with(__self_view __sv) const _NOEXCEPT
1421+
constexpr _LIBCPP_INLINE_VISIBILITY
1422+
bool ends_with(__self_view __sv) const noexcept
14231423
{ return __self_view(data(), size()).ends_with( __sv); }
14241424

1425-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1426-
bool ends_with(value_type __c) const _NOEXCEPT
1425+
constexpr _LIBCPP_INLINE_VISIBILITY
1426+
bool ends_with(value_type __c) const noexcept
14271427
{ return !empty() && _Traits::eq(back(), __c); }
14281428

1429-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
1430-
bool ends_with(const value_type* __s) const _NOEXCEPT
1429+
constexpr _LIBCPP_INLINE_VISIBILITY
1430+
bool ends_with(const value_type* __s) const noexcept
14311431
{ return ends_with(__self_view(__s)); }
14321432
#endif
14331433

libcxx/include/string_view

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ public:
255255
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
256256
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
257257

258-
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
258+
_LIBCPP_INLINE_VISIBILITY
259259
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
260260

261-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
261+
_LIBCPP_INLINE_VISIBILITY
262262
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
263263

264264
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
@@ -618,28 +618,28 @@ public:
618618
}
619619

620620
#if _LIBCPP_STD_VER > 17
621-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
622-
bool starts_with(basic_string_view __s) const _NOEXCEPT
621+
constexpr _LIBCPP_INLINE_VISIBILITY
622+
bool starts_with(basic_string_view __s) const noexcept
623623
{ return size() >= __s.size() && compare(0, __s.size(), __s) == 0; }
624624

625-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
626-
bool starts_with(value_type __c) const _NOEXCEPT
625+
constexpr _LIBCPP_INLINE_VISIBILITY
626+
bool starts_with(value_type __c) const noexcept
627627
{ return !empty() && _Traits::eq(front(), __c); }
628628

629-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
630-
bool starts_with(const value_type* __s) const _NOEXCEPT
629+
constexpr _LIBCPP_INLINE_VISIBILITY
630+
bool starts_with(const value_type* __s) const noexcept
631631
{ return starts_with(basic_string_view(__s)); }
632632

633-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
634-
bool ends_with(basic_string_view __s) const _NOEXCEPT
633+
constexpr _LIBCPP_INLINE_VISIBILITY
634+
bool ends_with(basic_string_view __s) const noexcept
635635
{ return size() >= __s.size() && compare(size() - __s.size(), npos, __s) == 0; }
636636

637-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
638-
bool ends_with(value_type __c) const _NOEXCEPT
637+
constexpr _LIBCPP_INLINE_VISIBILITY
638+
bool ends_with(value_type __c) const noexcept
639639
{ return !empty() && _Traits::eq(back(), __c); }
640640

641-
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
642-
bool ends_with(const value_type* __s) const _NOEXCEPT
641+
constexpr _LIBCPP_INLINE_VISIBILITY
642+
bool ends_with(const value_type* __s) const noexcept
643643
{ return ends_with(basic_string_view(__s)); }
644644
#endif
645645

0 commit comments

Comments
 (0)