source: src/Virtual/Tables.h @ 44adf1b

Last change on this file since 44adf1b was c6b4432, checked in by Andrew Beach <ajbeach@…>, 12 months ago

Remove BaseSyntaxNode? and clean-up.

  • Property mode set to 100644
File size: 2.3 KB
Line 
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 : 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
21namespace Virtual {
22
23std::string typeIdType( std::string const & type_name );
24std::string typeIdName( std::string const & type_name );
25std::string vtableTypeName( std::string const & type_name );
26std::string instanceName( std::string const & vtable_name );
27std::string vtableInstanceName( std::string const & type_name );
28std::string concurrentDefaultVTableName();
29bool isVTableInstanceName( std::string const & name );
30
31/* Create a forward declaration of a vtable of the given type.
32 * vtableType node is consumed.
33 */
34ast::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 */
41ast::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 */
53ast::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 */
61ast::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 */
68ast::ObjectDecl * makeTypeIdInstance(
69        const CodeLocation & location, ast::StructInstType const * typeIdType );
70
71}
Note: See TracBrowser for help on using the repository browser.