diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-11 15:57:20 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-11 15:57:20 +0000 |
commit | c83c8f224e66d7e21e30546bae308ac5fd52677e (patch) | |
tree | 9a15588353036cf2fccfbfb99bf934b3d1f3cbef /c_compiler/include/type.hpp | |
parent | e065e781448b86eeeca0152f735649ea2a2edbb6 (diff) | |
download | Compiler-c83c8f224e66d7e21e30546bae308ac5fd52677e.tar.gz Compiler-c83c8f224e66d7e21e30546bae308ac5fd52677e.zip |
Added shared_ptr for less memory leaks
Diffstat (limited to 'c_compiler/include/type.hpp')
-rw-r--r-- | c_compiler/include/type.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/c_compiler/include/type.hpp b/c_compiler/include/type.hpp index 3deca58..608b660 100644 --- a/c_compiler/include/type.hpp +++ b/c_compiler/include/type.hpp @@ -3,6 +3,11 @@ #include "node.hpp" +#include <memory> + +class Type; + +typedef std::shared_ptr<Type> TypePtr; class Type : public Node { public: @@ -22,7 +27,7 @@ public: class Pointer : public Type { protected: - Type* pointer_type; + TypePtr pointer_type; public: Pointer(Type* _pointer_type); @@ -34,7 +39,7 @@ public: class Array : public Type { protected: int32_t size; - Type* array_type; + TypePtr array_type; public: Array(Type* _array_type, int32_t _size = 0); |