[libc++] Remove std::basic_string's base class in ABIv2

Remove `std::basic_string`'s base class in ABI version 2

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D116334

NOKEYCHECK=True
GitOrigin-RevId: 014a673441c6050683e059a547ffcbb03004730d
diff --git a/src/string.cpp b/src/string.cpp
index 608dcb2..3c63f40 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -21,6 +21,7 @@
 
 _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");
 }
@@ -28,6 +29,7 @@
 void __basic_string_common<true>::__throw_out_of_range() const {
     _VSTD::__throw_out_of_range("basic_string");
 }
+#endif
 
 #define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
 #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION