diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-04-29 15:56:49 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-04-29 16:58:51 +0300 |
commit | a5fdff26b1f3d9765fc28be780c281e90402fe85 (patch) | |
tree | 9088f7d065f29b863c097815d410c74426260e10 | |
parent | 1ace224c633df1a00d1a73f18c579520fcc92411 (diff) |
Fix ASAN warnings with Cycles OSL
-rw-r--r-- | intern/cycles/render/nodes.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index fb9cf0c9836..99cb0b779b8 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -1600,11 +1600,23 @@ class SetNormalNode : public ShaderNode { NODE_SOCKET_API(float3, direction) }; -class OSLNode : public ShaderNode { +class OSLNode final : public ShaderNode { public: static OSLNode *create(ShaderGraph *graph, size_t num_inputs, const OSLNode *from = NULL); ~OSLNode(); + static void operator delete(void *ptr) + { + /* Override delete operator to silence new-delete-type-mismatch ASAN warnings + * regarding size mismatch in the destructor. This is intentional as we allocate + * extra space at the end of the node. */ + ::operator delete(ptr); + } + static void operator delete(void *, void *) + { + /* Deliberately empty placement delete operator, to avoid MSVC warning C4291. */ + } + ShaderNode *clone(ShaderGraph *graph) const; char *input_default_value(); |