[libc-commits] [libc] [libc][new] Add placement new functions (PR #94290)
via libc-commits
libc-commits at lists.llvm.org
Mon Jun 3 15:37:27 PDT 2024
https://github.com/PiJoules created https://github.com/llvm/llvm-project/pull/94290
None
>From 0ae1916bd56f7e68c2d6ff98f4c202ea3802bb41 Mon Sep 17 00:00:00 2001
From: Leonard Chan <leonardchan at google.com>
Date: Mon, 3 Jun 2024 15:36:18 -0700
Subject: [PATCH] [libc][new] Add placement new functions
---
libc/src/__support/CPP/new.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libc/src/__support/CPP/new.h b/libc/src/__support/CPP/new.h
index 6261dc1ffde6f..72187b70d7d24 100644
--- a/libc/src/__support/CPP/new.h
+++ b/libc/src/__support/CPP/new.h
@@ -74,6 +74,10 @@ LIBC_INLINE void *operator new[](size_t size, std::align_val_t align,
return LIBC_NAMESPACE::AllocChecker::aligned_alloc(size, align, ac);
}
+LIBC_INLINE void *operator new(size_t, void *p) { return p; }
+
+LIBC_INLINE void *operator new[](size_t, void *p) { return p; }
+
// The ideal situation would be to define the various flavors of operator delete
// inlinelike we do with operator new above. However, since we need operator
// delete prototypes to match those specified by the C++ standard, we cannot
More information about the libc-commits
mailing list