source: src/GenPoly/GenPoly.h@ 8360977

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since 8360977 was ffad73a, checked in by Aaron Moss <a3moss@…>, 10 years ago

Refactored isPolyType and friends to account for polymorphic generic types

  • 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// 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 TyVarMap &tyVars, const TypeSubstitution *env = 0 );
40
41 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
42 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
43
44 /// Prints type variable map
45 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
46
47 /// Gets the name of the sizeof parameter for the type
48 std::string sizeofName( Type *ty );
49
50 /// Gets the name of the alignof parameter for the type
51 std::string alignofName( Type *ty );
52} // namespace GenPoly
53
54#endif // GENPOLY_H
55
56// Local Variables: //
57// tab-width: 4 //
58// mode: c++ //
59// compile-command: "make install" //
60// End: //
Note: See TracBrowser for help on using the repository browser.