[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 | |
---|
[4b7cce6] | 18 | #include "AST/Node.hpp" // for ptr |
---|
[ea6332d] | 19 | |
---|
[d76c588] | 20 | namespace ast { |
---|
[234b1cb] | 21 | class ConstructorInit; |
---|
[d76c588] | 22 | class Decl; |
---|
[d57e349] | 23 | class DeletedExpr; |
---|
[8f06277] | 24 | class Expr; |
---|
[234b1cb] | 25 | class Init; |
---|
[17a0ede2] | 26 | class StmtExpr; |
---|
[4b7cce6] | 27 | class SymbolTable; |
---|
[39d8950] | 28 | class TranslationGlobal; |
---|
[1f7dc61] | 29 | class TranslationUnit; |
---|
[18e683b] | 30 | class Type; |
---|
[4b7cce6] | 31 | class TypeEnvironment; |
---|
[d76c588] | 32 | } // namespace ast |
---|
[51b7345] | 33 | |
---|
| 34 | namespace ResolvExpr { |
---|
[d76c588] | 35 | |
---|
[39d8950] | 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 | |
---|
[d76c588] | 42 | /// Checks types and binds syntactic constructs to typed representations |
---|
[293dc1c] | 43 | void resolve( ast::TranslationUnit& translationUnit ); |
---|
[d57e349] | 44 | /// Searches expr and returns the first DeletedExpr found, otherwise nullptr |
---|
| 45 | const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ); |
---|
[4b7cce6] | 46 | /// Find the expression candidate that is the unique best match for `untyped` in a `void` |
---|
| 47 | /// context. |
---|
| 48 | ast::ptr< ast::Expr > resolveInVoidContext( |
---|
[39d8950] | 49 | const ast::Expr * expr, const ResolveContext &, ast::TypeEnvironment & env ); |
---|
[b2e0df3] | 50 | /// Resolve `untyped` to the single expression whose candidate is the best match for the |
---|
[18e683b] | 51 | /// given type. |
---|
| 52 | ast::ptr< ast::Expr > findSingleExpression( |
---|
[39d8950] | 53 | const ast::Expr * untyped, const ast::Type * type, const ResolveContext & ); |
---|
[490fb92e] | 54 | ast::ptr< ast::Expr > findVoidExpression( |
---|
[39d8950] | 55 | const ast::Expr * untyped, const ResolveContext & ); |
---|
[234b1cb] | 56 | /// Resolves a constructor init expression |
---|
[293dc1c] | 57 | ast::ptr< ast::Init > resolveCtorInit( |
---|
[39d8950] | 58 | const ast::ConstructorInit * ctorInit, const ResolveContext & context ); |
---|
[1f7dc61] | 59 | /// Resolves a statement expression |
---|
[302ef2a] | 60 | const ast::Expr * resolveStmtExpr( |
---|
[39d8950] | 61 | const ast::StmtExpr * stmtExpr, const ResolveContext & context ); |
---|
[51b7345] | 62 | } // namespace ResolvExpr |
---|
| 63 | |
---|
[a32b204] | 64 | // Local Variables: // |
---|
| 65 | // tab-width: 4 // |
---|
| 66 | // mode: c++ // |
---|
| 67 | // compile-command: "make install" // |
---|
| 68 | // End: // |
---|