| 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
 | 
|---|
| 12 | // Last Modified On : Wed Apr 21 10:30:00 2021
 | 
|---|
| 13 | // Update Count     : 2
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <list>  // for list
 | 
|---|
| 17 | 
 | 
|---|
| 18 | class Declaration;
 | 
|---|
| 19 | class StructDecl;
 | 
|---|
| 20 | class Expression;
 | 
|---|
| 21 | 
 | 
|---|
| 22 | namespace Virtual {
 | 
|---|
| 23 | 
 | 
|---|
| 24 | std::string typeIdType( std::string const & type_name );
 | 
|---|
| 25 | std::string typeIdName( std::string const & type_name );
 | 
|---|
| 26 | std::string vtableTypeName( std::string const & type_name );
 | 
|---|
| 27 | std::string instanceName( std::string const & vtable_name );
 | 
|---|
| 28 | std::string vtableInstanceName( std::string const & type_name );
 | 
|---|
| 29 | std::string concurrentDefaultVTableName();
 | 
|---|
| 30 | bool isVTableInstanceName( std::string const & name );
 | 
|---|
| 31 | 
 | 
|---|
| 32 | ObjectDecl * makeVtableForward(
 | 
|---|
| 33 |         std::string const & name, StructInstType * vtableType );
 | 
|---|
| 34 | /* Create a forward declaration of a vtable of the given type.
 | 
|---|
| 35 |  * vtableType node is consumed.
 | 
|---|
| 36 |  */
 | 
|---|
| 37 | 
 | 
|---|
| 38 | ObjectDecl * makeVtableInstance(
 | 
|---|
| 39 |         std::string const & name,
 | 
|---|
| 40 |         StructInstType * vtableType, Type * objectType,
 | 
|---|
| 41 |         Initializer * init = nullptr );
 | 
|---|
| 42 | /* Create an initialized definition of a vtable.
 | 
|---|
| 43 |  * vtableType and init (if provided) nodes are consumed.
 | 
|---|
| 44 |  */
 | 
|---|
| 45 | 
 | 
|---|
| 46 | // Some special code for how exceptions interact with virtual tables.
 | 
|---|
| 47 | FunctionDecl * makeGetExceptionForward( Type * vtableType, Type * exceptType );
 | 
|---|
| 48 | /* Create a forward declaration of the exception virtual function
 | 
|---|
| 49 |  * linking the vtableType to the exceptType. Both nodes are consumed.
 | 
|---|
| 50 |  */
 | 
|---|
| 51 | 
 | 
|---|
| 52 | FunctionDecl * makeGetExceptionFunction(
 | 
|---|
| 53 |         ObjectDecl * vtableInstance, Type * exceptType );
 | 
|---|
| 54 | /* Create the definition of the exception virtual function.
 | 
|---|
| 55 |  * exceptType node is consumed.
 | 
|---|
| 56 |  */
 | 
|---|
| 57 | 
 | 
|---|
| 58 | ObjectDecl * makeTypeIdInstance( StructInstType const * typeIdType );
 | 
|---|
| 59 | /* Build an instance of the type-id from the type of the type-id.
 | 
|---|
| 60 |  * TODO: Should take the parent type. Currently locked to the exception_t.
 | 
|---|
| 61 |  */
 | 
|---|
| 62 | 
 | 
|---|
| 63 | }
 | 
|---|