From 5606b4c399404c0b8f745c6702d70f26eff8b371 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 25 Mar 2024 19:32:02 +0100 Subject: Update to Clang 18, C++23, rework allocator --- deimos/core/allocator.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'deimos/core/allocator.cpp') diff --git a/deimos/core/allocator.cpp b/deimos/core/allocator.cpp index a525bfd..f7217c8 100644 --- a/deimos/core/allocator.cpp +++ b/deimos/core/allocator.cpp @@ -8,11 +8,9 @@ namespace deimos class SystemAllocatorImpl : public IAllocator { public: - SystemAllocatorImpl() : IAllocator(MemoryScope{0}) {} - void* Reallocate( void* old_ptr, int64 /* old_size */, int64 new_size, - const char* /* file */, int32 /* line */) override + MemoryScope /* scope */, const SourceLocation& /* source_location */) override { if (old_ptr == nullptr) { @@ -37,17 +35,19 @@ public: class AllocatorApiImpl : public AllocatorApi { SystemAllocatorImpl m_system_impl; + Allocator m_system; public: - AllocatorApiImpl() + constexpr AllocatorApiImpl() : + m_system{ &m_system_impl, {0} } { - system = &m_system_impl; + system = &m_system; } }; AllocatorApi* BootstrapAllocatorApi() { - static AllocatorApiImpl g_instance{}; + static constinit AllocatorApiImpl g_instance{}; return &g_instance; } -- cgit