[libcxx-commits] [libcxx] 3d20ba7 - [libc++][NFC] Use [[deprecated]] for __grow_by (#209126)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 27 08:16:08 PDT 2026


Author: Nikolas Klauser
Date: 2026-07-27T11:16:02-04:00
New Revision: 3d20ba7135d93de7a6cd7db5a196c41d25e391a7

URL: https://github.com/llvm/llvm-project/commit/3d20ba7135d93de7a6cd7db5a196c41d25e391a7
DIFF: https://github.com/llvm/llvm-project/commit/3d20ba7135d93de7a6cd7db5a196c41d25e391a7.diff

LOG: [libc++][NFC] Use [[deprecated]] for __grow_by (#209126)

`__grow_by` is an internal function, and we deprecated it to avoid
accidental use of it inside the library. `_LIBCPP_DEPRECATED_` is meant
for user-configuration, which doesn't apply here.

Fixes #124940

Added: 
    

Modified: 
    libcxx/include/string

Removed: 
    


################################################################################
diff  --git a/libcxx/include/string b/libcxx/include/string
index a297a05813cee..39de836dbcf85 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -2343,17 +2343,16 @@ private:
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
   __init_with_size(_InputIterator __first, _Sentinel __last, size_type __sz);
 
-  _LIBCPP_CONSTEXPR_SINCE_CXX20
+  [[__deprecated__("use __grow_by_without_replace")]] _LIBCPP_CONSTEXPR_SINCE_CXX20
 #  if _LIBCPP_ABI_VERSION >= 2 //  We want to use the function in the dylib in ABIv1
   _LIBCPP_HIDE_FROM_ABI
 #  endif
-  _LIBCPP_DEPRECATED_("use __grow_by_without_replace") void __grow_by(
-      size_type __old_cap,
-      size_type __delta_cap,
-      size_type __old_sz,
-      size_type __n_copy,
-      size_type __n_del,
-      size_type __n_add = 0);
+  void __grow_by(size_type __old_cap,
+                 size_type __delta_cap,
+                 size_type __old_sz,
+                 size_type __n_copy,
+                 size_type __n_del,
+                 size_type __n_add = 0);
   _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __grow_by_without_replace(
       size_type __old_cap,
       size_type __delta_cap,
@@ -2682,7 +2681,7 @@ void _LIBCPP_CONSTEXPR_SINCE_CXX20
 #  if _LIBCPP_ABI_VERSION >= 2 // We want to use the function in the dylib in ABIv1
 _LIBCPP_HIDE_FROM_ABI
 #  endif
-_LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Traits, _Allocator>::__grow_by(
+basic_string<_CharT, _Traits, _Allocator>::__grow_by(
     size_type __old_cap,
     size_type __delta_cap,
     size_type __old_sz,


        


More information about the libcxx-commits mailing list