This commit deprecates std::basic_string::__grow_by, which is part of ABIv1. The function is replaced by std::basic_string:__grow_by_without_replace, which is not part of ABI.
- The original function __grow_by is deprecated because it does not set the string size, therefore it may not update the size when the size is changed, and it may also not set the size at all when the string was short initially. This leads to unpredictable size value. It is not removed or changed to avoid breaking the ABI.
- The commit adds _LIBCPP_HIDE_FROM_ABI guarded by _LIBCPP_ABI_VERSION >= 2 to __grow_by. This allows the function to be used in the dylib in ABIv1 without raising the [abi:v170000] error and removes it from future ABIs. _LIBCPP_HIDE_FROM_ABI_AFTER_V1 cannot be used.
- Additionally, __grow_by has been removed from _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST in libcxx/include/__string/extern_template_lists.h.
This bugfix is necessary to implement string ASan annotations, because it mitigates the problems encountered in D132769.
We can't remove this function from the explicit instantiation list, since that would be an ABI break.