source: src/GenPoly/GenPoly.h @ 0f889a77

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglergc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newstringwith_gc
Last change on this file since 0f889a77 was 0f889a77, checked in by Aaron Moss <a3moss@…>, 6 years ago

Added unfiltered version of isPoly{Type,Ptr}

  • Property mode set to 100644
File size: 2.3 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// GenPoly.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Rob Schluntz
12// Last Modified On : Tue Nov 24 15:24:38 2015
13// Update Count     : 6
14//
15
16#ifndef GENPOLY_H
17#define GENPOLY_H
18
19#include <map>
20#include <string>
21#include <iostream>
22
23#include "SynTree/Declaration.h"
24#include "SynTree/TypeSubstitution.h"
25
26namespace GenPoly {
27        typedef std::map< std::string, TypeDecl::Kind > TyVarMap;
28
29        /// A function needs an adapter if it returns a polymorphic value or if any of its
30        /// parameters have polymorphic type
31        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
32
33        /// true iff function has polymorphic return type
34        bool isPolyRet( FunctionType *function, std::string &name, const TyVarMap &otherTyVars );
35        bool isPolyRet( FunctionType *function, std::string &name );
36        bool isPolyRet( FunctionType *function, const TyVarMap &otherTyVars );
37
38        /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided
39        Type *isPolyType( Type *type, const TypeSubstitution *env = 0 );
40       
41        /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
42        Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
43
44        /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
45        Type *isPolyPtr( Type *type, const TypeSubstitution *env = 0 );
46       
47        /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
48        Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
49
50        /// Prints type variable map
51        void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
52
53        /// Gets the name of the sizeof parameter for the type
54        std::string sizeofName( Type *ty );
55
56        /// Gets the name of the alignof parameter for the type
57        std::string alignofName( Type *ty );
58} // namespace GenPoly
59
60#endif // GENPOLY_H
61
62// Local Variables: //
63// tab-width: 4 //
64// mode: c++ //
65// compile-command: "make install" //
66// End: //
Note: See TracBrowser for help on using the repository browser.