aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src/string.cpp
diff options
context:
space:
mode:
authorNikolas Klauser <nikolasklauser@berlin.de>2022-02-02 20:15:40 +0100
committerNikolas Klauser <nikolasklauser@berlin.de>2022-02-03 22:57:23 +0100
commit5173f43cc892539271c34c5612fe783b51025da9 (patch)
tree0d8b58241ca692b239ac06198cb88d137a77e9df /libcxx/src/string.cpp
parent3d0b619261392f5f24a7b9961b24cdd621829c13 (diff)
downloadllvm-5173f43cc892539271c34c5612fe783b51025da9.zip
llvm-5173f43cc892539271c34c5612fe783b51025da9.tar.gz
llvm-5173f43cc892539271c34c5612fe783b51025da9.tar.bz2
[libc++] Remove the std::string base class
Removing the base class of std::basic_string is not an ABI break, so we can remove any references to it from the header. Reviewed By: ldionne, Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D118733
Diffstat (limited to 'libcxx/src/string.cpp')
-rw-r--r--libcxx/src/string.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp
index 3c63f40..3cde2e9 100644
--- a/libcxx/src/string.cpp
+++ b/libcxx/src/string.cpp
@@ -21,15 +21,26 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifndef _LIBCPP_ABI_NO_BASIC_STRING_BASE_CLASS
+#ifndef _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
+
+template <bool>
+struct __basic_string_common;
+
+// The struct isn't declared anymore in the headers. It's only here for ABI compatibility.
+template <>
+struct __basic_string_common<true> {
+ _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_length_error() const;
+ _LIBCPP_NORETURN _LIBCPP_EXPORTED_FROM_ABI void __throw_out_of_range() const;
+};
+
void __basic_string_common<true>::__throw_length_error() const {
- _VSTD::__throw_length_error("basic_string");
+ std::__throw_length_error("basic_string");
}
-
void __basic_string_common<true>::__throw_out_of_range() const {
- _VSTD::__throw_out_of_range("basic_string");
+ std::__throw_out_of_range("basic_string");
}
-#endif
+
+#endif // _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION