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 | // FindFunction.h --
|
---|
8 | //
|
---|
9 | // Author : Richard C. Bilson
|
---|
10 | // Created On : Mon May 18 07:44:20 2015
|
---|
11 | // Last Modified By : Andrew Beach
|
---|
12 | // Last Modified On : Fri Oct 7 10:30:00 2022
|
---|
13 | // Update Count : 3
|
---|
14 | //
|
---|
15 |
|
---|
16 | #pragma once
|
---|
17 |
|
---|
18 | #include <list> // for list
|
---|
19 |
|
---|
20 | #include "GenPoly.h" // for TyVarMap
|
---|
21 |
|
---|
22 | class FunctionType;
|
---|
23 | class Type;
|
---|
24 |
|
---|
25 | namespace GenPoly {
|
---|
26 | typedef bool (*FindFunctionPredicate)( FunctionType*, const TyVarMap& );
|
---|
27 |
|
---|
28 | /// recursively walk `type`, placing all functions that match `predicate` under `tyVars` into `functions`
|
---|
29 | void findFunction( Type *type, std::list< FunctionType const * > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
|
---|
30 | /// like `findFunction`, but also replaces the function type with void ()(void)
|
---|
31 | void findAndReplaceFunction( Type *&type, std::list< FunctionType const * > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
|
---|
32 |
|
---|
33 | typedef bool (*FindFunctionPred)( const ast::FunctionType *, const TypeVarMap & );
|
---|
34 |
|
---|
35 | /// Recursively walks `type`, placing all functions that match `predicate`
|
---|
36 | /// under `typeVars` into `functions`.
|
---|
37 | void findFunction( const ast::Type * type,
|
---|
38 | std::vector<ast::ptr<ast::FunctionType>> & functions,
|
---|
39 | const TypeVarMap & typeVars, FindFunctionPred predicate );
|
---|
40 | /// Like findFunction, but also replaces the function type with `void ()(void)`.
|
---|
41 | const ast::Type * findAndReplaceFunction( const ast::Type * type,
|
---|
42 | std::vector<ast::ptr<ast::FunctionType>> & functions,
|
---|
43 | const TypeVarMap & typeVars, FindFunctionPred predicate );
|
---|
44 |
|
---|
45 | } // namespace GenPoly
|
---|
46 |
|
---|
47 | // Local Variables: //
|
---|
48 | // tab-width: 4 //
|
---|
49 | // mode: c++ //
|
---|
50 | // compile-command: "make install" //
|
---|
51 | // End: //
|
---|