From 93a6b6119b6b65c4f6b00ca12d745e21b679c82f Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Fri, 27 Jan 2023 20:53:57 +0100 Subject: Add ASAN support + fixes (#2614) * Add ASAN support to premake * Fix StringRepresentation when ASAN is enabled * Fix deep recursion in slang-generate * Fix hello-world example * Fix gpu-printing example * Linux fix * Try fixing linux * Add missing include --- source/core/slang-string.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source/core') diff --git a/source/core/slang-string.h b/source/core/slang-string.h index 028eec3e4..ecdba46be 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -315,6 +315,15 @@ namespace Slang return cloneWithCapacity(newCapacity); } + + /// Overload delete to silence ASAN new-delete-type-mismatch errors. + /// These occur because the allocation size of StringRepresentation + /// does not match deallocation size (due variable sized string payload). + void operator delete(void* p) + { + StringRepresentation* str = (StringRepresentation*) p; + ::operator delete(str); + } }; class String; -- cgit v1.2.3