[libcxx-commits] [libcxx] [libc++] Pass type information down to __libcpp_allocate (PR #118837)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 20 00:53:13 PST 2024
================
@@ -47,52 +47,61 @@ _LIBCPP_HIDE_FROM_ABI void __libcpp_operator_delete(_Args... __args) _NOEXCEPT {
#endif
}
+template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_allocate(size_t __size, size_t __align) {
----------------
philnik777 wrote:
```suggestion
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _Tp* __libcpp_allocate(__element_count __size, size_t __align = _LIBCPP_ALIGNOF(_Tp)) {
_LIBCPP_ASSERT_INTERNAL(__align >= _LIBCPP_ALIGNOF(_Tp), "Tried to allocate underaligned buffer");
```
Since we pass the type anyways we might as well improve the API.
https://github.com/llvm/llvm-project/pull/118837
More information about the libcxx-commits
mailing list