source: src/libcfa/exception.h @ 90cedbdd

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since 90cedbdd was 0304215a, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

add missing files from previous commit

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[fa4805f]1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// exception.h -- Builtins for exception handling.
8//
9// Author           : Andrew Beach
10// Created On       : Mon Jun 26 15:11:00 2017
[0304215a]11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Feb 22 18:11:15 2018
13// Update Count     : 8
[fa4805f]14//
15
[6b0b624]16#pragma once
[fa4805f]17
18
[0cf5b79]19#ifdef __cforall
[0fc9756b]20extern "C" {
[fa4805f]21#endif
22
[36982fc]23struct __cfaabi_ehm__base_exception_t;
[0304215a]24typedef struct __cfaabi_ehm__base_exception_t exception_t;
[36982fc]25struct __cfaabi_ehm__base_exception_t_vtable {
26        const struct __cfaabi_ehm__base_exception_t_vtable * parent;
[86d5ba7c]27        size_t size;
[36982fc]28        void (*copy)(struct __cfaabi_ehm__base_exception_t *this,
29                     struct __cfaabi_ehm__base_exception_t * other);
30        void (*free)(struct __cfaabi_ehm__base_exception_t *this);
31        const char * (*msg)(struct __cfaabi_ehm__base_exception_t *this);
[86d5ba7c]32};
[36982fc]33struct __cfaabi_ehm__base_exception_t {
34        struct __cfaabi_ehm__base_exception_t_vtable const * virtual_table;
[86d5ba7c]35};
[36982fc]36extern struct __cfaabi_ehm__base_exception_t_vtable
37        ___cfaabi_ehm__base_exception_t_vtable_instance;
[86d5ba7c]38
39
[fa4805f]40// Used in throw statement translation.
[0304215a]41void __cfaabi_ehm__throw_terminate(exception_t * except) __attribute__((noreturn));
[36982fc]42void __cfaabi_ehm__rethrow_terminate() __attribute__((noreturn));
[0304215a]43void __cfaabi_ehm__throw_resume(exception_t * except);
[fa4805f]44
45// Function catches termination exceptions.
[36982fc]46void __cfaabi_ehm__try_terminate(
[fa4805f]47    void (*try_block)(),
[0304215a]48    void (*catch_block)(int index, exception_t * except),
49    int (*match_block)(exception_t * except));
[fa4805f]50
[86d5ba7c]51// Clean-up the exception in catch blocks.
[36982fc]52void __cfaabi_ehm__cleanup_terminate(void * except);
[86d5ba7c]53
[fa4805f]54// Data structure creates a list of resume handlers.
[36982fc]55struct __cfaabi_ehm__try_resume_node {
56    struct __cfaabi_ehm__try_resume_node * next;
[0304215a]57    _Bool (*handler)(exception_t * except);
[fa4805f]58};
59
[86d5ba7c]60// These act as constructor and destructor for the resume node.
[36982fc]61void __cfaabi_ehm__try_resume_setup(
62    struct __cfaabi_ehm__try_resume_node * node,
[0304215a]63    _Bool (*handler)(exception_t * except));
[36982fc]64void __cfaabi_ehm__try_resume_cleanup(
65    struct __cfaabi_ehm__try_resume_node * node);
[fa4805f]66
67// Check for a standard way to call fake deconstructors.
[36982fc]68struct __cfaabi_ehm__cleanup_hook {};
[fa4805f]69
[0cf5b79]70#ifdef __cforall
[fa4805f]71}
72#endif
Note: See TracBrowser for help on using the repository browser.