[libcxx-commits] [PATCH] D110598: [libc++] P0980R1 (constexpr std::string)
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 28 01:53:36 PDT 2021
philnik updated this revision to Diff 375495.
philnik added a comment.
Code style changes in string and changed _LIBCPP_CONSTEXPR_AFTER_CXX17 to _LIBCPP_CONSTEXPR in compressed_pair
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110598/new/
https://reviews.llvm.org/D110598
Files:
libcxx/include/__memory/compressed_pair.h
libcxx/include/string
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -1617,7 +1617,7 @@
size_type (&__a)[__n_words] = __r_.first().__r.__words;
if (__libcpp_is_constant_evaluated())
{
- __r_.first() = __rep {.__l = __long {}};
+ __r_.first() = __rep();
return;
}
for (unsigned __i = 0; __i < __n_words; ++__i)
@@ -1813,11 +1813,13 @@
}
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEVAL void __begin_lifetime(pointer __p, size_t __count)
+ _LIBCPP_CONSTEXPR void __begin_lifetime(pointer __p, size_t __count)
{
if (__libcpp_is_constant_evaluated())
- for (size_t __i {}; __i < __count; ++__i)
- new (&__p[__i]) value_type();
+ {
+ for (size_t __i = 0; __i < __count; ++__i)
+ ::new (&__p[__i]) value_type();
+ }
}
friend _LIBCPP_CONSTEXPR_AFTER_CXX17 basic_string operator+<>(const basic_string&, const basic_string&);
@@ -1914,7 +1916,7 @@
__get_db()->__insert_c(this);
#endif
if (__libcpp_is_constant_evaluated())
- __init(size_type{0}, {});
+ __init(size_type{0}, value_type());
else
__zero();
}
@@ -2091,7 +2093,7 @@
{
if (__libcpp_is_constant_evaluated())
{
- __r_.first() = __rep {.__l = __long {}};
+ __r_.first() = __rep();
__r_.first().__l = __str.__r_.first().__l;
}
else
Index: libcxx/include/__memory/compressed_pair.h
===================================================================
--- libcxx/include/__memory/compressed_pair.h
+++ libcxx/include/__memory/compressed_pair.h
@@ -58,8 +58,8 @@
: __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
#endif
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference __get() _NOEXCEPT { return __value_; }
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference __get() const _NOEXCEPT { return __value_; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR reference __get() _NOEXCEPT { return __value_; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return __value_; }
private:
_Tp __value_;
@@ -95,8 +95,8 @@
: __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
#endif
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 reference __get() _NOEXCEPT { return *this; }
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 const_reference __get() const _NOEXCEPT { return *this; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR reference __get() _NOEXCEPT { return *this; }
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __get() const _NOEXCEPT { return *this; }
};
template <class _T1, class _T2>
@@ -140,19 +140,19 @@
typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
#endif
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename _Base1::reference first() _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename _Base1::reference first() _NOEXCEPT {
return static_cast<_Base1&>(*this).__get();
}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename _Base1::const_reference first() const _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename _Base1::const_reference first() const _NOEXCEPT {
return static_cast<_Base1 const&>(*this).__get();
}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename _Base2::reference second() _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename _Base2::reference second() _NOEXCEPT {
return static_cast<_Base2&>(*this).__get();
}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 typename _Base2::const_reference second() const _NOEXCEPT {
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename _Base2::const_reference second() const _NOEXCEPT {
return static_cast<_Base2 const&>(*this).__get();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110598.375495.patch
Type: text/x-patch
Size: 4118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210928/155b37f7/attachment-0001.bin>
More information about the libcxx-commits
mailing list