| 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.hpp --
|
|---|
| 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 "AST/Node.hpp" // for ptr
|
|---|
| 19 |
|
|---|
| 20 | namespace ast {
|
|---|
| 21 | class ConstructorInit;
|
|---|
| 22 | class Decl;
|
|---|
| 23 | class DeletedExpr;
|
|---|
| 24 | class Expr;
|
|---|
| 25 | class Init;
|
|---|
| 26 | class StmtExpr;
|
|---|
| 27 | class SymbolTable;
|
|---|
| 28 | class TranslationGlobal;
|
|---|
| 29 | class TranslationUnit;
|
|---|
| 30 | class Type;
|
|---|
| 31 | class TypeEnvironment;
|
|---|
| 32 | } // namespace ast
|
|---|
| 33 |
|
|---|
| 34 | namespace ResolvExpr {
|
|---|
| 35 |
|
|---|
| 36 | /// Helper Type: Passes around information between various sub-calls.
|
|---|
| 37 | struct ResolveContext {
|
|---|
| 38 | const ast::SymbolTable & symtab;
|
|---|
| 39 | const ast::TranslationGlobal & global;
|
|---|
| 40 | };
|
|---|
| 41 |
|
|---|
| 42 | /// Checks types and binds syntactic constructs to typed representations
|
|---|
| 43 | void resolve( ast::TranslationUnit& translationUnit );
|
|---|
| 44 | /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
|
|---|
| 45 | const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr );
|
|---|
| 46 | /// Find the expression candidate that is the unique
|
|---|
| 47 | /// best match for `untyped` in a `void` context.
|
|---|
| 48 | ast::ptr< ast::Expr > resolveInVoidContext(
|
|---|
| 49 | const ast::Expr * expr, const ResolveContext &, ast::TypeEnvironment & env );
|
|---|
| 50 | /// Resolve `untyped` to the single expression whose
|
|---|
| 51 | /// candidate is the best match for the given type.
|
|---|
| 52 | ast::ptr< ast::Expr > findSingleExpression(
|
|---|
| 53 | const ast::Expr * untyped, const ast::Type * type, const ResolveContext & );
|
|---|
| 54 | ast::ptr< ast::Expr > findVoidExpression(
|
|---|
| 55 | const ast::Expr * untyped, const ResolveContext & );
|
|---|
| 56 | /// Resolves a constructor init expression
|
|---|
| 57 | ast::ptr< ast::Init > resolveCtorInit(
|
|---|
| 58 | const ast::ConstructorInit * ctorInit, const ResolveContext & context );
|
|---|
| 59 | /// Resolves a statement expression
|
|---|
| 60 | const ast::Expr * resolveStmtExpr(
|
|---|
| 61 | const ast::StmtExpr * stmtExpr, const ResolveContext & context );
|
|---|
| 62 |
|
|---|
| 63 | } // namespace ResolvExpr
|
|---|
| 64 |
|
|---|
| 65 | // Local Variables: //
|
|---|
| 66 | // tab-width: 4 //
|
|---|
| 67 | // mode: c++ //
|
|---|
| 68 | // compile-command: "make install" //
|
|---|
| 69 | // End: //
|
|---|