Changeset b867278
- Timestamp:
- Sep 6, 2018, 10:44:46 AM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 7ba1324
- Parents:
- 7b10ea9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/builtins.c
r7b10ea9 rb867278 13 13 // Update Count : 20 14 14 // 15 16 // type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions 17 // Note: needs to occur early, because it is used to generate destructor calls during code generation 18 forall(dtype T) 19 struct __Destructor { 20 T * object; 21 void (*dtor)(T *); 22 }; 23 24 // defined destructor in the case that non-generated code wants to use __Destructor 25 forall(dtype T) 26 static inline void ^?{}(__Destructor(T) & x) { 27 if (x.object && x.dtor) { 28 x.dtor(x.object); 29 } 30 } 31 32 // easy interface into __Destructor's destructor for easy codegen purposes 33 extern "C" { 34 forall(dtype T) 35 static inline void __destroy_Destructor(__Destructor(T) * dtor) { 36 ^(*dtor){}; 37 } 38 } 15 39 16 40 // exception implementation … … 111 135 static inline unsigned int ?\=?( unsigned int & x, unsigned long int y ) { x = x \ y; return x; } 112 136 113 // type that wraps a pointer and a destructor-like function - used in generating implicit destructor calls for struct members in user-defined functions114 forall(dtype T)115 struct __Destructor {116 T * object;117 void (*dtor)(T *);118 };119 120 // defined destructor in the case that non-generated code wants to use __Destructor121 forall(dtype T)122 static inline void ^?{}(__Destructor(T) & x) {123 if (x.object && x.dtor) {124 x.dtor(x.object);125 }126 }127 128 // easy interface into __Destructor's destructor for easy codegen purposes129 extern "C" {130 forall(dtype T)131 static inline void __destroy_Destructor(__Destructor(T) * dtor) {132 ^(*dtor){};133 }134 }135 136 137 // Local Variables: // 137 138 // mode: c //
Note: See TracChangeset
for help on using the changeset viewer.