mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Runtime: Remove custom operator new(InPlace).
C++ no longer imposes a null check requirement on placement 'new', and clang no longer emits the null check. This hack is no longer needed.
This commit is contained in:
@@ -21,21 +21,6 @@
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace swift {
|
||||
enum InPlace_t { InPlace };
|
||||
}
|
||||
|
||||
/// A slightly more efficient version of the global placement operator new.
|
||||
///
|
||||
/// Unlike the standard global placement operator new, this operator
|
||||
/// is not declared noexcept, which means it is not allowed to return
|
||||
/// null under the language semantics, which eliminates an unnecessary
|
||||
/// null check that the compiler would otherwise have to insert.
|
||||
/// (C++ is dumb.)
|
||||
inline void *operator new(size_t size, void *ptr, swift::InPlace_t) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
namespace swift {
|
||||
|
||||
// FIXME: Use C11 aligned_alloc or Windows _aligned_malloc if available.
|
||||
|
||||
Reference in New Issue
Block a user