source: src/ResolvExpr/Resolver.h @ 4bae7b4

Last change on this file since 4bae7b4 was 8f06277, checked in by Andrew Beach <ajbeach@…>, 17 months ago

Some clean-up in Common/utility.h. Deleted some unused declarations and moved others to one of two new headers.

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