[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 Expression;
|
---|
[6a896b0] | 22 | class FunctionDecl;
|
---|
| 23 | class Initializer;
|
---|
| 24 | class ObjectDecl;
|
---|
| 25 | class StructDecl;
|
---|
| 26 | class StructInstType;
|
---|
| 27 | class Type;
|
---|
[1c01c58] | 28 |
|
---|
| 29 | namespace Virtual {
|
---|
| 30 |
|
---|
[ecfd758] | 31 | std::string typeIdType( std::string const & type_name );
|
---|
| 32 | std::string typeIdName( std::string const & type_name );
|
---|
[1c01c58] | 33 | std::string vtableTypeName( std::string const & type_name );
|
---|
| 34 | std::string instanceName( std::string const & vtable_name );
|
---|
| 35 | std::string vtableInstanceName( std::string const & type_name );
|
---|
[b583113] | 36 | std::string concurrentDefaultVTableName();
|
---|
[1c01c58] | 37 | bool isVTableInstanceName( std::string const & name );
|
---|
| 38 |
|
---|
[b583113] | 39 | ObjectDecl * makeVtableForward(
|
---|
| 40 | std::string const & name, StructInstType * vtableType );
|
---|
[69c5c00] | 41 | /* Create a forward declaration of a vtable of the given type.
|
---|
| 42 | * vtableType node is consumed.
|
---|
[1c01c58] | 43 | */
|
---|
[4f6dda0] | 44 | ast::ObjectDecl * makeVtableForward(
|
---|
| 45 | CodeLocation const & location, std::string const & name,
|
---|
| 46 | ast::StructInstType const * vtableType );
|
---|
[1c01c58] | 47 |
|
---|
[b583113] | 48 | ObjectDecl * makeVtableInstance(
|
---|
| 49 | std::string const & name,
|
---|
| 50 | StructInstType * vtableType, Type * objectType,
|
---|
[69c5c00] | 51 | Initializer * init = nullptr );
|
---|
[1c01c58] | 52 | /* Create an initialized definition of a vtable.
|
---|
[69c5c00] | 53 | * vtableType and init (if provided) nodes are consumed.
|
---|
| 54 | */
|
---|
[4f6dda0] | 55 | ast::ObjectDecl * makeVtableInstance(
|
---|
| 56 | CodeLocation const & location,
|
---|
| 57 | std::string const & name,
|
---|
| 58 | ast::StructInstType const * vtableType,
|
---|
| 59 | ast::Type const * objectType,
|
---|
| 60 | ast::Init const * init = nullptr );
|
---|
[69c5c00] | 61 |
|
---|
| 62 | // Some special code for how exceptions interact with virtual tables.
|
---|
| 63 | FunctionDecl * makeGetExceptionForward( Type * vtableType, Type * exceptType );
|
---|
| 64 | /* Create a forward declaration of the exception virtual function
|
---|
| 65 | * linking the vtableType to the exceptType. Both nodes are consumed.
|
---|
| 66 | */
|
---|
[4f6dda0] | 67 | ast::FunctionDecl * makeGetExceptionForward(
|
---|
| 68 | CodeLocation const & location,
|
---|
| 69 | ast::Type const * vtableType,
|
---|
| 70 | ast::Type const * exceptType );
|
---|
[69c5c00] | 71 |
|
---|
| 72 | FunctionDecl * makeGetExceptionFunction(
|
---|
| 73 | ObjectDecl * vtableInstance, Type * exceptType );
|
---|
| 74 | /* Create the definition of the exception virtual function.
|
---|
| 75 | * exceptType node is consumed.
|
---|
[1c01c58] | 76 | */
|
---|
[4f6dda0] | 77 | ast::FunctionDecl * makeGetExceptionFunction(
|
---|
| 78 | CodeLocation const & location,
|
---|
| 79 | ast::ObjectDecl const * vtableInstance, ast::Type const * exceptType );
|
---|
[1c01c58] | 80 |
|
---|
[ecfd758] | 81 | ObjectDecl * makeTypeIdInstance( StructInstType const * typeIdType );
|
---|
| 82 | /* Build an instance of the type-id from the type of the type-id.
|
---|
| 83 | * TODO: Should take the parent type. Currently locked to the exception_t.
|
---|
| 84 | */
|
---|
[4f6dda0] | 85 | ast::ObjectDecl * makeTypeIdInstance(
|
---|
| 86 | const CodeLocation & location, ast::StructInstType const * typeIdType );
|
---|
[ecfd758] | 87 |
|
---|
[1c01c58] | 88 | }
|
---|