[libc] Implement cpp::unique_ptr utility Implemented cpp::unique_ptr and cpp::default_delete in libc/src/__support/CPP/unique_ptr.h for internal use within LLVM-libc. * Added cpp::default_delete and its array specialization. * Implemented cpp::unique_ptr with support for custom deleters and array specialization. * Applied LIBC_TRIVIAL_ABI to unique_ptr and LIBC_NO_UNIQUE_ADDRESS to the deleter to enable empty member optimization and register-passing ABI. * Defined portable LIBC_NO_UNIQUE_ADDRESS and LIBC_TRIVIAL_ABI macros in attributes.h. * Included is_assignable.h in type_traits.h to support conversion assignment constraints. * Modernized template constraints using enable_if_t and is_convertible_v. * Added comprehensive unit tests in libc/test/src/__support/CPP/unique_ptr_test.cpp, including coverage for reset sequencing, custom deleters, and conversion constructors. This is a simplified implementation with the following limitations: * No support for custom pointer types (hardcoded to T*). * No support for reference deleter types or array conversion. Adding this to LLVM libc because some things (like regex) require dynamic memory allocation, and this will help with correct memory management. Assisted-by: Automated tooling, human reviewed. |
||
|---|---|---|
| .. | ||
| include | ||
| integration | ||
| IntegrationTest | ||
| shared | ||
| src | ||
| UnitTest | ||
| utils | ||
| CMakeLists.txt | ||
| lit.cfg.py | ||
| lit.site.cfg.py.in | ||