[libcxx-commits] [libcxx] 6753264 - Add flag _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATIONS for basic_string ABI

Martijn Vels via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 2 07:27:13 PST 2020


Author: Martijn Vels
Date: 2020-03-02T10:26:37-05:00
New Revision: 675326466b532bb329f9ded090d5337bc48b148a

URL: https://github.com/llvm/llvm-project/commit/675326466b532bb329f9ded090d5337bc48b148a
DIFF: https://github.com/llvm/llvm-project/commit/675326466b532bb329f9ded090d5337bc48b148a.diff

LOG: Add flag _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATIONS for basic_string ABI

Summary: This review is a mostly trivial change to use an explicit ABI flag for the unstable external template list. This follows the practice for an ABI flag per feature, and provides a spot for the rational / motivation for the flag.

Reviewers: EricWF, ldionne

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

Added: 
    

Modified: 
    libcxx/include/__config
    libcxx/include/string
    libcxx/src/string.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index b14cc84eadea..9bd7fc9932c8 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -102,6 +102,9 @@
 #  define _LIBCPP_ABI_OPTIMIZED_FUNCTION
 // All the regex constants must be distinct and nonzero.
 #  define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+// Re-worked external template instantiations for std::string with a focus on
+// performance and fast-path inlining.
+#  define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
 #elif _LIBCPP_ABI_VERSION == 1
 #  if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
 // Enable compiling copies of now inline methods into the dylib to support

diff  --git a/libcxx/include/string b/libcxx/include/string
index 7688d3ff29ec..c2a4220e276a 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -4381,7 +4381,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
 
 #endif  // _LIBCPP_DEBUG_LEVEL >= 2
 
-#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
+#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, char)
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
 #else

diff  --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp
index 0345170a70ee..5105594cf38b 100644
--- a/libcxx/src/string.cpp
+++ b/libcxx/src/string.cpp
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __basic_string_common<true>;
 
-#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
+#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
 _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
 #else


        


More information about the libcxx-commits mailing list