[libc-commits] [libc] [libc][new] Add placement new functions (PR #94290)
via libc-commits
libc-commits at lists.llvm.org
Mon Jun 3 15:38:00 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: None (PiJoules)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/94290.diff
1 Files Affected:
- (modified) libc/src/__support/CPP/new.h (+4)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/94290
More information about the libc-commits
mailing list