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