From 5de62bbe4dddc64895ddb17c4eb3572c3c9be248 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 19 Feb 2018 19:53:45 -0500 Subject: more to fixing memory leaks 1. reorder destruction order of several key classes to avoid using deleted IR objects when destroying Types 2. remove Session::canonicalTypes and make each Type own a RefPtr to the canonicalType, to allow types to be destroyed along with each IRModule it belongs to. --- source/slang/type-defs.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source/slang/type-defs.h') diff --git a/source/slang/type-defs.h b/source/slang/type-defs.h index a5b9cd659..14e99caf9 100644 --- a/source/slang/type-defs.h +++ b/source/slang/type-defs.h @@ -10,7 +10,7 @@ public: protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -23,7 +23,7 @@ RAW( protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -37,7 +37,7 @@ public: protected: virtual bool EqualsImpl(Type * type) override; virtual RefPtr SubstituteImpl(SubstitutionSet subst, int* ioDiff) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -51,7 +51,7 @@ public: protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -77,7 +77,7 @@ RAW( protected: virtual int GetHashCode() override; virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; ) END_SYNTAX_CLASS() @@ -103,7 +103,7 @@ RAW( protected: virtual BasicExpressionType* GetScalarType() override; virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; ) END_SYNTAX_CLASS() @@ -312,7 +312,7 @@ RAW( protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual RefPtr SubstituteImpl(SubstitutionSet subst, int* ioDiff) override; virtual int GetHashCode() override; ) @@ -331,7 +331,7 @@ RAW( protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) @@ -356,7 +356,7 @@ public: protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -440,7 +440,7 @@ RAW( protected: virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -469,7 +469,7 @@ RAW( protected: virtual RefPtr SubstituteImpl(SubstitutionSet subst, int* ioDiff) override; virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; virtual int GetHashCode() override; ) END_SYNTAX_CLASS() @@ -495,6 +495,6 @@ SYNTAX_CLASS(GenericDeclRefType, Type) protected: virtual bool EqualsImpl(Type * type) override; virtual int GetHashCode() override; - virtual Type* CreateCanonicalType() override; + virtual RefPtr CreateCanonicalType() override; ) END_SYNTAX_CLASS() -- cgit v1.2.3