[libc-commits] [libc] 5345901 - [libc][new] Add placement new functions (#94290)

via libc-commits libc-commits at lists.llvm.org
Tue Jun 4 12:10:12 PDT 2024


Author: PiJoules
Date: 2024-06-04T12:10:08-07:00
New Revision: 534590144f7c7ec34b8e5e95aba3e4f214b074eb

URL: https://github.com/llvm/llvm-project/commit/534590144f7c7ec34b8e5e95aba3e4f214b074eb
DIFF: https://github.com/llvm/llvm-project/commit/534590144f7c7ec34b8e5e95aba3e4f214b074eb.diff

LOG: [libc][new] Add placement new functions (#94290)

Added: 
    

Modified: 
    libc/src/__support/CPP/new.h

Removed: 
    


################################################################################
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