[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
Fri Dec 9 23:58:43 PST 2022


sivachandra added inline comments.


================
Comment at: libc/src/__support/CPP/new.h:54
+inline void *operator new(size_t size, __llvm_libc::AllocChecker *ac) noexcept {
+  return __llvm_libc::AllocChecker::alloc(size, *ac);
+}
----------------
lntue wrote:
> What should happen if `ac == nullptr`?  Does second parameter has to be a pointer according to the standard, or it can be a reference instead?
Ah, good catch! I likely mixed up coding styles here. I have updated to use reference args throughout.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139584/new/

https://reviews.llvm.org/D139584



More information about the libc-commits mailing list