[1c01c58] | 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 | // Tables.h -- |
---|
| 8 | // |
---|
| 9 | // Author : Andrew Beach |
---|
| 10 | // Created On : Mon Aug 31 11:07:00 2020 |
---|
| 11 | // Last Modified By : Andrew Beach |
---|
[4f6dda0] | 12 | // Last Modified On : Wec Dec 8 16:58:00 2021 |
---|
| 13 | // Update Count : 3 |
---|
[1c01c58] | 14 | // |
---|
| 15 | |
---|
| 16 | #include <list> // for list |
---|
| 17 | |
---|
[4f6dda0] | 18 | #include <string> |
---|
| 19 | #include "AST/Fwd.hpp" |
---|
[1c01c58] | 20 | class Declaration; |
---|
| 21 | class StructDecl; |
---|
| 22 | class Expression; |
---|
| 23 | |
---|
| 24 | namespace Virtual { |
---|
| 25 | |
---|
[ecfd758] | 26 | std::string typeIdType( std::string const & type_name ); |
---|
| 27 | std::string typeIdName( std::string const & type_name ); |
---|
[1c01c58] | 28 | std::string vtableTypeName( std::string const & type_name ); |
---|
| 29 | std::string instanceName( std::string const & vtable_name ); |
---|
| 30 | std::string vtableInstanceName( std::string const & type_name ); |
---|
[b583113] | 31 | std::string concurrentDefaultVTableName(); |
---|
[1c01c58] | 32 | bool isVTableInstanceName( std::string const & name ); |
---|
| 33 | |
---|
[b583113] | 34 | ObjectDecl * makeVtableForward( |
---|
| 35 | std::string const & name, StructInstType * vtableType ); |
---|
[69c5c00] | 36 | /* Create a forward declaration of a vtable of the given type. |
---|
| 37 | * vtableType node is consumed. |
---|
[1c01c58] | 38 | */ |
---|
[4f6dda0] | 39 | ast::ObjectDecl * makeVtableForward( |
---|
| 40 | CodeLocation const & location, std::string const & name, |
---|
| 41 | ast::StructInstType const * vtableType ); |
---|
[1c01c58] | 42 | |
---|
[b583113] | 43 | ObjectDecl * makeVtableInstance( |
---|
| 44 | std::string const & name, |
---|
| 45 | StructInstType * vtableType, Type * objectType, |
---|
[69c5c00] | 46 | Initializer * init = nullptr ); |
---|
[1c01c58] | 47 | /* Create an initialized definition of a vtable. |
---|
[69c5c00] | 48 | * vtableType and init (if provided) nodes are consumed. |
---|
| 49 | */ |
---|
[4f6dda0] | 50 | ast::ObjectDecl * makeVtableInstance( |
---|
| 51 | CodeLocation const & location, |
---|
| 52 | std::string const & name, |
---|
| 53 | ast::StructInstType const * vtableType, |
---|
| 54 | ast::Type const * objectType, |
---|
| 55 | ast::Init const * init = nullptr ); |
---|
[69c5c00] | 56 | |
---|
| 57 | // Some special code for how exceptions interact with virtual tables. |
---|
| 58 | FunctionDecl * makeGetExceptionForward( Type * vtableType, Type * exceptType ); |
---|
| 59 | /* Create a forward declaration of the exception virtual function |
---|
| 60 | * linking the vtableType to the exceptType. Both nodes are consumed. |
---|
| 61 | */ |
---|
[4f6dda0] | 62 | ast::FunctionDecl * makeGetExceptionForward( |
---|
| 63 | CodeLocation const & location, |
---|
| 64 | ast::Type const * vtableType, |
---|
| 65 | ast::Type const * exceptType ); |
---|
[69c5c00] | 66 | |
---|
| 67 | FunctionDecl * makeGetExceptionFunction( |
---|
| 68 | ObjectDecl * vtableInstance, Type * exceptType ); |
---|
| 69 | /* Create the definition of the exception virtual function. |
---|
| 70 | * exceptType node is consumed. |
---|
[1c01c58] | 71 | */ |
---|
[4f6dda0] | 72 | ast::FunctionDecl * makeGetExceptionFunction( |
---|
| 73 | CodeLocation const & location, |
---|
| 74 | ast::ObjectDecl const * vtableInstance, ast::Type const * exceptType ); |
---|
[1c01c58] | 75 | |
---|
[ecfd758] | 76 | ObjectDecl * makeTypeIdInstance( StructInstType const * typeIdType ); |
---|
| 77 | /* Build an instance of the type-id from the type of the type-id. |
---|
| 78 | * TODO: Should take the parent type. Currently locked to the exception_t. |
---|
| 79 | */ |
---|
[4f6dda0] | 80 | ast::ObjectDecl * makeTypeIdInstance( |
---|
| 81 | const CodeLocation & location, ast::StructInstType const * typeIdType ); |
---|
[ecfd758] | 82 | |
---|
[1c01c58] | 83 | } |
---|