[libcxx-commits] [libcxx] [libc++] Replace __libcpp_allocate with std::allocator in small_bufer.h (PR #234158)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 21 04:20:56 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Nikolas Klauser (philnik777)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/234158.diff
1 Files Affected:
- (modified) libcxx/include/__utility/small_buffer.h (+3-2)
``````````diff
diff --git a/libcxx/include/__utility/small_buffer.h b/libcxx/include/__utility/small_buffer.h
index 132a57f0fefab1..0dae0544cdecee 100644
--- a/libcxx/include/__utility/small_buffer.h
+++ b/libcxx/include/__utility/small_buffer.h
@@ -12,6 +12,7 @@
#include <__config>
#include <__cstddef/byte.h>
#include <__cstddef/size_t.h>
+#include <__memory/allocator.h>
#include <__memory/construct_at.h>
#include <__new/allocate.h>
#include <__new/launder.h>
@@ -68,7 +69,7 @@ class __small_buffer {
if constexpr (__fits_in_buffer<_Stored>) {
return std::launder(reinterpret_cast<_Stored*>(__buffer_));
} else {
- byte* __allocation = reinterpret_cast<byte*>(std::__libcpp_allocate<_Stored>(__element_count(1)));
+ byte* __allocation = reinterpret_cast<byte*>(std::allocator<_Stored>().allocate(1));
std::construct_at(reinterpret_cast<byte**>(__buffer_), __allocation);
return std::launder(reinterpret_cast<_Stored*>(__allocation));
}
@@ -77,7 +78,7 @@ class __small_buffer {
template <class _Stored>
_LIBCPP_HIDE_FROM_ABI void __dealloc() noexcept {
if constexpr (!__fits_in_buffer<_Stored>)
- std::__libcpp_deallocate<_Stored>(__get<_Stored>(), __element_count(1));
+ std::allocator<_Stored>().deallocate(__get<_Stored>(), 1);
}
template <class _Stored, class... _Args>
``````````
</details>
https://github.com/llvm/llvm-project/pull/234158
More information about the libcxx-commits
mailing list