Changeset 2f42718


Ignore:
Timestamp:
Feb 22, 2019, 10:43:29 AM (5 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
no_list
Parents:
43e0949
Message:

Parameters and return value of functions are now vectors (and some related clean-up)

Location:
src
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixMain.cc

    r43e0949 r2f42718  
    4949
    5050                        os << main_signature->get_scopedMangleName() << "(";
    51                         const auto& params = main_signature->get_functionType()->get_parameters();
     51                        const auto& params = main_signature->get_functionType()->parameters;
    5252                        switch(params.size()) {
    5353                                case 3: os << "(" << genTypeAt(params, 0) << ")argc, (" << genTypeAt(params, 1) << ")argv, (" << genTypeAt(params, 2) << ")envp"; break;
  • src/CodeGen/FixNames.cc

    r43e0949 r2f42718  
    5050                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    5151                                };
    52                 main_type->get_returnVals().push_back(
     52                main_type->returnVals.push_back(
    5353                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5454                );
     
    6363                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    6464                                };
    65                 main_type->get_returnVals().push_back(
     65                main_type->returnVals.push_back(
    6666                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6767                );
    6868
    69                 main_type->get_parameters().push_back(
     69                main_type->parameters.push_back(
    7070                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    7171                );
    7272
    73                 main_type->get_parameters().push_back(
     73                main_type->parameters.push_back(
    7474                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
    7575                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
     
    116116
    117117                if(is_main( SymTab::Mangler::mangle(functionDecl, true, true) )) {
    118                         int nargs = functionDecl->get_functionType()->get_parameters().size();
     118                        int nargs = functionDecl->get_functionType()->parameters.size();
    119119                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
    120120                                SemanticError(functionDecl, "Main expected to have 0, 2 or 3 arguments\n");
  • src/CodeGen/GenType.cc

    r43e0949 r2f42718  
    186186                /************* parameters ***************/
    187187
    188                 const std::list<DeclarationWithType *> &pars = funcType->parameters;
     188                const auto & pars = funcType->parameters;
    189189
    190190                if ( pars.empty() ) {
  • src/CodeTools/DeclStats.cc

    r43e0949 r2f42718  
    183183                }
    184184
    185                 void analyzeSubtypes( std::list<DeclarationWithType*>& tys, Stats& stats,
     185                void analyzeSubtypes( std::vector<DeclarationWithType*>& tys, Stats& stats,
    186186                                std::unordered_set<std::string>& elSeen, unsigned& n_poly, bool& seen_poly,
    187                                 unsigned& max_depth, unsigned depth, unsigned& n_subs ) {
     187                                unsigned& max_depth, unsigned depth, unsigned& n_subs )
     188                {
    188189                        for ( DeclarationWithType* dwt : tys ) {
    189190                                Type* ty = dwt->get_type();
     
    204205                }
    205206
    206                 void analyzeSubtypes( std::list<Type*>& tys, Stats& stats,
     207                void analyzeSubtypes( std::vector<Type*>& tys, Stats& stats,
    207208                                std::unordered_set<std::string>& elSeen, unsigned& n_poly, bool& seen_poly,
    208209                                unsigned& max_depth, unsigned depth ) {
     
    246247                                unsigned n_subs = 0;
    247248                                analyzeSubtypes(
    248                                         ft->get_returnVals(), stats, elSeen, n_poly, seen_poly, max_depth, depth,
     249                                        ft->returnVals, stats, elSeen, n_poly, seen_poly, max_depth, depth,
    249250                                        n_subs );
    250251                                analyzeSubtypes(
    251                                         ft->get_parameters(), stats, elSeen, n_poly, seen_poly, max_depth, depth,
     252                                        ft->parameters, stats, elSeen, n_poly, seen_poly, max_depth, depth,
    252253                                        n_subs );
    253254                                ++stats.n_generic_params.at( n_subs );
     
    280281                                        name, n_generic, stats.generic_type_names, stats.generic_type_decls, elSeen);
    281282                                analyzeSubtypes(
    282                                         tt->get_types(), stats, elSeen, n_poly, seen_poly, max_depth, depth );
     283                                        tt->types, stats, elSeen, n_poly, seen_poly, max_depth, depth );
    283284                                ++stats.n_generic_params.at( tt->size() );
    284285                        } else if ( dynamic_cast<VarArgsType*>(ty) ) {
     
    299300
    300301                /// Update arg pack stats based on a declaration list
    301                 void analyze( Stats& stats, std::unordered_set<std::string>& seen,
    302                                 std::unordered_set<std::string>& elSeen, ArgPackStats& pstats,
    303                                 std::list<DeclarationWithType*>& decls ) {
     302                void analyze( Stats& stats, std::unordered_set<std::string> & seen,
     303                                std::unordered_set<std::string> & elSeen, ArgPackStats & pstats,
     304                                std::vector<DeclarationWithType*> & decls ) {
    304305                        std::unordered_set<std::string> types;
    305306                        unsigned n = 0;                 ///< number of args/returns
     
    345346                        std::unordered_set<std::string> seen;
    346347                        std::unordered_set<std::string> elSeen;
    347                         analyze( stats, seen, elSeen, params, fnTy->get_parameters() );
    348                         analyze( stats, seen, elSeen, returns, fnTy->get_returnVals() );
     348                        analyze( stats, seen, elSeen, params , fnTy->parameters );
     349                        analyze( stats, seen, elSeen, returns, fnTy->returnVals );
    349350                }
    350351
  • src/CodeTools/ResolvProtoDump.cc

    r43e0949 r2f42718  
    102102                /// builds space-separated list of types
    103103                template<typename V>
    104                 static void build( V& visitor, const std::list< Type* >& tys, std::stringstream& ss,
     104                static void build( V& visitor, const std::vector< Type* >& tys, std::stringstream& ss,
    105105                                septype mode = separated ) {
    106106                        if ( tys.empty() ) return;
     
    121121                /// builds list of types wrapped as tuple type
    122122                template<typename V>
    123                 static void buildAsTuple( V& visitor, const std::list< Type* >& tys,
     123                static void buildAsTuple( V& visitor, const std::vector< Type * > & tys,
    124124                                std::stringstream& ss ) {
    125125                        switch ( tys.size() ) {
     
    135135
    136136                /// gets types from DWT list
    137                 static std::list< Type* > from_decls( const std::list< DeclarationWithType* >& decls ) {
    138                         std::list< Type* > tys;
     137                static std::vector< Type * > from_decls( const std::vector< DeclarationWithType * > & decls ) {
     138                        std::vector< Type * > tys;
    139139                        for ( auto decl : decls ) { tys.emplace_back( decl->get_type() ); }
    140140                        return tys;
     
    142142
    143143                /// gets types from TypeExpr list
    144                 static std::list< Type* > from_exprs( const std::list< Expression* >& exprs ) {
    145                         std::list< Type* > tys;
     144                static std::vector< Type* > from_exprs( const std::list< Expression* >& exprs ) {
     145                        std::vector< Type* > tys;
    146146                        for ( auto expr : exprs ) {
    147147                                if ( TypeExpr* tyExpr = dynamic_cast<TypeExpr*>(expr) ) {
     
    587587
    588588                /// Adds all named declarations in a list to the local scope
    589                 void addAll( const std::list<DeclarationWithType*>& decls ) {
     589                void addAll( const std::vector<DeclarationWithType*>& decls ) {
    590590                        for ( auto decl : decls ) {
    591591                                // skip anonymous decls
     
    644644                        // add body if available
    645645                        if ( decl->statements ) {
    646                                 std::list<Type*> rtns = from_decls( decl->type->returnVals );
     646                                auto rtns = from_decls( decl->type->returnVals );
    647647                                Type* rtn = nullptr;
    648648                                if ( rtns.size() == 1 ) {
  • src/Common/utility.h

    r43e0949 r2f42718  
    497497}
    498498
     499// -----------------------------------------------------------------------------
     500/// Simple ranged-base standard algorithms
     501namespace std {
     502        template< typename range, typename out >
     503        static inline auto move( range & r, out o ) -> decltype(std::move( std::begin(r), std::end(r), o )) {
     504                return std::move( std::begin(r), std::end(r), o );
     505        }
     506
     507        template< typename range, typename out >
     508        static inline auto copy( range & r, out o ) -> decltype(std::copy( std::begin(r), std::end(r), o )) {
     509                return std::copy( std::begin(r), std::end(r), o );
     510        }
     511}
     512
    499513// Local Variables: //
    500514// tab-width: 4 //
  • src/Concurrency/Keywords.cc

    r43e0949 r2f42718  
    337337                );
    338338
    339                 get_type->get_parameters().push_back( this_decl->clone() );
    340                 get_type->get_returnVals().push_back(
     339                get_type->parameters.push_back( this_decl->clone() );
     340                get_type->returnVals.push_back(
    341341                        new ObjectDecl(
    342342                                "ret",
     
    371371                        FunctionType * main_type = new FunctionType( noQualifiers, false );
    372372
    373                         main_type->get_parameters().push_back( this_decl->clone() );
     373                        main_type->parameters.push_back( this_decl->clone() );
    374374
    375375                        main_decl = new FunctionDecl(
     
    405405                );
    406406
    407                 decl->get_members().push_back( field );
     407                decl->members.push_back( field );
    408408
    409409                return field;
     
    418418                                                field,
    419419                                                new CastExpr(
    420                                                         new VariableExpr( func->get_functionType()->get_parameters().front() ),
    421                                                         func->get_functionType()->get_parameters().front()->get_type()->stripReferences()->clone()
     420                                                        new VariableExpr( func->get_functionType()->parameters.front() ),
     421                                                        func->get_functionType()->parameters.front()->get_type()->stripReferences()->clone()
    422422                                                )
    423423                                        )
     
    449449                        // If this is the destructor for a monitor it must be mutex
    450450                        if(isDtor) {
    451                                 Type* ty = decl->get_functionType()->get_parameters().front()->get_type();
     451                                Type* ty = decl->get_functionType()->parameters.front()->get_type();
    452452
    453453                                // If it's a copy, it's not a mutex
     
    483483
    484484                // Check if we need to instrument the body
    485                 CompoundStmt* body = decl->get_statements();
     485                CompoundStmt* body = decl->statements;
    486486                if( ! body ) return;
    487487
     
    519519
    520520                bool once = true;
    521                 for( auto arg : decl->get_functionType()->get_parameters()) {
     521                for( auto arg : decl->get_functionType()->parameters) {
    522522                        //Find mutex arguments
    523523                        Type* ty = arg->get_type();
     
    681681                }
    682682
    683                 DeclarationWithType * param = decl->get_functionType()->get_parameters().front();
     683                DeclarationWithType * param = decl->get_functionType()->parameters.front();
    684684                auto type  = dynamic_cast< StructInstType * >( InitTweak::getPointerBase( param->get_type() ) );
    685685                if( type && type->get_baseStruct()->is_thread() ) {
  • src/ControlStruct/ExceptTranslate.cc

    r43e0949 r2f42718  
    187187                unused_index_obj->attributes.push_back( new Attribute( "unused" ) );
    188188
    189                 catch_func_t.get_parameters().push_back( index_obj.clone() );
    190                 catch_func_t.get_parameters().push_back( exception_obj.clone() );
    191                 match_func_t.get_returnVals().push_back( unused_index_obj );
    192                 match_func_t.get_parameters().push_back( exception_obj.clone() );
    193                 handle_func_t.get_returnVals().push_back( bool_obj.clone() );
    194                 handle_func_t.get_parameters().push_back( exception_obj.clone() );
    195                 finally_func_t.get_parameters().push_back( voidptr_obj.clone() );
     189                catch_func_t.parameters.push_back( index_obj.clone() );
     190                catch_func_t.parameters.push_back( exception_obj.clone() );
     191                match_func_t.returnVals.push_back( unused_index_obj );
     192                match_func_t.parameters.push_back( exception_obj.clone() );
     193                handle_func_t.returnVals.push_back( bool_obj.clone() );
     194                handle_func_t.parameters.push_back( exception_obj.clone() );
     195                finally_func_t.parameters.push_back( voidptr_obj.clone() );
    196196        }
    197197
     
    275275
    276276                FunctionType *func_type = catch_func_t.clone();
    277                 DeclarationWithType * index_obj = func_type->get_parameters().front();
    278                 DeclarationWithType * except_obj = func_type->get_parameters().back();
     277                DeclarationWithType * index_obj  = func_type->parameters.front();
     278                DeclarationWithType * except_obj = func_type->parameters.back();
    279279
    280280                // Index 1..{number of handlers}
     
    397397
    398398                FunctionType * func_type = match_func_t.clone();
    399                 DeclarationWithType * except_obj = func_type->get_parameters().back();
     399                DeclarationWithType * except_obj = func_type->parameters.back();
    400400
    401401                // Index 1..{number of handlers}
     
    451451
    452452                FunctionType * func_type = handle_func_t.clone();
    453                 DeclarationWithType * except_obj = func_type->get_parameters().back();
     453                DeclarationWithType * except_obj = func_type->parameters.back();
    454454
    455455                CatchList::iterator it;
  • src/GenPoly/Box.cc

    r43e0949 r2f42718  
    286286                        TypeInstType paramType( Type::Qualifiers(), (*param)->get_name(), *param );
    287287                        std::string paramName = mangleType( &paramType );
    288                         layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( paramName ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    289                         layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( paramName ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     288                        layoutFnType->parameters.push_back( new ObjectDecl( sizeofName( paramName ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     289                        layoutFnType->parameters.push_back( new ObjectDecl( alignofName( paramName ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    290290                }
    291291        }
     
    367367
    368368                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( structDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    369                 layoutFnType->get_parameters().push_back( sizeParam );
     369                layoutFnType->parameters.push_back( sizeParam );
    370370                ObjectDecl *alignParam = new ObjectDecl( alignofName( structDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    371                 layoutFnType->get_parameters().push_back( alignParam );
     371                layoutFnType->parameters.push_back( alignParam );
    372372                ObjectDecl *offsetParam = new ObjectDecl( offsetofName( structDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    373                 layoutFnType->get_parameters().push_back( offsetParam );
     373                layoutFnType->parameters.push_back( offsetParam );
    374374                addOtypeParams( layoutFnType, otypeParams );
    375375
     
    428428
    429429                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( unionDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    430                 layoutFnType->get_parameters().push_back( sizeParam );
     430                layoutFnType->parameters.push_back( sizeParam );
    431431                ObjectDecl *alignParam = new ObjectDecl( alignofName( unionDecl->get_name() ), Type::StorageClasses(), LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    432                 layoutFnType->get_parameters().push_back( alignParam );
     432                layoutFnType->parameters.push_back( alignParam );
    433433                addOtypeParams( layoutFnType, otypeParams );
    434434
     
    468468                        // to take those polymorphic types as pointers. Therefore, there can be two different functions
    469469                        // with the same mangled name, so we need to further mangle the names.
    470                         for ( std::list< DeclarationWithType *>::iterator retval = function->get_returnVals().begin(); retval != function->get_returnVals().end(); ++retval ) {
    471                                 if ( isPolyType( (*retval)->get_type(), tyVars ) ) {
     470                        for ( auto retval : function->returnVals ) {
     471                                if ( isPolyType( retval->get_type(), tyVars ) ) {
    472472                                        name << "P";
    473473                                } else {
     
    476476                        }
    477477                        name << "_";
    478                         std::list< DeclarationWithType *> &paramList = function->get_parameters();
    479                         for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
    480                                 if ( isPolyType( (*arg)->get_type(), tyVars ) ) {
     478                        auto & paramList = function->parameters;
     479                        for ( auto arg : paramList ) {
     480                                if ( isPolyType( arg->get_type(), tyVars ) ) {
    481481                                        name << "P";
    482482                                } else {
     
    518518                                makeTyVarMap( functionType, scopeTyVars );
    519519
    520                                 std::list< DeclarationWithType *> &paramList = functionType->parameters;
    521                                 std::list< FunctionType *> functions;
    522                                 for ( Type::ForallList::iterator tyVar = functionType->forall.begin(); tyVar != functionType->forall.end(); ++tyVar ) {
    523                                         for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->assertions.begin(); assert != (*tyVar)->assertions.end(); ++assert ) {
    524                                                 findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter );
     520                                auto & paramList = functionType->parameters;
     521                                std::vector< FunctionType *> functions;
     522                                for ( auto tyVar : functionType->forall ) {
     523                                        for ( auto assert : tyVar->assertions ) {
     524                                                findFunction( assert->get_type(), functions, scopeTyVars, needsAdapter );
    525525                                        } // for
    526526                                } // for
    527                                 for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
    528                                         findFunction( (*arg)->get_type(), functions, scopeTyVars, needsAdapter );
     527                                for ( auto arg : paramList ) {
     528                                        findFunction( arg->get_type(), functions, scopeTyVars, needsAdapter );
    529529                                } // for
    530530
    531                                 for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
    532                                         std::string mangleName = mangleAdapterName( *funType, scopeTyVars );
     531                                for ( auto funType : functions ) {
     532                                        std::string mangleName = mangleAdapterName( funType, scopeTyVars );
    533533                                        if ( adapters.find( mangleName ) == adapters.end() ) {
    534534                                                std::string adapterName = makeAdapterName( mangleName );
    535                                                 adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), nullptr ) ) );
     535                                                adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, nullptr, new PointerType( Type::Qualifiers(), makeAdapterType( funType, scopeTyVars ) ), nullptr ) ) );
    536536                                        } // if
    537537                                } // for
     
    612612                        assert( funcType );
    613613
    614                         std::list< DeclarationWithType* >::const_iterator fnParm = funcType->get_parameters().begin();
     614                        std::vector< DeclarationWithType* >::const_iterator fnParm = funcType->parameters.begin();
    615615                        std::list< Expression* >::const_iterator fnArg = arg;
    616616                        std::set< std::string > seenTypes; ///< names for generic types we've seen
     
    624624
    625625                        // add type information args for presently unseen types in parameter list
    626                         for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) {
     626                        for ( ; fnParm != funcType->parameters.end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) {
    627627                                if ( ! (*fnArg)->get_result() ) continue;
    628628                                Type * argType = (*fnArg)->get_result();
     
    708708//                      if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
    709709                        if ( isDynRet( function, tyVars ) ) {
    710                                 ret = addRetParam( appExpr, function->get_returnVals().front()->get_type(), arg );
     710                                ret = addRetParam( appExpr, function->returnVals.front()->get_type(), arg );
    711711                        } // if
    712712                        std::string mangleName = mangleAdapterName( function, tyVars );
     
    786786                }
    787787
    788                 void Pass1::boxParams( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &exprTyVars ) {
    789                         for ( std::list< DeclarationWithType *>::const_iterator param = function->get_parameters().begin(); param != function->parameters.end(); ++param, ++arg ) {
    790                                 assertf( arg != appExpr->args.end(), "boxParams: missing argument for param %s to %s in %s", toString( *param ).c_str(), toString( function ).c_str(), toString( appExpr ).c_str() );
    791                                 addCast( *arg, (*param)->get_type(), exprTyVars );
    792                                 boxParam( (*param)->get_type(), *arg, exprTyVars );
     788                void Pass1::boxParams( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator & arg, const TyVarMap &exprTyVars ) {
     789                        for ( auto param : function->parameters ) {
     790                                assertf( arg != appExpr->args.end(), "boxParams: missing argument for param %s to %s in %s", toString( param ).c_str(), toString( function ).c_str(), toString( appExpr ).c_str() );
     791                                addCast( *arg, param->get_type(), exprTyVars );
     792                                boxParam( param->get_type(), *arg, exprTyVars );
     793                                ++arg;
    793794                        } // for
    794795                }
     
    796797                void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    797798                        std::list< Expression *>::iterator cur = arg;
    798                         for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    799                                 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->assertions.begin(); assert != (*tyVar)->assertions.end(); ++assert ) {
    800                                         InferredParams::const_iterator inferParam = appExpr->inferParams.find( (*assert)->get_uniqueId() );
    801                                         assertf( inferParam != appExpr->inferParams.end(), "addInferredParams missing inferred parameter: %s in: %s", toString( *assert ).c_str(), toString( appExpr ).c_str() );
     799                        for ( auto tyVar : functionType->forall ) {
     800                                for ( auto assert : tyVar->assertions ) {
     801                                        InferredParams::const_iterator inferParam = appExpr->inferParams.find( assert->get_uniqueId() );
     802                                        assertf( inferParam != appExpr->inferParams.end(), "addInferredParams missing inferred parameter: %s in: %s", toString( assert ).c_str(), toString( appExpr ).c_str() );
    802803                                        Expression *newExpr = inferParam->second.expr->clone();
    803                                         addCast( newExpr, (*assert)->get_type(), tyVars );
    804                                         boxParam( (*assert)->get_type(), newExpr, tyVars );
     804                                        addCast( newExpr, assert->get_type(), tyVars );
     805                                        boxParam( assert->get_type(), newExpr, tyVars );
    805806                                        appExpr->get_args().insert( cur, newExpr );
    806807                                } // for
     
    813814                        // make a new parameter that is a pointer to the type of the old return value
    814815                        retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
    815                         funcType->get_parameters().push_front( retParm );
     816                        funcType->parameters.insert( funcType->parameters.begin(), retParm );
    816817
    817818                        // we don't need the return value any more
    818                         funcType->get_returnVals().clear();
     819                        funcType->returnVals.clear();
    819820                }
    820821
     
    825826                                makeRetParm( adapter );
    826827                        } // if
    827                         adapter->get_parameters().push_front( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
     828                        adapter->parameters.insert( adapter->parameters.begin(), new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 ) );
    828829                        return adapter;
    829830                }
     
    844845                }
    845846
    846                 void addAdapterParams( ApplicationExpr *adapteeApp, std::list< DeclarationWithType *>::iterator arg, std::list< DeclarationWithType *>::iterator param, std::list< DeclarationWithType *>::iterator paramEnd, std::list< DeclarationWithType *>::iterator realParam, const TyVarMap &tyVars ) {
     847                void addAdapterParams( ApplicationExpr *adapteeApp, std::vector< DeclarationWithType *>::iterator arg, std::vector< DeclarationWithType *>::iterator param, std::vector< DeclarationWithType *>::iterator paramEnd, std::vector< DeclarationWithType *>::iterator realParam, const TyVarMap &tyVars ) {
    847848                        UniqueName paramNamer( "_p" );
    848849                        for ( ; param != paramEnd; ++param, ++arg, ++realParam ) {
     
    858859                        FunctionType *adapterType = makeAdapterType( adaptee, tyVars );
    859860                        adapterType = ScrubTyVars::scrub( adapterType, tyVars );
    860                         DeclarationWithType *adapteeDecl = adapterType->get_parameters().front();
     861                        DeclarationWithType *adapteeDecl = adapterType->parameters.front();
    861862                        adapteeDecl->set_name( "_adaptee" );
    862863                        // do not carry over attributes to real type parameters/return values
     
    877878                        for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
    878879                                assert( tyArg != realType->get_forall().end() );
    879                                 std::list< DeclarationWithType *>::iterator assertArg = (*tyArg)->get_assertions().begin();
    880                                 std::list< DeclarationWithType *>::iterator assertParam = (*tyParam)->get_assertions().begin();
    881                                 std::list< DeclarationWithType *>::iterator realAssertParam = (*realTyParam)->get_assertions().begin();
    882                                 for ( ; assertParam != (*tyParam)->get_assertions().end(); ++assertArg, ++assertParam, ++realAssertParam ) {
    883                                         assert( assertArg != (*tyArg)->get_assertions().end() );
     880                                std::vector< DeclarationWithType *>::iterator assertArg = (*tyArg)->assertions.begin();
     881                                std::vector< DeclarationWithType *>::iterator assertParam = (*tyParam)->assertions.begin();
     882                                std::vector< DeclarationWithType *>::iterator realAssertParam = (*realTyParam)->assertions.begin();
     883                                for ( ; assertParam != (*tyParam)->assertions.end(); ++assertArg, ++assertParam, ++realAssertParam ) {
     884                                        assert( assertArg != (*tyArg)->assertions.end() );
    884885                                        adapteeApp->get_args().push_back( makeAdapterArg( *assertParam, *assertArg, *realAssertParam, tyVars ) );
    885886                                } // for
    886887                        } // for
    887888
    888                         std::list< DeclarationWithType *>::iterator arg = realType->get_parameters().begin();
    889                         std::list< DeclarationWithType *>::iterator param = adapterType->get_parameters().begin();
    890                         std::list< DeclarationWithType *>::iterator realParam = adaptee->get_parameters().begin();
     889                        std::vector< DeclarationWithType *>::iterator arg = realType->parameters.begin();
     890                        std::vector< DeclarationWithType *>::iterator param = adapterType->parameters.begin();
     891                        std::vector< DeclarationWithType *>::iterator realParam = adaptee->parameters.begin();
    891892                        param++;                // skip adaptee parameter in the adapter type
    892                         if ( realType->get_returnVals().empty() ) {
     893                        if ( realType->returnVals.empty() ) {
    893894                                // void return
    894                                 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
     895                                addAdapterParams( adapteeApp, arg, param, adapterType->parameters.end(), realParam, tyVars );
    895896                                bodyStmt = new ExprStmt( adapteeApp );
    896                         } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     897                        } else if ( isDynType( adaptee->returnVals.front()->get_type(), tyVars ) ) {
    897898                                // return type T
    898899                                if ( (*param)->get_name() == "" ) {
     
    901902                                } // if
    902903                                UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
    903                                 UntypedExpr *deref = UntypedExpr::createDeref( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) );
     904                                UntypedExpr *deref = UntypedExpr::createDeref( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->returnVals.front()->get_type()->clone() ) ) );
    904905                                assign->get_args().push_back( deref );
    905                                 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
     906                                addAdapterParams( adapteeApp, arg, param, adapterType->parameters.end(), realParam, tyVars );
    906907                                assign->get_args().push_back( adapteeApp );
    907908                                bodyStmt = new ExprStmt( assign );
    908909                        } else {
    909910                                // adapter for a function that returns a monomorphic value
    910                                 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
     911                                addAdapterParams( adapteeApp, arg, param, adapterType->parameters.end(), realParam, tyVars );
    911912                                bodyStmt = new ReturnStmt( adapteeApp );
    912913                        } // if
     
    919920                void Pass1::passAdapters( ApplicationExpr * appExpr, FunctionType * functionType, const TyVarMap & exprTyVars ) {
    920921                        // collect a list of function types passed as parameters or implicit parameters (assertions)
    921                         std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    922                         std::list< FunctionType *> functions;
    923                         for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    924                                 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    925                                         findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter );
     922                        auto & paramList = functionType->parameters;
     923                        std::vector< FunctionType *> functions;
     924                        for ( auto tyVar : functionType->forall ) {
     925                                for ( auto assert : tyVar->assertions ) {
     926                                        findFunction( assert->get_type(), functions, exprTyVars, needsAdapter );
    926927                                } // for
    927928                        } // for
    928                         for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
    929                                 findFunction( (*arg)->get_type(), functions, exprTyVars, needsAdapter );
     929                        for ( auto arg : paramList ) {
     930                                findFunction( arg->get_type(), functions, exprTyVars, needsAdapter );
    930931                        } // for
    931932
     
    934935                        std::set< std::string > adaptersDone;
    935936
    936                         for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
    937                                 FunctionType *originalFunction = (*funType)->clone();
    938                                 FunctionType *realFunction = (*funType)->clone();
     937                        for ( auto funType : functions ) {
     938                                FunctionType * originalFunction = funType->clone();
     939                                FunctionType * realFunction = funType->clone();
    939940                                std::string mangleName = SymTab::Mangler::mangle( realFunction );
    940941
     
    954955                                        if ( adapter == adapters.end() ) {
    955956                                                // adapter has not been created yet in the current scope, so define it
    956                                                 FunctionDecl *newAdapter = makeAdapter( *funType, realFunction, mangleName, exprTyVars );
     957                                                FunctionDecl *newAdapter = makeAdapter( funType, realFunction, mangleName, exprTyVars );
    957958                                                std::pair< AdapterIter, bool > answer = adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, newAdapter ) );
    958959                                                adapter = answer.first;
     
    12551256
    12561257                void Pass2::addAdapters( FunctionType *functionType ) {
    1257                         std::list< DeclarationWithType *> &paramList = functionType->parameters;
    1258                         std::list< FunctionType *> functions;
    1259                         for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
    1260                                 Type *orig = (*arg)->get_type();
     1258                        auto & paramList = functionType->parameters;
     1259                        std::vector< FunctionType *> functions;
     1260                        for ( auto arg : paramList ) {
     1261                                Type *orig = arg->get_type();
    12611262                                findAndReplaceFunction( orig, functions, scopeTyVars, needsAdapter );
    1262                                 (*arg)->set_type( orig );
     1263                                arg->set_type( orig );
    12631264                        }
    12641265                        std::set< std::string > adaptersDone;
    1265                         for ( std::list< FunctionType *>::iterator funType = functions.begin(); funType != functions.end(); ++funType ) {
    1266                                 std::string mangleName = mangleAdapterName( *funType, scopeTyVars );
     1266                        for ( auto funType : functions ) {
     1267                                std::string mangleName = mangleAdapterName( funType, scopeTyVars );
    12671268                                if ( adaptersDone.find( mangleName ) == adaptersDone.end() ) {
    12681269                                        std::string adapterName = makeAdapterName( mangleName );
    12691270                                        // adapter may not be used in body, pass along with unused attribute.
    1270                                         paramList.push_front( new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( *funType, scopeTyVars ) ), 0, { new Attribute( "unused" ) } ) );
     1271                                        paramList.insert( paramList.begin(), new ObjectDecl( adapterName, Type::StorageClasses(), LinkageSpec::C, 0, new PointerType( Type::Qualifiers(), makeAdapterType( funType, scopeTyVars ) ), 0, { new Attribute( "unused" ) } ) );
    12711272                                        adaptersDone.insert( adaptersDone.begin(), mangleName );
    12721273                                }
    12731274                        }
    1274 //  deleteAll( functions );
    12751275                }
    12761276
     
    13241324
    13251325                void Pass2::premutate( FunctionType *funcType ) {
     1326
     1327
     1328
     1329
     1330
     1331
     1332
     1333
     1334
     1335
     1336
     1337
     1338
     1339
     1340
     1341
     1342
     1343
     1344
    13261345                        GuardScope( scopeTyVars );
    13271346                        makeTyVarMap( funcType, scopeTyVars );
     
    13291348                        // move polymorphic return type to parameter list
    13301349                        if ( isDynRet( funcType ) ) {
    1331                                 ObjectDecl *ret = strict_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() );
     1350                                ObjectDecl *ret = strict_dynamic_cast< ObjectDecl* >( funcType->returnVals.front() );
    13321351                                ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
    1333                                 funcType->get_parameters().push_front( ret );
    1334                                 funcType->get_returnVals().pop_front();
     1352                                funcType->parameters.insert( funcType->parameters.begin(), ret );
     1353                                funcType->returnVals.erase(funcType->returnVals.begin());
    13351354                                ret->set_init( nullptr ); // xxx - memory leak?
    13361355                        }
    13371356
    1338                         // add size/align and assertions for type parameters to parameter list
    1339                         std::list< DeclarationWithType *>::iterator last = funcType->get_parameters().begin();
    1340                         std::list< DeclarationWithType *> inferredParams;
     1357                        // create a list of parameters after adding new ones
     1358                        std::vector<DeclarationWithType *> newParams;
     1359                        std::vector<DeclarationWithType *> inferredParams;
     1360
     1361                        // reserve some memory for these vectors
     1362                        // Number of elements needed should be somewhat linear with the number of parameters / forall
     1363                        // "somewhat linear" == 2X
     1364                        newParams.reserve(funcType->parameters.size() * 2 + funcType->forall.size() * 2);
     1365                        inferredParams.reserve(funcType->forall.size() * 2);
     1366
    13411367                        // size/align/offset parameters may not be used in body, pass along with unused attribute.
    13421368                        ObjectDecl newObj( "", Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0,
     
    13441370                        ObjectDecl newPtr( "", Type::StorageClasses(), LinkageSpec::C, 0,
    13451371                                           new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 );
    1346                         for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
    1347                                 ObjectDecl *sizeParm, *alignParm;
     1372
     1373                        // We do this several time, create a functor for it
     1374                        auto pushObj = [&newObj, &newParams]( const std::string & name ) {
     1375                                auto parm = newObj.clone();
     1376                                parm->set_name( name );
     1377                                newParams.push_back( parm );
     1378                        };
     1379
     1380                        // add size/align and assertions for type parameters to parameter list
     1381                        for ( auto tyParm : funcType->forall ) {
    13481382                                // add all size and alignment parameters to parameter list
    1349                                 if ( (*tyParm)->isComplete() ) {
    1350                                         TypeInstType parmType( Type::Qualifiers(), (*tyParm)->get_name(), *tyParm );
     1383                                if ( tyParm->isComplete() ) {
     1384                                        TypeInstType parmType( Type::Qualifiers(), tyParm->get_name(), tyParm );
    13511385                                        std::string parmName = mangleType( &parmType );
    1352 
    1353                                         sizeParm = newObj.clone();
    1354                                         sizeParm->set_name( sizeofName( parmName ) );
    1355                                         last = funcType->get_parameters().insert( last, sizeParm );
    1356                                         ++last;
    1357 
    1358                                         alignParm = newObj.clone();
    1359                                         alignParm->set_name( alignofName( parmName ) );
    1360                                         last = funcType->get_parameters().insert( last, alignParm );
    1361                                         ++last;
     1386                                        pushObj( sizeofName( parmName ) );
     1387                                        pushObj( alignofName( parmName ) );
    13621388                                }
    13631389                                // move all assertions into parameter list
    1364                                 for ( std::list< DeclarationWithType *>::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) {
     1390                                // move all assertions into parameter list
     1391                                for ( auto assert : tyParm->assertions ) {
    13651392                                        // assertion parameters may not be used in body, pass along with unused attribute.
    1366                                         (*assert)->get_attributes().push_back( new Attribute( "unused" ) );
    1367                                         inferredParams.push_back( *assert );
    1368                                 }
    1369                                 (*tyParm)->get_assertions().clear();
     1393                                        assert->attributes.push_back( new Attribute( "unused" ) );
     1394                                        inferredParams.push_back( assert );
     1395                                }
     1396                                tyParm->assertions.clear();
    13701397                        }
    13711398
    13721399                        // add size/align for generic parameter types to parameter list
    13731400                        std::set< std::string > seenTypes; // sizeofName for generic types we've seen
    1374                         for ( std::list< DeclarationWithType* >::const_iterator fnParm = last; fnParm != funcType->get_parameters().end(); ++fnParm ) {
    1375                                 Type *polyType = isPolyType( (*fnParm)->get_type(), scopeTyVars );
    1376                                 if ( polyType && ! dynamic_cast< TypeInstType* >( polyType ) ) {
     1401                        for ( DeclarationWithType * fnParm : funcType->parameters )
     1402                        {
     1403                                Type *polyType = isPolyType( fnParm->get_type(), scopeTyVars );
     1404                                if ( polyType && ! dynamic_cast< TypeInstType* >( polyType ) )
     1405                                {
    13771406                                        std::string typeName = mangleType( polyType );
    13781407                                        if ( seenTypes.count( typeName ) ) continue;
    13791408
    1380                                         ObjectDecl *sizeParm, *alignParm, *offsetParm;
    1381                                         sizeParm = newObj.clone();
    1382                                         sizeParm->set_name( sizeofName( typeName ) );
    1383                                         last = funcType->get_parameters().insert( last, sizeParm );
    1384                                         ++last;
    1385 
    1386                                         alignParm = newObj.clone();
    1387                                         alignParm->set_name( alignofName( typeName ) );
    1388                                         last = funcType->get_parameters().insert( last, alignParm );
    1389                                         ++last;
     1409                                        pushObj( sizeofName ( typeName ) );
     1410                                        pushObj( alignofName( typeName ) );
    13901411
    13911412                                        if ( StructInstType *polyBaseStruct = dynamic_cast< StructInstType* >( polyType ) ) {
    13921413                                                // NOTE zero-length arrays are illegal in C, so empty structs have no offset array
    13931414                                                if ( ! polyBaseStruct->get_baseStruct()->get_members().empty() ) {
    1394                                                         offsetParm = newPtr.clone();
    1395                                                         offsetParm->set_name( offsetofName( typeName ) );
    1396                                                         last = funcType->get_parameters().insert( last, offsetParm );
    1397                                                         ++last;
     1415                                                        auto offset = newPtr.clone();
     1416                                                        offset->set_name( offsetofName( typeName ) );
     1417                                                        newParams.push_back( offset );
    13981418                                                }
    13991419                                        }
     
    14031423
    14041424                        // splice assertion parameters into parameter list
    1405                         funcType->get_parameters().splice( last, inferredParams );
     1425                        std::copy( inferredParams      , std::back_inserter(newParams) );
     1426                        std::copy( funcType->parameters, std::back_inserter(newParams) );
     1427
     1428                        funcType->parameters.swap(newParams);
     1429
    14061430                        addAdapters( funcType );
    14071431                }
     
    14701494
    14711495                        // make sure that any type information passed into the function is accounted for
    1472                         for ( std::list< DeclarationWithType* >::const_iterator fnParm = funcType->get_parameters().begin(); fnParm != funcType->get_parameters().end(); ++fnParm ) {
     1496                        for ( auto fnParm : funcType->parameters ) {
    14731497                                // condition here duplicates that in Pass2::mutate( FunctionType* )
    1474                                 Type *polyType = isPolyType( (*fnParm)->get_type(), scopeTyVars );
     1498                                Type *polyType = isPolyType( fnParm->get_type(), scopeTyVars );
    14751499                                if ( polyType && ! dynamic_cast< TypeInstType* >( polyType ) ) {
    14761500                                        knownLayouts.insert( mangleType( polyType ) );
  • src/GenPoly/FindFunction.cc

    r43e0949 r2f42718  
    2929        class FindFunction : public WithGuards, public WithVisitorRef<FindFunction>, public WithShortCircuiting {
    3030          public:
    31                 FindFunction( std::list< FunctionType* > &functions, const TyVarMap &tyVars, bool replaceMode, FindFunctionPredicate predicate );
     31                FindFunction( std::vector< FunctionType* > & functions, const TyVarMap &tyVars, bool replaceMode, FindFunctionPredicate predicate );
    3232
    3333                void premutate( FunctionType * functionType );
     
    3737                void handleForall( const Type::ForallList &forall );
    3838
    39                 std::list< FunctionType* > &functions;
     39                std::vector< FunctionType* > &functions;
    4040                TyVarMap tyVars;
    4141                bool replaceMode;
     
    4343        };
    4444
    45         void findFunction( Type *type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ) {
     45        void findFunction( Type *type, std::vector< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ) {
    4646                PassVisitor<FindFunction> finder( functions, tyVars, false, predicate );
    4747                type->acceptMutator( finder );
    4848        }
    4949
    50         void findAndReplaceFunction( Type *&type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ) {
     50        void findAndReplaceFunction( Type *&type, std::vector< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate ) {
    5151                PassVisitor<FindFunction> finder( functions, tyVars, true, predicate );
    5252                type = type->acceptMutator( finder );
    5353        }
    5454
    55         FindFunction::FindFunction( std::list< FunctionType* > &functions, const TyVarMap &tyVars, bool replaceMode, FindFunctionPredicate predicate )
     55        FindFunction::FindFunction( std::vector< FunctionType* > &functions, const TyVarMap &tyVars, bool replaceMode, FindFunctionPredicate predicate )
    5656                : functions( functions ), tyVars( tyVars ), replaceMode( replaceMode ), predicate( predicate ) {
    5757        }
     
    7070                GuardScope( tyVars );
    7171                handleForall( functionType->get_forall() );
    72                 mutateAll( functionType->get_returnVals(), *visitor );
     72                mutateAll( functionType->returnVals, *visitor );
    7373        }
    7474
  • src/GenPoly/FindFunction.h

    r43e0949 r2f42718  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FindFunction.h -- 
     7// FindFunction.h --
    88//
    99// Author           : Richard C. Bilson
     
    2727
    2828        /// recursively walk `type`, placing all functions that match `predicate` under `tyVars` into `functions`
    29         void findFunction( Type *type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
     29        void findFunction( Type *type, std::vector< FunctionType* > & functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
    3030        /// like `findFunction`, but also replaces the function type with void ()(void)
    31         void findAndReplaceFunction( Type *&type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
     31        void findAndReplaceFunction( Type *&type, std::vector< FunctionType* > & functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
    3232} // namespace GenPoly
    3333
  • src/GenPoly/GenPoly.cc

    r43e0949 r2f42718  
    144144
    145145        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) {
    146                 if ( function->get_returnVals().empty() ) return 0;
    147 
    148                 return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
     146                if ( function->returnVals.empty() ) return 0;
     147
     148                return (ReferenceToType*)isDynType( function->returnVals.front()->get_type(), forallTypes );
    149149        }
    150150
    151151        ReferenceToType *isDynRet( FunctionType *function ) {
    152                 if ( function->get_returnVals().empty() ) return 0;
     152                if ( function->returnVals.empty() ) return 0;
    153153
    154154                TyVarMap forallTypes( TypeDecl::Data{} );
    155155                makeTyVarMap( function, forallTypes );
    156                 return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
     156                return (ReferenceToType*)isDynType( function->returnVals.front()->get_type(), forallTypes );
    157157        }
    158158
    159159        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) {
    160 //              if ( ! adaptee->get_returnVals().empty() && isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    161 //                      return true;
    162 //              } // if
    163160                if ( isDynRet( adaptee, tyVars ) ) return true;
    164161
    165                 for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
    166 //                      if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
    167                         if ( isDynType( (*innerArg)->get_type(), tyVars ) ) {
     162                for ( auto innerArg : adaptee->parameters ) {
     163                        if ( isDynType( innerArg->get_type(), tyVars ) ) {
    168164                                return true;
    169165                        } // if
     
    315311                /// Flattens a declaration list
    316312                template<typename Output>
    317                 void flattenList( list< DeclarationWithType* > src, Output out ) {
     313                void flattenList( vector< DeclarationWithType* > src, Output out ) {
    318314                        for ( DeclarationWithType* decl : src ) {
    319315                                ResolvExpr::flatten( decl->get_type(), out );
     
    323319                /// Flattens a list of types
    324320                template<typename Output>
    325                 void flattenList( list< Type* > src, Output out ) {
     321                void flattenList( vector< Type* > src, Output out ) {
    326322                        for ( Type* ty : src ) {
    327323                                ResolvExpr::flatten( ty, out );
     
    395391
    396392                        vector<Type*> aparams, bparams;
    397                         flattenList( af->get_parameters(), back_inserter( aparams ) );
    398                         flattenList( bf->get_parameters(), back_inserter( bparams ) );
     393                        flattenList( af->parameters, back_inserter( aparams ) );
     394                        flattenList( bf->parameters, back_inserter( bparams ) );
    399395                        if ( aparams.size() != bparams.size() ) return false;
    400396
    401397                        vector<Type*> areturns, breturns;
    402                         flattenList( af->get_returnVals(), back_inserter( areturns ) );
    403                         flattenList( bf->get_returnVals(), back_inserter( breturns ) );
     398                        flattenList( af->returnVals, back_inserter( areturns ) );
     399                        flattenList( bf->returnVals, back_inserter( breturns ) );
    404400                        if ( areturns.size() != breturns.size() ) return false;
    405401
     
    429425
    430426                        vector<Type*> atypes, btypes;
    431                         flattenList( at->get_types(), back_inserter( atypes ) );
    432                         flattenList( bt->get_types(), back_inserter( btypes ) );
     427                        flattenList( at->types, back_inserter( atypes ) );
     428                        flattenList( bt->types, back_inserter( btypes ) );
    433429                        if ( atypes.size() != btypes.size() ) return false;
    434430
  • src/GenPoly/Specialize.cc

    r43e0949 r2f42718  
    9191                if ( tuple1 && tuple2 ) {
    9292                        if ( tuple1->size() != tuple2->size() ) return false;
    93                         for ( auto types : group_iterate( tuple1->get_types(), tuple2->get_types() ) ) {
     93                        for ( auto types : group_iterate( tuple1->types, tuple2->types ) ) {
    9494                                if ( ! matchingTupleStructure( std::get<0>( types ), std::get<1>( types ) ) ) return false;
    9595                        }
     
    115115        size_t functionParameterSize( FunctionType * ftype ) {
    116116                size_t sz = 0;
    117                 for ( DeclarationWithType * p : ftype->get_parameters() ) {
     117                for ( DeclarationWithType * p : ftype->parameters ) {
    118118                        sz += singleParameterSize( p->get_type() );
    119119                }
     
    227227                }
    228228                std::unique_ptr< FunctionType > actualTypeManager( actualType ); // for RAII
    229                 std::list< DeclarationWithType * >::iterator actualBegin = actualType->get_parameters().begin();
    230                 std::list< DeclarationWithType * >::iterator actualEnd = actualType->get_parameters().end();
     229                auto actualBegin = actualType->parameters.begin();
     230                auto actualEnd   = actualType->parameters.end();
    231231
    232232                std::list< Expression * > args;
    233                 for ( DeclarationWithType* param : thunkFunc->get_functionType()->get_parameters() ) {
     233                for ( DeclarationWithType* param : thunkFunc->get_functionType()->parameters ) {
    234234                        // name each thunk parameter and explode it - these are then threaded back into the actual function call.
    235235                        param->set_name( paramNamer.newName() );
     
    281281                FunctionType *function = getFunctionType( appExpr->function->result );
    282282                assert( function );
    283                 std::list< DeclarationWithType* >::iterator formal;
     283                std::vector< DeclarationWithType* >::iterator formal;
    284284                std::list< Expression* >::iterator actual;
    285                 for ( formal = function->get_parameters().begin(), actual = appExpr->get_args().begin(); formal != function->get_parameters().end() && actual != appExpr->get_args().end(); ++formal, ++actual ) {
     285                for ( formal = function->parameters.begin(), actual = appExpr->get_args().begin(); formal != function->parameters.end() && actual != appExpr->get_args().end(); ++formal, ++actual ) {
    286286                        *actual = doSpecialization( (*formal)->get_type(), *actual, &appExpr->inferParams );
    287287                }
  • src/InitTweak/FixInit.cc

    r43e0949 r2f42718  
    10421042                        if ( checkWarnings( function ) ) {
    10431043                                FunctionType * type = function->get_functionType();
    1044                                 assert( ! type->get_parameters().empty() );
    1045                                 thisParam = strict_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
     1044                                assert( ! type->parameters.empty() );
     1045                                thisParam = strict_dynamic_cast< ObjectDecl * >( type->parameters.front() );
    10461046                                Type * thisType = getPointerBase( thisParam->get_type() );
    10471047                                StructInstType * structType = dynamic_cast< StructInstType * >( thisType );
     
    10991099                                        if ( isCopyConstructor( function ) ) {
    11001100                                                // if copy ctor, need to pass second-param-of-this-function.field
    1101                                                 std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters();
     1101                                                auto & params = function->get_functionType()->parameters;
    11021102                                                assert( params.size() == 2 );
    11031103                                                arg2 = new MemberExpr( field, new VariableExpr( params.back() ) );
  • src/InitTweak/GenInit.cc

    r43e0949 r2f42718  
    127127
    128128        void ReturnFixer::premutate( ReturnStmt *returnStmt ) {
    129                 std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
     129                auto & returnVals = ftype->returnVals;
    130130                assert( returnVals.size() == 0 || returnVals.size() == 1 );
    131131                // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address
     
    242242                // if this function is a user-defined constructor or destructor, mark down the type as "managed"
    243243                if ( ! LinkageSpec::isOverridable( dwt->get_linkage() ) && CodeGen::isCtorDtor( dwt->get_name() ) ) {
    244                         std::list< DeclarationWithType * > & params = GenPoly::getFunctionType( dwt->get_type() )->get_parameters();
     244                        auto & params = GenPoly::getFunctionType( dwt->get_type() )->parameters;
    245245                        assert( ! params.empty() );
    246246                        Type * type = InitTweak::getPointerBase( params.front()->get_type() );
     
    335335                // go through assertions and recursively add seen ctor/dtors
    336336                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
    337                         for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) {
     337                        for ( DeclarationWithType *& assertion : tyDecl->assertions ) {
    338338                                managedTypes.handleDWT( assertion );
    339339                        }
  • src/InitTweak/InitTweak.cc

    r43e0949 r2f42718  
    410410                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->function->result );
    411411                                assert( funcType );
    412                                 return funcType->get_parameters().size() == 1;
     412                                return funcType->parameters.size() == 1;
    413413                        }
    414414                        return false;
     
    616616                if ( ftype->parameters.size() != 2 ) return nullptr;
    617617
    618                 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
     618                Type * t1 = getPointerBase( ftype->parameters.front()->get_type() );
    619619                Type * t2 = ftype->parameters.back()->get_type();
    620620                assert( t1 );
  • src/MakeLibCfa.cc

    r43e0949 r2f42718  
    103103                        UntypedExpr *newExpr = new UntypedExpr( new NameExpr( funcDecl->get_name() ) );
    104104                        UniqueName paramNamer( "_p" );
    105                         std::list< DeclarationWithType* >::iterator param = funcDecl->get_functionType()->get_parameters().begin();
    106                         assert( param != funcDecl->get_functionType()->get_parameters().end() );
     105                        auto & params = funcDecl->get_functionType()->parameters;
     106                        assert( !params.empty() );
    107107
    108                         for ( ; param != funcDecl->get_functionType()->get_parameters().end(); ++param ) {
     108                        for ( auto param : params ) {
    109109                                // name each unnamed parameter
    110                                 if ( (*param)->get_name() == "" ) {
    111                                         (*param)->set_name( paramNamer.newName() );
    112                                         (*param)->set_linkage( LinkageSpec::C );
     110                                if ( param->get_name() == "" ) {
     111                                        param->set_name( paramNamer.newName() );
     112                                        param->set_linkage( LinkageSpec::C );
    113113                                }
    114114                                // add parameter to the expression
    115                                 newExpr->get_args().push_back( new VariableExpr( *param ) );
     115                                newExpr->get_args().push_back( new VariableExpr( param ) );
    116116                        } // for
    117117
  • src/Parser/DeclarationNode.cc

    r43e0949 r2f42718  
    10651065} // buildList
    10661066
    1067 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > & outputList ) {
     1067void buildTypeList( const DeclarationNode * firstNode, std::vector< Type * > & outputList ) {
    10681068        SemanticErrorException errors;
    1069         std::back_insert_iterator< std::list< Type * > > out( outputList );
     1069        std::back_insert_iterator< std::vector< Type * > > out( outputList );
    10701070        const DeclarationNode * cur = firstNode;
    10711071
     
    10971097                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    10981098                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
    1099                 buildList( variable.assertions, ret->get_assertions() );
     1099                buildList( variable.assertions, ret->assertions );
    11001100                return ret;
    11011101        } // if
  • src/Parser/ParseNode.h

    r43e0949 r2f42718  
    467467void buildList( const DeclarationNode * firstNode, std::list< Declaration * > & outputList );
    468468void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > & outputList );
    469 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > & outputList );
     469void buildTypeList( const DeclarationNode * firstNode, std::vector< Type * > & outputList );
    470470
    471471template< typename SynTreeType, typename NodeType >
  • src/Parser/TypeData.cc

    r43e0949 r2f42718  
    493493                        // add dtor:  void ^?{}(T *)
    494494                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    495                         dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    496                         td->get_assertions().push_front( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
     495                        dtorType->parameters.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     496                        td->assertions.insert( td->assertions.begin(), new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) );
    497497
    498498                        // add copy ctor:  void ?{}(T *, T)
    499499                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    500                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    501                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    502                         td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
     500                        copyCtorType->parameters.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     501                        copyCtorType->parameters.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     502                        td->assertions.insert( td->assertions.begin(), new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) );
    503503
    504504                        // add default ctor:  void ?{}(T *)
    505505                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    506                         ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    507                         td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
     506                        ctorType->parameters.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     507                        td->assertions.insert( td->assertions.begin(), new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) );
    508508
    509509                        // add assignment operator:  T * ?=?(T *, T)
    510510                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    511                         assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
    512                         assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    513                         assignType->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
    514                         td->get_assertions().push_front( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, assignType, nullptr ) );
     511                        assignType->parameters.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     512                        assignType->parameters.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     513                        assignType->returnVals.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     514                        td->assertions.insert( td->assertions.begin(), new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, assignType, nullptr ) );
    515515                } // if
    516516        } // for
     
    897897        } // if
    898898        buildList( td->symbolic.params, ret->get_parameters() );
    899         buildList( td->symbolic.assertions, ret->get_assertions() );
     899        buildList( td->symbolic.assertions, ret->assertions );
    900900        ret->base->attributes.insert( ret->base->attributes.end(), attributes.begin(), attributes.end() );
    901901        return ret;
     
    930930TupleType * buildTuple( const TypeData * td ) {
    931931        assert( td->kind == TypeData::Tuple );
    932         std::list< Type * > types;
     932        std::vector< Type * > types;
    933933        buildTypeList( td->tuple, types );
    934934        TupleType * ret = new TupleType( buildQualifiers( td ), types );
     
    983983                        break;
    984984                  default:
    985                         ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType * >( buildDecl( td->base, "", Type::StorageClasses(), nullptr, Type::FuncSpecifiers(), LinkageSpec::Cforall, nullptr ) ) );
     985                        ft->returnVals.push_back( dynamic_cast< DeclarationWithType * >( buildDecl( td->base, "", Type::StorageClasses(), nullptr, Type::FuncSpecifiers(), LinkageSpec::Cforall, nullptr ) ) );
    986986                } // switch
    987987        } else {
    988                 ft->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
     988                ft->returnVals.push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) );
    989989        } // if
    990990        return ft;
  • src/ResolvExpr/AlternativeFinder.cc

    r43e0949 r2f42718  
    434434
    435435                Cost convCost = Cost::zero;
    436                 std::list< DeclarationWithType* >& formals = function->parameters;
    437                 std::list< DeclarationWithType* >::iterator formal = formals.begin();
    438                 std::list< Expression* >& actuals = appExpr->args;
     436                auto & formals = function->parameters;
     437                auto   formal = formals.begin();
     438                auto & actuals = appExpr->args;
    439439
    440440                for ( Expression*& actualExpr : actuals ) {
     
    493493        /// Adds type variables to the open variable set and marks their assertions
    494494        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) {
    495                 for ( Type::ForallList::const_iterator tyvar = type->forall.begin(); tyvar != type->forall.end(); ++tyvar ) {
    496                         unifiableVars[ (*tyvar)->get_name() ] = TypeDecl::Data{ *tyvar };
    497                         for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->assertions.begin(); assert != (*tyvar)->assertions.end(); ++assert ) {
    498                                 needAssertions[ *assert ].isUsed = true;
     495                for ( auto tyvar : type->forall ) {
     496                        unifiableVars[ tyvar->get_name() ] = TypeDecl::Data{ tyvar };
     497                        for ( auto assert : tyvar->assertions ) {
     498                                needAssertions[ assert ].isUsed = true;
    499499                        }
    500500                }
     
    14071407                        // assume no polymorphism
    14081408                        // assume no implicit conversions
    1409                         assert( function->get_parameters().size() == 1 );
     1409                        assert( function->parameters.size() == 1 );
    14101410                        PRINT(
    14111411                                std::cerr << "resolvAttr: funcDecl is ";
     
    14171417                        const SymTab::Indexer & indexer = finder.get_indexer();
    14181418                        AltList & alternatives = finder.get_alternatives();
    1419                         if ( typesCompatibleIgnoreQualifiers( argType, function->get_parameters().front()->get_type(), indexer, env ) ) {
     1419                        if ( typesCompatibleIgnoreQualifiers( argType, function->parameters.front()->get_type(), indexer, env ) ) {
    14201420                                Cost cost = Cost::zero;
    14211421                                Expression * newExpr = data.combine( cost );
     
    14421442                                if ( FunctionType *function = dynamic_cast< FunctionType* >( id->get_type() ) ) {
    14431443                                        // assume exactly one parameter
    1444                                         if ( function->get_parameters().size() == 1 ) {
     1444                                        if ( function->parameters.size() == 1 ) {
    14451445                                                if ( attrExpr->get_isType() ) {
    14461446                                                        resolveAttr( data, function, attrExpr->get_type(), env, altFinder);
  • src/ResolvExpr/ConversionCost.cc

    r43e0949 r2f42718  
    388388                Cost c = Cost::zero;
    389389                if ( TupleType * destAsTuple = dynamic_cast< TupleType * >( dest ) ) {
    390                         std::list< Type * >::const_iterator srcIt = tupleType->types.begin();
    391                         std::list< Type * >::const_iterator destIt = destAsTuple->types.begin();
     390                        std::vector< Type * >::const_iterator srcIt = tupleType->types.begin();
     391                        std::vector< Type * >::const_iterator destIt = destAsTuple->types.begin();
    392392                        while ( srcIt != tupleType->types.end() && destIt != destAsTuple->types.end() ) {
    393393                                Cost newCost = costFunc( *srcIt++, *destIt++, indexer, env );
  • src/ResolvExpr/FindOpenVars.cc

    r43e0949 r2f42718  
    5050        void FindOpenVars::common_action( Type *type ) {
    5151                if ( nextIsOpen ) {
    52                         for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    53                                 openVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) };
    54                                 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
    55                                         needAssertions[ *assert ].isUsed = false;
     52                        for ( const auto i : type->get_forall() ) {
     53                                openVars[ i->get_name() ] = TypeDecl::Data{ i };
     54                                for ( const auto assert : i->assertions ) {
     55                                        needAssertions[ assert ].isUsed = false;
    5656                                }
    57 ///       cloneAll( (*i)->get_assertions(), needAssertions );
    58 ///       needAssertions.insert( needAssertions.end(), (*i)->get_assertions().begin(), (*i)->get_assertions().end() );
    5957                        }
    6058                } else {
    61                         for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    62                                 closedVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) };
    63                                 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
    64                                         haveAssertions[ *assert ].isUsed = false;
     59                        for ( const auto i : type->get_forall() ) {
     60                                closedVars[ i->get_name() ] = TypeDecl::Data{ i };
     61                                for ( const auto assert : i->assertions ) {
     62                                        haveAssertions[ assert ].isUsed = false;
    6563                                }
    66 ///       cloneAll( (*i)->get_assertions(), haveAssertions );
    67 ///       haveAssertions.insert( haveAssertions.end(), (*i)->get_assertions().begin(), (*i)->get_assertions().end() );
    6864                        } // for
    6965                } // if
    70 ///   std::cerr << "type is ";
    71 ///   type->print( std::cerr );
    72 ///   std::cerr << std::endl << "need is" << std::endl;
    73 ///   printAssertionSet( needAssertions, std::cerr );
    74 ///   std::cerr << std::endl << "have is" << std::endl;
    75 ///   printAssertionSet( haveAssertions, std::cerr );
    7666        }
    7767
  • src/ResolvExpr/SpecCost.cc

    r43e0949 r2f42718  
    4242        private:
    4343                // takes minimum non-negative count over parameter/return list
    44                 void takeminover( int& mincount, std::list<DeclarationWithType*>& dwts ) {
     44                void takeminover( int& mincount, std::vector<DeclarationWithType*> & dwts ) {
    4545                        for ( DeclarationWithType* dwt : dwts ) {
    4646                                count = -1;
     
    6161                        visit_children = false;
    6262                }
    63        
     63
    6464        private:
    6565                // returns minimum non-negative count + 1 over type parameters (-1 if none such)
     
    8080                        visit_children = false;
    8181                }
    82                
     82
    8383                // look for polymorphic parameters
    8484                void previsit(UnionInstType* uty) {
  • src/ResolvExpr/Unify.cc

    r43e0949 r2f42718  
    283283        void markAssertions( AssertionSet &assertion1, AssertionSet &assertion2, Type *type ) {
    284284                for ( auto tyvar : type->get_forall() ) {
    285                         for ( auto assert : tyvar->get_assertions() ) {
     285                        for ( auto assert : tyvar->assertions ) {
    286286                                markAssertionSet( assertion1, assert );
    287287                                markAssertionSet( assertion2, assert );
     
    336336        template< typename Iterator, typename Func >
    337337        std::unique_ptr<Type> combineTypes( Iterator begin, Iterator end, Func & toType ) {
    338                 std::list< Type * > types;
     338                std::vector< Type * > types;
    339339                for ( ; begin != end; ++begin ) {
    340340                        // it's guaranteed that a ttype variable will be bound to a flat tuple, so ensure that this results in a flat tuple
     
    404404        /// flattens a list of declarations, so that each tuple type has a single declaration.
    405405        /// makes use of TtypeExpander to ensure ttypes are flat as well.
    406         void flattenList( std::list< DeclarationWithType * > src, std::list< DeclarationWithType * > & dst, TypeEnvironment & env ) {
     406        void flattenList( std::vector< DeclarationWithType * > src, std::vector< DeclarationWithType * > & dst, TypeEnvironment & env ) {
    407407                dst.clear();
    408408                for ( DeclarationWithType * dcl : src ) {
     
    429429                        std::unique_ptr<FunctionType> flatFunc( functionType->clone() );
    430430                        std::unique_ptr<FunctionType> flatOther( otherFunction->clone() );
    431                         flattenList( flatFunc->get_parameters(), flatFunc->get_parameters(), env );
    432                         flattenList( flatOther->get_parameters(), flatOther->get_parameters(), env );
     431                        flattenList( flatFunc ->parameters, flatFunc ->parameters, env );
     432                        flattenList( flatOther->parameters, flatOther->parameters, env );
    433433
    434434                        // sizes don't have to match if ttypes are involved; need to be more precise wrt where the ttype is to prevent errors
     
    481481                        } else if ( tupleParam ) {
    482482                                // bundle other parameters into tuple to match
    483                                 std::list< Type * > binderTypes;
     483                                std::vector< Type * > binderTypes;
    484484
    485485                                do {
     
    497497                        } else if ( otherTupleParam ) {
    498498                                // bundle parameters into tuple to match other
    499                                 std::list< Type * > binderTypes;
     499                                std::vector< Type * > binderTypes;
    500500
    501501                                do {
     
    626626        // xxx - compute once and store in the FunctionType?
    627627        Type * extractResultType( FunctionType * function ) {
    628                 if ( function->get_returnVals().size() == 0 ) {
     628                if ( function->returnVals.size() == 0 ) {
    629629                        return new VoidType( Type::Qualifiers() );
    630                 } else if ( function->get_returnVals().size() == 1 ) {
    631                         return function->get_returnVals().front()->get_type()->clone();
     630                } else if ( function->returnVals.size() == 1 ) {
     631                        return function->returnVals.front()->get_type()->clone();
    632632                } else {
    633                         std::list< Type * > types;
    634                         for ( DeclarationWithType * decl : function->get_returnVals() ) {
     633                        std::vector< Type * > types;
     634                        for ( DeclarationWithType * decl : function->returnVals ) {
    635635                                types.push_back( decl->get_type()->clone() );
    636636                        } // for
  • src/ResolvExpr/typeops.h

    r43e0949 r2f42718  
    7373
    7474        // in AlternativeFinder.cc
    75         Cost computeConversionCost( Type *actualType, Type *formalType, 
     75        Cost computeConversionCost( Type *actualType, Type *formalType,
    7676                const SymTab::Indexer &indexer, const TypeEnvironment &env );
    7777
     
    112112        bool occurs( Type *type, std::string varName, const TypeEnvironment &env );
    113113
    114         template<typename Iter> 
     114        template<typename Iter>
    115115        bool occursIn( Type* ty, Iter begin, Iter end, const TypeEnvironment &env ) {
    116116                while ( begin != end ) {
     
    128128        void flatten( Type * type, OutputIterator out ) {
    129129                if ( TupleType * tupleType = dynamic_cast< TupleType * >( type ) ) {
    130                         for ( Type * t : tupleType->get_types() ) {
     130                        for ( Type * t : tupleType->types ) {
    131131                                flatten( t, out );
    132132                        }
  • src/SymTab/Autogen.cc

    r43e0949 r2f42718  
    410410                                }
    411411
    412                                 assert( ! func->get_functionType()->get_parameters().empty() );
    413                                 ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_parameters().front() );
     412                                assert( ! func->get_functionType()->parameters.empty() );
     413                                ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->parameters.front() );
    414414                                ObjectDecl * srcParam = nullptr;
    415                                 if ( func->get_functionType()->get_parameters().size() == 2 ) {
    416                                         srcParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->get_parameters().back() );
     415                                if ( func->get_functionType()->parameters.size() == 2 ) {
     416                                        srcParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->parameters.back() );
    417417                                }
    418418
     
    429429        void StructFuncGenerator::makeFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func ) {
    430430                FunctionType * ftype = func->type;
    431                 std::list<DeclarationWithType*> & params = ftype->parameters;
     431                auto & params = ftype->parameters;
    432432                assert( params.size() >= 2 );  // should not call this function for default ctor, etc.
    433433
     
    435435                ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( params.front() );
    436436                assert( dstParam );
    437                 std::list<DeclarationWithType*>::iterator parameter = params.begin()+1;
     437                auto parameter = params.begin()+1;
    438438                for ( ; member != end; ++member ) {
    439439                        if ( DeclarationWithType * field = dynamic_cast<DeclarationWithType*>( *member ) ) {
     
    656656        void makeTupleFunctionBody( FunctionDecl * function ) {
    657657                FunctionType * ftype = function->get_functionType();
    658                 assertf( ftype->get_parameters().size() == 1 || ftype->get_parameters().size() == 2, "too many parameters in generated tuple function" );
     658                assertf( ftype->parameters.size() == 1 || ftype->parameters.size() == 2, "too many parameters in generated tuple function" );
    659659
    660660                UntypedExpr * untyped = new UntypedExpr( new NameExpr( function->get_name() ) );
    661661
    662662                /// xxx - &* is used to make this easier for later passes to handle
    663                 untyped->get_args().push_back( new AddressExpr( UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );
    664                 if ( ftype->get_parameters().size() == 2 ) {
    665                         untyped->get_args().push_back( new VariableExpr( ftype->get_parameters().back() ) );
    666                 }
    667                 function->get_statements()->get_kids().push_back( new ExprStmt( untyped ) );
    668                 function->get_statements()->get_kids().push_back( new ReturnStmt( UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );
     663                untyped->get_args().push_back( new AddressExpr( UntypedExpr::createDeref( new VariableExpr( ftype->parameters.front() ) ) ) );
     664                if ( ftype->parameters.size() == 2 ) {
     665                        untyped->get_args().push_back( new VariableExpr( ftype->parameters.back() ) );
     666                }
     667                function->statements->get_kids().push_back( new ExprStmt( untyped ) );
     668                function->statements->get_kids().push_back( new ReturnStmt( UntypedExpr::createDeref( new VariableExpr( ftype->parameters.front() ) ) ) );
    669669        }
    670670
     
    691691                                        TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl::Dtype, true );
    692692                                        TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl );
    693                                         newDecl->get_assertions().push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,
     693                                        newDecl->assertions.push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,
    694694                                                                                                                                                   std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) );
    695                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
     695                                        newDecl->assertions.push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
    696696                                                                                                                                                   std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) );
    697                                         newDecl->get_assertions().push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr,
     697                                        newDecl->assertions.push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr,
    698698                                                                                                                                                   std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) );
    699                                         newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
     699                                        newDecl->assertions.push_back( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,
    700700                                                                                                                                                   std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) );
    701701                                        typeParams.push_back( newDecl );
  • src/SymTab/Demangle.cc

    r43e0949 r2f42718  
    173173
    174174                /************* parameters ***************/
    175                 const std::list<DeclarationWithType *> &pars = funcType->parameters;
     175                const std::vector<DeclarationWithType *> &pars = funcType->parameters;
    176176
    177177                if ( pars.empty() ) {
     
    476476                        Type * StringView::parseTuple(Type::Qualifiers tq) {
    477477                                PRINT( std::cerr << "tuple..." << std::endl; )
    478                                 std::list< Type * > types;
     478                                std::vector< Type * > types;
    479479                                size_t ncomponents;
    480480                                if (! extractNumber(ncomponents)) return nullptr;
  • src/SymTab/Indexer.cc

    r43e0949 r2f42718  
    142142                for ( auto decl : copy ) {
    143143                        if ( FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl.id ) ) {
    144                                 std::list< DeclarationWithType * > & params = function->type->parameters;
     144                                auto & params = function->type->parameters;
    145145                                assert( ! params.empty() );
    146146                                // use base type of pointer, so that qualifiers on the pointer type aren't considered.
     
    668668        }
    669669
    670         void Indexer::addIds( const std::list< DeclarationWithType * > & decls ) {
     670        void Indexer::addIds( const std::vector< DeclarationWithType * > & decls ) {
    671671                for ( auto d : decls ) {
    672672                        addId( d );
  • src/SymTab/Indexer.h

    r43e0949 r2f42718  
    117117
    118118                /// convenience function for adding a list of Ids to the indexer
    119                 void addIds( const std::list< DeclarationWithType * > & decls );
     119                void addIds( const std::vector< DeclarationWithType * > & decls );
    120120
    121121                /// convenience function for adding a list of forall parameters to the indexer
  • src/SymTab/Mangler.cc

    r43e0949 r2f42718  
    7979
    8080                          public:
    81                                 Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams, 
    82                                         int nextVarNum, const ResolvExpr::TypeEnvironment* env, 
     81                                Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
     82                                        int nextVarNum, const ResolvExpr::TypeEnvironment* env,
    8383                                        const VarMapType& varNums );
    8484
     
    109109                }
    110110
    111                 std::string mangleAssnKey( DeclarationWithType* decl, 
     111                std::string mangleAssnKey( DeclarationWithType* decl,
    112112                                const ResolvExpr::TypeEnvironment& env ) {
    113113                        PassVisitor<Mangler> mangler( env );
     
    118118                namespace {
    119119                        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams )
    120                                 : nextVarNum( 0 ), env(nullptr), isTopLevel( true ), 
    121                                 mangleOverridable( mangleOverridable ), typeMode( typeMode ), 
     120                                : nextVarNum( 0 ), env(nullptr), isTopLevel( true ),
     121                                mangleOverridable( mangleOverridable ), typeMode( typeMode ),
    122122                                mangleGenericParams( mangleGenericParams ) {}
    123                        
     123
    124124                        Mangler::Mangler( const ResolvExpr::TypeEnvironment& env )
    125125                                : nextVarNum( 0 ), env( &env ), isTopLevel( true ), mangleOverridable( false ),
    126126                                typeMode( false ), mangleGenericParams( true ) {}
    127                        
    128                         Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams, 
    129                                 int nextVarNum, const ResolvExpr::TypeEnvironment* env, 
     127
     128                        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
     129                                int nextVarNum, const ResolvExpr::TypeEnvironment* env,
    130130                                const VarMapType& varNums )
    131                                 : varNums( varNums ), nextVarNum( nextVarNum ), env( env ), isTopLevel( false ), 
    132                                 mangleOverridable( mangleOverridable ), typeMode( typeMode ), 
     131                                : varNums( varNums ), nextVarNum( nextVarNum ), env( env ), isTopLevel( false ),
     132                                mangleOverridable( mangleOverridable ), typeMode( typeMode ),
    133133                                mangleGenericParams( mangleGenericParams ) {}
    134134
     
    207207
    208208                        namespace {
    209                                 inline std::list< Type* > getTypes( const std::list< DeclarationWithType* > decls ) {
    210                                         std::list< Type* > ret;
     209                                inline std::vector< Type* > getTypes( const std::vector< DeclarationWithType* > decls ) {
     210                                        std::vector< Type* > ret;
    211211                                        std::transform( decls.begin(), decls.end(), std::back_inserter( ret ),
    212212                                                                        std::mem_fun( &DeclarationWithType::get_type ) );
     
    223223                                GuardValue( inFunctionType );
    224224                                inFunctionType = true;
    225                                 std::list< Type* > returnTypes = getTypes( functionType->returnVals );
     225                                std::vector< Type* > returnTypes = getTypes( functionType->returnVals );
    226226                                if (returnTypes.empty()) mangleName << Encoding::void_t;
    227227                                else acceptAll( returnTypes, *visitor );
    228228                                mangleName << "_";
    229                                 std::list< Type* > paramTypes = getTypes( functionType->parameters );
     229                                std::vector< Type* > paramTypes = getTypes( functionType->parameters );
    230230                                acceptAll( paramTypes, *visitor );
    231231                                mangleName << "_";
     
    238238
    239239                                if ( mangleGenericParams ) {
    240                                         std::list< Expression* >& params = refType->parameters;
     240                                        std::list< Expression* > & params = refType->parameters;
    241241                                        if ( ! params.empty() ) {
    242242                                                mangleName << "_";
    243                                                 for ( std::list< Expression* >::const_iterator param = params.begin(); param != params.end(); ++param ) {
    244                                                         TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
    245                                                         assertf(paramType, "Aggregate parameters should be type expressions: %s", toCString(*param));
     243                                                for ( auto param : params ) {
     244                                                        TypeExpr *paramType = dynamic_cast< TypeExpr* >( param );
     245                                                        assertf(paramType, "Aggregate parameters should be type expressions: %s", toCString(param));
    246246                                                        maybeAccept( paramType->type, *visitor );
    247247                                                }
     
    364364                                                        if ( varClass && varClass->type ) {
    365365                                                                PassVisitor<Mangler> sub_mangler(
    366                                                                         mangleOverridable, typeMode, mangleGenericParams, nextVarNum, 
     366                                                                        mangleOverridable, typeMode, mangleGenericParams, nextVarNum,
    367367                                                                        env, varNums );
    368368                                                                varClass->type->accept( sub_mangler );
     
    375375                                                }
    376376                                                varNums[ (*i)->name ] = std::make_pair( varName, (int)(*i)->get_kind() );
    377                                                 for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
    378                                                         PassVisitor<Mangler> sub_mangler( 
    379                                                                 mangleOverridable, typeMode, mangleGenericParams, nextVarNum, env, 
     377                                                for ( auto assert : (*i)->assertions ) {
     378                                                        PassVisitor<Mangler> sub_mangler(
     379                                                                mangleOverridable, typeMode, mangleGenericParams, nextVarNum, env,
    380380                                                                varNums );
    381                                                         (*assert)->accept( sub_mangler );
     381                                                        assert->accept( sub_mangler );
    382382                                                        assertionNames.push_back( sub_mangler.pass.get_mangleName() );
    383383                                                        acount++;
  • src/SymTab/Validate.cc

    r43e0949 r2f42718  
    179179                void previsit( ReturnStmt * returnStmt );
    180180
    181                 typedef std::list< DeclarationWithType * > ReturnVals;
    182                 ReturnVals returnVals;
     181                std::vector< DeclarationWithType * > returnVals;
    183182        };
    184183
     
    866865        void ReturnChecker::previsit( FunctionDecl * functionDecl ) {
    867866                GuardValue( returnVals );
    868                 returnVals = functionDecl->get_functionType()->get_returnVals();
     867                returnVals = functionDecl->get_functionType()->returnVals;
    869868        }
    870869
     
    11211120        void VerifyCtorDtorAssign::previsit( FunctionDecl * funcDecl ) {
    11221121                FunctionType * funcType = funcDecl->get_functionType();
    1123                 std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals();
    1124                 std::list< DeclarationWithType * > &params = funcType->get_parameters();
     1122                auto & returnVals = funcType->returnVals;
     1123                auto & params = funcType->parameters;
    11251124
    11261125                if ( CodeGen::isCtorDtorAssign( funcDecl->get_name() ) ) { // TODO: also check /=, etc.
     
    12051204        void ReturnTypeFixer::postvisit( FunctionDecl * functionDecl ) {
    12061205                FunctionType * ftype = functionDecl->get_functionType();
    1207                 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();
     1206                auto & retVals = ftype->returnVals;
    12081207                assertf( retVals.size() == 0 || retVals.size() == 1, "Function %s has too many return values: %zu", functionDecl->get_name().c_str(), retVals.size() );
    12091208                if ( retVals.size() == 1 ) {
     
    12231222                // Note that this pass needs to happen early so that other passes which look for tuple types
    12241223                // find them in all of the right places, including function return types.
    1225                 std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();
     1224                auto & retVals = ftype->returnVals;
    12261225                if ( retVals.size() > 1 ) {
    12271226                        // generate a single return parameter which is the tuple of all of the return values
     
    13201319                        if ( funcDecl->get_name() == "*?" && funcDecl->get_linkage() == LinkageSpec::Intrinsic ) {
    13211320                                FunctionType * ftype = funcDecl->get_functionType();
    1322                                 if ( ftype->get_parameters().size() == 1 && ftype->get_parameters().front()->get_type()->get_qualifiers() == Type::Qualifiers() ) {
     1321                                if ( ftype->parameters.size() == 1 && ftype->parameters.front()->get_type()->get_qualifiers() == Type::Qualifiers() ) {
    13231322                                        dereferenceOperator = funcDecl;
    13241323                                }
  • src/SynTree/Declaration.h

    r43e0949 r2f42718  
    182182        Type *base;
    183183        std::list< TypeDecl* > parameters;
    184         std::list< DeclarationWithType* > assertions;
     184        std::vector< DeclarationWithType* > assertions;
    185185
    186186        NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type );
     
    191191        void set_base( Type *newValue ) { base = newValue; }
    192192        std::list< TypeDecl* >& get_parameters() { return parameters; }
    193         std::list< DeclarationWithType* >& get_assertions() { return assertions; }
    194193
    195194        virtual std::string typeString() const = 0;
  • src/SynTree/FunctionType.cc

    r43e0949 r2f42718  
    3939
    4040namespace {
    41         bool containsTtype( const std::list<DeclarationWithType * > & l ) {
     41        bool containsTtype( const std::vector<DeclarationWithType * > & l ) {
    4242                if ( ! l.empty() ) {
    4343                        return Tuples::isTtype( l.back()->get_type() );
  • src/SynTree/TupleExpr.cc

    r43e0949 r2f42718  
    6666        TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() );
    6767        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    68         set_result( (*std::next( type->get_types().begin(), index ))->clone() );
     68        set_result( (*std::next( type->types.begin(), index ))->clone() );
    6969        // like MemberExpr, TupleIndexExpr is always an lvalue
    7070        get_result()->set_lvalue( true );
  • src/SynTree/TupleType.cc

    r43e0949 r2f42718  
    2525class Attribute;
    2626
    27 TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types, const std::vector< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
     27TupleType::TupleType( const Type::Qualifiers &tq, const std::vector< Type * > & types, const std::vector< Attribute * > & attributes ) : Type( tq, attributes ), types( types ) {
    2828        for ( Type * t : *this ) {
    2929                // xxx - this is very awkward. TupleTypes should contain objects so that members can be named, but if they don't have an initializer node then
  • src/SynTree/Type.h

    r43e0949 r2f42718  
    359359class FunctionType : public Type {
    360360  public:
    361         std::list<DeclarationWithType*> returnVals;
    362         std::list<DeclarationWithType*> parameters;
     361        std::vector<DeclarationWithType*> returnVals;
     362        std::vector<DeclarationWithType*> parameters;
    363363
    364364        // Does the function accept a variable number of arguments following the arguments specified in the parameters list.
     
    372372        virtual ~FunctionType();
    373373
    374         std::list<DeclarationWithType*> & get_returnVals() { return returnVals; }
    375         std::list<DeclarationWithType*> & get_parameters() { return parameters; }
    376374        bool get_isVarArgs() const { return isVarArgs; }
    377375        void set_isVarArgs( bool newValue ) { isVarArgs = newValue; }
     
    564562class TupleType : public Type {
    565563  public:
    566         std::list<Type *> types;
     564        std::vector<Type *> types;
    567565        std::list<Declaration *> members;
    568566
    569         TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::vector< Attribute * > & attributes = std::vector< Attribute * >()  );
     567        TupleType( const Type::Qualifiers & tq, const std::vector< Type * > & types, const std::vector< Attribute * > & attributes = std::vector< Attribute * >()  );
    570568        TupleType( const TupleType& );
    571569        virtual ~TupleType();
    572570
    573         typedef std::list<Type*> value_type;
     571        typedef std::vector< Type * > value_type;
    574572        typedef value_type::iterator iterator;
    575573
    576         std::list<Type *> & get_types() { return types; }
    577574        virtual unsigned size() const override { return types.size(); };
    578575
  • src/Tuples/TupleExpansion.cc

    r43e0949 r2f42718  
    217217                StructDecl * decl = typeMap[tupleSize];
    218218                StructInstType * newType = new StructInstType( qualifiers, decl );
    219                 for ( auto p : group_iterate( tupleType->get_types(), decl->get_parameters() ) ) {
     219                for ( auto p : group_iterate( tupleType->types, decl->get_parameters() ) ) {
    220220                        Type * t = std::get<0>(p);
    221221                        newType->get_parameters().push_back( new TypeExpr( t->clone() ) );
     
    298298        Type * makeTupleType( const std::list< Expression * > & exprs ) {
    299299                // produce the TupleType which aggregates the types of the exprs
    300                 std::list< Type * > types;
     300                std::vector< Type * > types;
     301                types.reserve(exprs.size());
    301302                Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex );
    302303                for ( Expression * expr : exprs ) {
Note: See TracChangeset for help on using the changeset viewer.