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.hpp --
|
---|
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 : Wec Dec 8 16:58:00 2021
|
---|
13 | // Update Count : 3
|
---|
14 | //
|
---|
15 |
|
---|
16 | #include <list> // for list
|
---|
17 |
|
---|
18 | #include <string>
|
---|
19 | #include "AST/Fwd.hpp"
|
---|
20 |
|
---|
21 | namespace Virtual {
|
---|
22 |
|
---|
23 | std::string typeIdType( std::string const & type_name );
|
---|
24 | std::string typeIdName( std::string const & type_name );
|
---|
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 );
|
---|
28 | std::string concurrentDefaultVTableName();
|
---|
29 | bool isVTableInstanceName( std::string const & name );
|
---|
30 |
|
---|
31 | /* Create a forward declaration of a vtable of the given type.
|
---|
32 | * vtableType node is consumed.
|
---|
33 | */
|
---|
34 | ast::ObjectDecl * makeVtableForward(
|
---|
35 | CodeLocation const & location, std::string const & name,
|
---|
36 | ast::StructInstType const * vtableType );
|
---|
37 |
|
---|
38 | /* Create an initialized definition of a vtable.
|
---|
39 | * vtableType and init (if provided) nodes are consumed.
|
---|
40 | */
|
---|
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 );
|
---|
47 |
|
---|
48 | // Some special code for how exceptions interact with virtual tables.
|
---|
49 |
|
---|
50 | /* Create a forward declaration of the exception virtual function
|
---|
51 | * linking the vtableType to the exceptType. Both nodes are consumed.
|
---|
52 | */
|
---|
53 | ast::FunctionDecl * makeGetExceptionForward(
|
---|
54 | CodeLocation const & location,
|
---|
55 | ast::Type const * vtableType,
|
---|
56 | ast::Type const * exceptType );
|
---|
57 |
|
---|
58 | /* Create the definition of the exception virtual function.
|
---|
59 | * exceptType node is consumed.
|
---|
60 | */
|
---|
61 | ast::FunctionDecl * makeGetExceptionFunction(
|
---|
62 | CodeLocation const & location,
|
---|
63 | ast::ObjectDecl const * vtableInstance, ast::Type const * exceptType );
|
---|
64 |
|
---|
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 | */
|
---|
68 | ast::ObjectDecl * makeTypeIdInstance(
|
---|
69 | const CodeLocation & location, ast::StructInstType const * typeIdType );
|
---|
70 |
|
---|
71 | }
|
---|