Ignore:
Timestamp:
Jul 19, 2019, 2:16:01 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
4eb43fa
Parents:
1f1c102 (diff), 8ac3b0e (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' into new-ast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/typeops.h

    r1f1c102 rf53acdf8  
    2828#include "SynTree/SynTree.h"
    2929#include "SynTree/Type.h"
    30 #include "SymTab/Indexer.h"
     30
     31namespace SymTab {
     32        class Indexer;
     33}
    3134
    3235namespace ResolvExpr {
     
    6063        // in AdjustExprType.cc
    6164        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
    62         void adjustExprType( Type *&type, const TypeEnvironment &env, const SymTab::Indexer &indexer );
     65        void adjustExprType( Type *& type, const TypeEnvironment & env, const SymTab::Indexer & indexer );
    6366
    6467        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer
     
    6669
    6770        template< typename ForwardIterator >
    68         void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment &env, const SymTab::Indexer &indexer ) {
     71        void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment & env, const SymTab::Indexer & indexer ) {
    6972                while ( begin != end ) {
    7073                        adjustExprType( *begin++, env, indexer );
     
    7376
    7477        /// Replaces array types with equivalent pointer, and function types with a pointer-to-function
    75         const ast::Type * adjustExprType( 
     78        const ast::Type * adjustExprType(
    7679                const ast::Type * type, const ast::TypeEnvironment & env, const ast::SymbolTable & symtab );
    7780
    7881        // in CastCost.cc
    79         Cost castCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    80         Cost castCost( 
    81                 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, 
     82        Cost castCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     83        Cost castCost(
     84                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
    8285                const ast::TypeEnvironment & env );
    8386
    8487        // in ConversionCost.cc
    85         Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    86         Cost conversionCost( 
    87                 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, 
     88        Cost conversionCost( const Type * src, const Type * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     89        Cost conversionCost(
     90                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
    8891                const ast::TypeEnvironment & env );
    8992
    9093        // in AlternativeFinder.cc
    91         Cost computeConversionCost( Type *actualType, Type *formalType,
    92                 const SymTab::Indexer &indexer, const TypeEnvironment &env );
     94        Cost computeConversionCost( Type * actualType, Type * formalType,
     95                const SymTab::Indexer & indexer, const TypeEnvironment & env );
    9396
    9497        // in PtrsAssignable.cc
    95         int ptrsAssignable( Type *src, Type *dest, const TypeEnvironment &env );
     98        int ptrsAssignable( const Type * src, const Type * dest, const TypeEnvironment & env );
    9699        int ptrsAssignable( const ast::Type * src, const ast::Type * dst,
    97100                const ast::TypeEnvironment & env );
    98101
    99102        // in PtrsCastable.cc
    100         int ptrsCastable( Type *src, Type *dest, const TypeEnvironment &env, const SymTab::Indexer &indexer );
    101         int ptrsCastable( 
    102                 const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab, 
     103        int ptrsCastable( const Type * src, const Type * dest, const TypeEnvironment & env, const SymTab::Indexer & indexer );
     104        int ptrsCastable(
     105                const ast::Type * src, const ast::Type * dst, const ast::SymbolTable & symtab,
    103106                const ast::TypeEnvironment & env );
    104107
    105108        // in Unify.cc
    106         bool typesCompatible( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    107         bool typesCompatibleIgnoreQualifiers( Type *, Type *, const SymTab::Indexer &indexer, const TypeEnvironment &env );
    108 
    109         inline bool typesCompatible( Type *t1, Type *t2, const SymTab::Indexer &indexer ) {
     109        bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     110        bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
     111
     112        inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
    110113                TypeEnvironment env;
    111114                return typesCompatible( t1, t2, indexer, env );
    112115        }
    113116
    114         inline bool typesCompatibleIgnoreQualifiers( Type *t1, Type *t2, const SymTab::Indexer &indexer ) {
     117        inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
    115118                TypeEnvironment env;
    116119                return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env );
    117120        }
    118121
    119         bool typesCompatible( 
    120                 const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {}, 
     122        bool typesCompatible(
     123                const ast::Type *, const ast::Type *, const ast::SymbolTable & symtab = {},
    121124                const ast::TypeEnvironment & env = {} );
    122        
     125
    123126        bool typesCompatibleIgnoreQualifiers(
    124                 const ast::Type *, const ast::Type *, const ast::SymbolTable &, 
     127                const ast::Type *, const ast::Type *, const ast::SymbolTable &,
    125128                const ast::TypeEnvironment & env = {} );
    126129
     
    131134
    132135        // in CommonType.cc
    133         Type * commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     136        Type * commonType( Type * type1, Type * type2, bool widenFirst, bool widenSecond, const SymTab::Indexer & indexer, TypeEnvironment & env, const OpenVarSet & openVars );
    134137        ast::ptr< ast::Type > commonType(
    135                 const ast::ptr< ast::Type > & type1, const ast::ptr< ast::Type > & type2, WidenMode widen, 
     138                const ast::ptr< ast::Type > & type1, const ast::ptr< ast::Type > & type2, WidenMode widen,
    136139                const ast::SymbolTable & symtab, ast::TypeEnvironment & env, const ast::OpenVarSet & open );
    137140
    138141        // in PolyCost.cc
    139         int polyCost( Type *type, const TypeEnvironment &env, const SymTab::Indexer &indexer );
    140         int polyCost( 
     142        int polyCost( Type * type, const TypeEnvironment & env, const SymTab::Indexer & indexer );
     143        int polyCost(
    141144                const ast::Type * type, const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );
    142145
    143146        // in SpecCost.cc
    144         int specCost( Type *type );
     147        int specCost( Type * type );
    145148        int specCost( const ast::Type * type );
    146149
    147150        // in Occurs.cc
    148         bool occurs( Type *type, std::string varName, const TypeEnvironment &env );
     151        bool occurs( Type * type, std::string varName, const TypeEnvironment & env );
    149152        // new AST version in TypeEnvironment.cpp (only place it was used in old AST)
    150153
    151         template<typename Iter> 
    152         bool occursIn( Type* ty, Iter begin, Iter end, const TypeEnvironment &env ) {
     154        template<typename Iter>
     155        bool occursIn( Type* ty, Iter begin, Iter end, const TypeEnvironment & env ) {
    153156                while ( begin != end ) {
    154157                        if ( occurs( ty, *begin, env ) ) return true;
     
    176179
    177180        /// flatten tuple type into existing list of types
    178         static inline void flatten( 
    179                 const ast::Type * type, std::vector< ast::ptr< ast::Type > > & out 
     181        static inline void flatten(
     182                const ast::Type * type, std::vector< ast::ptr< ast::Type > > & out
    180183        ) {
    181                 if ( auto tupleType = dynamic_cast< const ast::TupleType * >( type ) ) {       
     184                if ( auto tupleType = dynamic_cast< const ast::TupleType * >( type ) ) {
    182185                        for ( const ast::Type * t : tupleType->types ) {
    183186                                flatten( t, out );
     
    197200
    198201        // in TypeEnvironment.cc
    199         bool isFtype( Type *type );
     202        bool isFtype( Type * type );
    200203} // namespace ResolvExpr
    201204
Note: See TracChangeset for help on using the changeset viewer.