[libcxx-commits] [PATCH] D118733: [libc++] Remove the std::string base class
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 1 13:15:58 PST 2022
philnik created this revision.
philnik added reviewers: ldionne, Quuxplusone, Mordante.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Removing the base class of std::basic_string is not an ABI break, so we can remove any references to it from the header.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118733
Files:
libcxx/include/string
libcxx/src/string.cpp
Index: libcxx/src/string.cpp
===================================================================
--- libcxx/src/string.cpp
+++ libcxx/src/string.cpp
@@ -22,13 +22,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
-void __basic_string_common<true>::__throw_length_error() const {
- _VSTD::__throw_length_error("basic_string");
-}
-void __basic_string_common<true>::__throw_out_of_range() const {
- _VSTD::__throw_out_of_range("basic_string");
-}
+template <bool>
+struct __basic_string_common;
+
+template <>
+struct __basic_string_common<true> {
+ // Both are defined in string.cpp
+ _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_length_error() const {
+ _VSTD::__throw_length_error("basic_string");
+ }
+ _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const {
+ _VSTD::__throw_out_of_range("basic_string");
+ }
+};
+
#endif
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -618,18 +618,6 @@
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
-#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
-template <bool>
-struct __basic_string_common;
-
-template <>
-struct __basic_string_common<true> {
- // Both are defined in string.cpp
- _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_length_error() const;
- _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const;
-};
-#endif
-
template <class _Iter>
struct __string_is_trivial_iterator : public false_type {};
@@ -682,9 +670,6 @@
_LIBCPP_PREFERRED_NAME(u32string)
#endif
basic_string
-#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
- : private __basic_string_common<true> // This base class is historical, but it needs to remain for ABI compatibility
-#endif
{
public:
typedef basic_string __self;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118733.405076.patch
Type: text/x-patch
Size: 2102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220201/ab423da0/attachment-0001.bin>
More information about the libcxx-commits
mailing list