[libc-commits] [PATCH] D139584: [libc] Add custom operator new to handle allocation failures gracefully.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Dec 7 14:41:31 PST 2022


sivachandra created this revision.
sivachandra added reviewers: michaelrj, lntue.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
sivachandra requested review of this revision.

This patch adds the implementation of the custom operator new functions.
The implementation of the internal strdup has been updated to use
operator new for allocation.

We will make it a policy and document that all allocations have to go
through the libc's own operator new. A future change will also add
operator delete replacements and make it a policy that deallocations in
libc internal code have to go through those replacements.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139584

Files:
  libc/src/__support/CPP/new.h
  libc/src/string/CMakeLists.txt
  libc/src/string/allocating_string_utils.h
  libc/src/string/strdup.cpp
  libc/src/unistd/linux/getcwd.cpp
  libc/test/src/string/CMakeLists.txt
  libc/test/src/string/strdup_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139584.481071.patch
Type: text/x-patch
Size: 6889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221207/64e624a3/attachment.bin>


More information about the libc-commits mailing list