source: src/ResolvExpr/CandidateFinder.hpp @ cf32116

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since cf32116 was cf32116, checked in by Andrew Beach <ajbeach@…>, 4 years ago

Implemented expression based lvalue resolution on new ast.

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[99d4584]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// CandidateFinder.hpp --
8//
9// Author           : Aaron B. Moss
10// Created On       : Wed Jun 5 14:30:00 2019
[cf32116]11// Last Modified By : Andrew Beach
12// Last Modified On : Tue Oct  1  9:51:00 2019
13// Update Count     : 2
[99d4584]14//
15
16#pragma once
17
18#include "Candidate.hpp"
19#include "ResolvMode.h"
20#include "AST/Fwd.hpp"
[396037d]21#include "AST/Node.hpp"
[99d4584]22#include "AST/SymbolTable.hpp"
23#include "AST/TypeEnvironment.hpp"
24
25namespace ResolvExpr {
26
27/// Data to perform expression resolution
28struct CandidateFinder {
[c8e4d2f8]29        CandidateList candidates;          ///< List of candidate resolutions
[9ea38de]30        const ast::SymbolTable & localSyms;   ///< Symbol table to lookup candidates
[c8e4d2f8]31        const ast::TypeEnvironment & env;  ///< Substitutions performed in this resolution
32        ast::ptr< ast::Type > targetType;  ///< Target type for resolution
33
[cf32116]34        CandidateFinder(
35                const ast::SymbolTable & syms, const ast::TypeEnvironment & env,
[c8e4d2f8]36                const ast::Type * tt = nullptr )
[9ea38de]37        : candidates(), localSyms( syms ), env( env ), targetType( tt ) {}
[99d4584]38
39        /// Fill candidates with feasible resolutions for `expr`
40        void find( const ast::Expr * expr, ResolvMode mode = {} );
[2773ab8]41
42        /// Runs new candidate finder on each element in xs, returning the list of finders
43        std::vector< CandidateFinder > findSubExprs( const std::vector< ast::ptr< ast::Expr > > & xs );
44
45        using value_type = CandidateList::value_type;
46        using iterator = CandidateList::iterator;
47        using const_iterator = CandidateList::const_iterator;
48
49        iterator begin() { return candidates.begin(); }
50        const_iterator begin() const { return candidates.begin(); }
[cf32116]51
[2773ab8]52        iterator end() { return candidates.end(); }
53        const_iterator end() const { return candidates.end(); }
[99d4584]54};
55
[b69233a]56/// Computes conversion cost between two types
[cf32116]57Cost computeConversionCost(
58        const ast::Type * argType, const ast::Type * paramType, bool argIsLvalue,
59        const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );
[b69233a]60
[99d4584]61} // namespace ResolvExpr
62
63// Local Variables: //
64// tab-width: 4 //
65// mode: c++ //
66// compile-command: "make install" //
67// End: //
Note: See TracBrowser for help on using the repository browser.