mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 07:17:36 +00:00
Enable new[] on llvm::BumpPtrAllocator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159789 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -239,4 +239,21 @@ inline void *operator new(size_t Size, llvm::BumpPtrAllocator &Allocator) {
|
|||||||
|
|
||||||
inline void operator delete(void *, llvm::BumpPtrAllocator &) {}
|
inline void operator delete(void *, llvm::BumpPtrAllocator &) {}
|
||||||
|
|
||||||
|
inline void *operator new[](size_t Size, llvm::BumpPtrAllocator &Allocator) {
|
||||||
|
struct S {
|
||||||
|
char c;
|
||||||
|
union {
|
||||||
|
double D;
|
||||||
|
long double LD;
|
||||||
|
long long L;
|
||||||
|
void *P;
|
||||||
|
} x;
|
||||||
|
};
|
||||||
|
return Allocator.Allocate(Size, std::min((size_t)llvm::NextPowerOf2(Size),
|
||||||
|
offsetof(S, x)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator delete[](void *Ptr, llvm::BumpPtrAllocator &C, size_t) {
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LLVM_SUPPORT_ALLOCATOR_H
|
#endif // LLVM_SUPPORT_ALLOCATOR_H
|
||||||
|
|||||||
Reference in New Issue
Block a user