Ignore:
Timestamp:
May 29, 2019, 3:45:00 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
0aedb01
Parents:
157a816 (diff), ebc0a85 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'cleanup-dtors'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/builtins.c

    r157a816 rf57dd25  
    1313// Update Count     : 95
    1414//
     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
     18forall(dtype T)
     19struct __Destructor {
     20        T * object;
     21        void (*dtor)(T *);
     22};
     23
     24// defined destructor in the case that non-generated code wants to use __Destructor
     25forall(dtype T)
     26static 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
     33extern "C" {
     34        forall(dtype T)
     35        static inline void __destroy_Destructor(__Destructor(T) * dtor) {
     36                ^(*dtor){};
     37        }
     38}
    1539
    1640// exception implementation
Note: See TracChangeset for help on using the changeset viewer.