| [51587aa] | 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 | // | 
|---|
| [01aeade] | 7 | // FindFunction.h -- | 
|---|
| [51587aa] | 8 | // | 
|---|
|  | 9 | // Author           : Richard C. Bilson | 
|---|
|  | 10 | // Created On       : Mon May 18 07:44:20 2015 | 
|---|
| [c97b448] | 11 | // Last Modified By : Andrew Beach | 
|---|
|  | 12 | // Last Modified On : Fri Oct  7 10:30:00 2022 | 
|---|
|  | 13 | // Update Count     : 3 | 
|---|
| [51587aa] | 14 | // | 
|---|
| [51b73452] | 15 |  | 
|---|
| [6b0b624] | 16 | #pragma once | 
|---|
| [51b73452] | 17 |  | 
|---|
| [08fc48f] | 18 | #include <list>       // for list | 
|---|
|  | 19 |  | 
|---|
|  | 20 | #include "GenPoly.h"  // for TyVarMap | 
|---|
|  | 21 |  | 
|---|
|  | 22 | class FunctionType; | 
|---|
|  | 23 | class Type; | 
|---|
| [51b73452] | 24 |  | 
|---|
|  | 25 | namespace GenPoly { | 
|---|
| [01aeade] | 26 | typedef bool (*FindFunctionPredicate)( FunctionType*, const TyVarMap& ); | 
|---|
| [51b73452] | 27 |  | 
|---|
| [f8b961b] | 28 | /// recursively walk `type`, placing all functions that match `predicate` under `tyVars` into `functions` | 
|---|
| [4da152a] | 29 | void findFunction( Type *type, std::list< FunctionType const * > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ); | 
|---|
| [f8b961b] | 30 | /// like `findFunction`, but also replaces the function type with void ()(void) | 
|---|
| [4da152a] | 31 | void findAndReplaceFunction( Type *&type, std::list< FunctionType const * > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ); | 
|---|
| [c97b448] | 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 |  | 
|---|
| [51b73452] | 45 | } // namespace GenPoly | 
|---|
|  | 46 |  | 
|---|
| [51587aa] | 47 | // Local Variables: // | 
|---|
|  | 48 | // tab-width: 4 // | 
|---|
|  | 49 | // mode: c++ // | 
|---|
|  | 50 | // compile-command: "make install" // | 
|---|
|  | 51 | // End: // | 
|---|