Changeset 24de7b1 for src/Common/GC.h
- Timestamp:
- Apr 16, 2018, 3:21:17 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- fb97252f
- Parents:
- 6f81db3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/GC.h
r6f81db3 r24de7b1 18 18 #include <vector> 19 19 20 class GC_Traceable;21 20 class GC_Object; 22 21 class BaseSyntaxNode; … … 30 29 31 30 /// Traces a traceable object 32 const GC& operator<< (const GC_ Traceable*) const;31 const GC& operator<< (const GC_Object*) const; 33 32 34 33 /// Adds a new object to garbage collection … … 111 110 } 112 111 113 /// Class that is traced by the GC, but not managed by it114 class GC_ Traceable{112 /// Class that is managed by the GC 113 class GC_Object { 115 114 friend class GC; 116 115 protected: 117 116 mutable bool mark; 118 117 118 // Override default constructors to ensure clones are registered and properly marked 119 GC_Object(); 120 121 GC_Object(const GC_Object&); 122 123 GC_Object(GC_Object&&); 124 125 GC_Object& operator= (const GC_Object&) { /* do not assign mark */ return *this; } 126 127 GC_Object& operator= (GC_Object&&) { /* do not assign mark */ return *this; } 128 129 // Ensure subclasses can be deleted by garbage collector 130 virtual ~GC_Object() {} 131 119 132 /// override to trace any child objects 120 133 virtual void trace(const GC&) const {} 121 };122 123 /// Class that is managed by the GC124 class GC_Object : public GC_Traceable {125 friend class GC;126 protected:127 virtual ~GC_Object() {}128 public:129 GC_Object();130 134 }; 131 135
Note: See TracChangeset
for help on using the changeset viewer.