source: src/ResolvExpr/CandidateFinder.hpp @ 2773ab8

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 2773ab8 was 2773ab8, checked in by Aaron Moss <a3moss@…>, 5 years ago

Add new resolver overload for WaitForStmt?

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