From 8d7950b87118d885baebc44ceabede68d849491d Mon Sep 17 00:00:00 2001 From: Lukas Kurz Date: Sat, 22 Feb 2025 13:17:00 +0100 Subject: [PATCH] Use std placement new on non MSVC compilers --- lib/Common/Memory/Allocator.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Common/Memory/Allocator.h b/lib/Common/Memory/Allocator.h index 5a3a099bc4f..803ee2bd0a4 100644 --- a/lib/Common/Memory/Allocator.h +++ b/lib/Common/Memory/Allocator.h @@ -1,5 +1,6 @@ //------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. +// Copyright (c) ChakraCore Project Contributors. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- #pragma once @@ -448,6 +449,8 @@ void AssertValue(void * mem, T value, uint byteCount) #define NO_EXPORT(x) x #endif +#if defined(_MSC_VER) && !defined(__clang__) + // For the debugger extension, we don't need the placement news #ifndef __PLACEMENT_NEW_INLINE #define __PLACEMENT_NEW_INLINE @@ -473,6 +476,14 @@ void * previousAllocation // Previously allocated memory #endif +#else + +// Use std inline placement new instead of custom +// See PR #7009 +#include + +#endif + //---------------------------------------- // throwing operator new overrides //----------------------------------------