Ignore:
Timestamp:
Oct 8, 2022, 9:43:21 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master
Children:
b2ddaf3
Parents:
815943f (diff), d8c96a9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/GenPoly.h

    r815943f r265e460  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Aug 19 16:03:00 2022
    13 // Update Count     : 8
     12// Last Modified On : Fri Oct  7 15:06:00 2022
     13// Update Count     : 9
    1414//
    1515
     
    2020
    2121#include "ErasableScopedMap.h"    // for ErasableScopedMap
    22 #include "AST/Fwd.hpp"
     22#include "AST/Decl.hpp"           // for TypeDecl::Data
     23#include "AST/Fwd.hpp"            // for ApplicationExpr, BaseInstType, Func...
    2324#include "SymTab/Mangler.h"       // for Mangler
    2425#include "SynTree/Declaration.h"  // for TypeDecl::Data, AggregateDecl, Type...
     
    2930        // TODO Via some tricks this works for ast::TypeDecl::Data as well.
    3031        typedef ErasableScopedMap< std::string, TypeDecl::Data > TyVarMap;
     32        using TypeVarMap = ErasableScopedMap< std::string, ast::TypeDecl::Data >;
    3133
    3234        /// Replaces a TypeInstType by its referrent in the environment, if applicable
     
    3941        /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
    4042        Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
    41         const ast::Type * isPolyType(const ast::Type * type, const TyVarMap & tyVars, const ast::TypeSubstitution * env = nullptr);
     43        const ast::Type * isPolyType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = nullptr );
    4244
    4345        /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided
    4446        ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
    45         const ast::BaseInstType *isDynType( const ast::Type *type, const TyVarMap &tyVars, const ast::TypeSubstitution *typeSubs = 0 );
     47        const ast::BaseInstType *isDynType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = 0 );
    4648
    4749        /// true iff function has dynamic-layout return type under the given type variable map
    4850        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &tyVars );
     51        const ast::BaseInstType *isDynRet( const ast::FunctionType * type, const TypeVarMap & typeVars );
    4952
    5053        /// true iff function has dynamic-layout return type under the type variable map generated from its forall-parameters
     
    5356        /// A function needs an adapter if it returns a dynamic-layout value or if any of its parameters have dynamic-layout type
    5457        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
     58        bool needsAdapter( ast::FunctionType const * adaptee, const TypeVarMap & typeVars );
    5559
    5660        /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
     
    5963        /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
    6064        Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
     65        const ast::Type * isPolyPtr( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * env = 0 );
    6166
    6267        /// if the base type (after dereferencing N >= 0 pointers) is a polymorphic type, returns the base type, NULL otherwise;
     
    6772        /// N will be stored in levels, if provided, will look up substitution in env if provided
    6873        Type *hasPolyBase( Type *type, const TyVarMap &tyVars, int *levels = 0, const TypeSubstitution *env = 0 );
     74        const ast::Type * hasPolyBase( const ast::Type * type, const TypeVarMap & typeVars, int * levels = 0, const ast::TypeSubstitution * env = 0 );
    6975
    7076        /// true iff this type or some base of this type after dereferencing pointers is either polymorphic or a generic type with at least one
     
    9096        /// true if arg requires boxing given exprTyVars
    9197        bool needsBoxing( Type * param, Type * arg, const TyVarMap &exprTyVars, const TypeSubstitution * env );
    92         bool needsBoxing( const ast::Type * param, const ast::Type * arg, const TyVarMap &exprTyVars, const ast::TypeSubstitution * env);
     98        bool needsBoxing( const ast::Type * param, const ast::Type * arg, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst );
    9399
    94100        /// true if arg requires boxing in the call to appExpr
    95101        bool needsBoxing( Type * param, Type * arg, ApplicationExpr * appExpr, const TypeSubstitution * env );
    96         bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * appExpr, const ast::TypeSubstitution * env);
     102        bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * expr, const ast::TypeSubstitution * subst );
    97103
    98104        /// Adds the type variable `tyVar` to `tyVarMap`
    99105        void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap );
     106        void addToTypeVarMap( const ast::TypeDecl * type, TypeVarMap & typeVars );
    100107
    101108        /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap`
    102109        void makeTyVarMap( Type *type, TyVarMap &tyVarMap );
    103         void makeTyVarMap(const ast::Type * type, TyVarMap & tyVarMap);
     110        void makeTypeVarMap( const ast::Type * type, TypeVarMap & typeVars );
    104111
    105112        /// Prints type variable map
    106113        void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
     114        void printTypeVarMap( std::ostream &os, const TypeVarMap & typeVars );
    107115
    108116        /// Gets the mangled name of this type; alias for SymTab::Mangler::mangleType().
Note: See TracChangeset for help on using the changeset viewer.