source: src/ResolvExpr/Resolver.h @ a065f1f

ADTast-experimentalpthread-emulation
Last change on this file since a065f1f was 39d8950, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Thread global information through resolution. Non-top-level calls to the resolver have a bit of a hack but improvements would require changes to the Pass helpers.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 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// Resolver.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 12:18:34 2015
11// Last Modified By : Andrew Beach
12// Last Modified On : Wed Mar 16 11:32:00 2022
13// Update Count     : 5
14//
15
16#pragma once
17
18#include <list>          // for list
19
20#include "AST/Node.hpp"  // for ptr
21
22class ConstructorInit;
23class Declaration;
24class Expression;
25class DeletedExpr;
26class StmtExpr;
27class Type;
28namespace SymTab {
29        class Indexer;
30} // namespace SymTab
31
32namespace ast {
33        class ConstructorInit;
34        class Decl;
35        class DeletedExpr;
36        class Init;
37        class StmtExpr;
38        class SymbolTable;
39        class TranslationGlobal;
40        class TranslationUnit;
41        class Type;
42        class TypeEnvironment;
43} // namespace ast
44
45namespace ResolvExpr {
46        /// Checks types and binds syntactic constructs to typed representations
47        void resolve( std::list< Declaration * > translationUnit );
48        void resolveDecl( Declaration *, const SymTab::Indexer & indexer );
49        Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer );
50        void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer );
51        void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer );
52        void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer );
53        void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
54        void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
55        /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
56        DeletedExpr * findDeletedExpr( Expression * expr );
57        /// Resolves with-stmts and with-clauses on functions
58        void resolveWithExprs( std::list< Declaration * > & translationUnit );
59
60        /// Helper Type: Passes around information between various sub-calls.
61        struct ResolveContext {
62                const ast::SymbolTable & symtab;
63                const ast::TranslationGlobal & global;
64        };
65
66        /// Checks types and binds syntactic constructs to typed representations
67        void resolve( ast::TranslationUnit& translationUnit );
68        /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
69        const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr );
70        /// Find the expression candidate that is the unique best match for `untyped` in a `void`
71        /// context.
72        ast::ptr< ast::Expr > resolveInVoidContext(
73                const ast::Expr * expr, const ResolveContext &, ast::TypeEnvironment & env );
74        /// Resolve `untyped` to the single expression whose candidate is the best match for the
75        /// given type.
76        ast::ptr< ast::Expr > findSingleExpression(
77                const ast::Expr * untyped, const ast::Type * type, const ResolveContext & );
78        ast::ptr< ast::Expr > findVoidExpression(
79                const ast::Expr * untyped, const ResolveContext & );
80        /// Resolves a constructor init expression
81        ast::ptr< ast::Init > resolveCtorInit(
82                const ast::ConstructorInit * ctorInit, const ResolveContext & context );
83        /// Resolves a statement expression
84        const ast::Expr * resolveStmtExpr(
85                const ast::StmtExpr * stmtExpr, const ResolveContext & context );
86} // namespace ResolvExpr
87
88// Local Variables: //
89// tab-width: 4 //
90// mode: c++ //
91// compile-command: "make install" //
92// End: //
Note: See TracBrowser for help on using the repository browser.