Changeset 8c49c0e for src/GenPoly


Ignore:
Timestamp:
Sep 19, 2016, 4:39:33 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
aefcc3b
Parents:
3c13c03
Message:

decouple code that uses Type's forall list from std::list in preparation for trying to replace with a managed list

Location:
src/GenPoly
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r3c13c03 r8c49c0e  
    110110                        void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars );
    111111                        /// Stores assignment operators from assertion list in local map of assignment operations
    112                         void findTypeOps( const std::list< TypeDecl *> &forall );
     112                        void findTypeOps( const Type::ForallList &forall );
    113113                        void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars );
    114114                        FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars );
     
    612612                }
    613613
    614                 void Pass1::findTypeOps( const std::list< TypeDecl *> &forall ) {
     614                void Pass1::findTypeOps( const Type::ForallList &forall ) {
    615615                        // what if a nested function uses an assignment operator?
    616616                        // assignOps.clear();
    617                         for ( std::list< TypeDecl *>::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
     617                        for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    618618                                for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
    619619                                        std::string typeName;
     
    680680                                std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    681681                                std::list< FunctionType *> functions;
    682                                 for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     682                                for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    683683                                        for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    684684                                                findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter );
     
    946946                void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    947947                        std::list< Expression *>::iterator cur = arg;
    948                         for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     948                        for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    949949                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    950950                                        InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() );
     
    10131013                        Statement *bodyStmt;
    10141014
    1015                         std::list< TypeDecl *>::iterator tyArg = realType->get_forall().begin();
    1016                         std::list< TypeDecl *>::iterator tyParam = adapterType->get_forall().begin();
    1017                         std::list< TypeDecl *>::iterator realTyParam = adaptee->get_forall().begin();
     1015                        Type::ForallList::iterator tyArg = realType->get_forall().begin();
     1016                        Type::ForallList::iterator tyParam = adapterType->get_forall().begin();
     1017                        Type::ForallList::iterator realTyParam = adaptee->get_forall().begin();
    10181018                        for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
    10191019                                assert( tyArg != realType->get_forall().end() );
     
    10641064                        std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    10651065                        std::list< FunctionType *> functions;
    1066                         for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     1066                        for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    10671067                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    10681068                                        findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter );
     
    14161416                                        // find each of its needed secondary assignment operators
    14171417                                        std::list< Expression* > &tyParams = refType->get_parameters();
    1418                                         std::list< TypeDecl* > &forallParams = functionDecl->get_type()->get_forall();
     1418                                        Type::ForallList &forallParams = functionDecl->get_type()->get_forall();
    14191419                                        std::list< Expression* >::const_iterator tyIt = tyParams.begin();
    1420                                         std::list< TypeDecl* >::const_iterator forallIt = forallParams.begin();
     1420                                        Type::ForallList::const_iterator forallIt = forallParams.begin();
    14211421                                        for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) {
    14221422                                                // Add appropriate mapping to assignment expression environment
     
    15921592                        ObjectDecl newPtr( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0,
    15931593                                           new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 );
    1594                         for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
     1594                        for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
    15951595                                ObjectDecl *sizeParm, *alignParm;
    15961596                                // add all size and alignment parameters to parameter list
  • src/GenPoly/CopyParams.cc

    r3c13c03 r8c49c0e  
    5454                                std::map< std::string, DeclarationWithType* > assignOps;
    5555                                // assume the assignment operator is the first assert param after any "type" parameter
    56                                 for ( std::list< TypeDecl* >::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
     56                                for ( Type::ForallList::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
    5757                                        if ( (*tyVar)->get_kind() == TypeDecl::Any ) {
    5858                                                assert( !(*tyVar)->get_assertions().empty() );
  • src/GenPoly/FindFunction.cc

    r3c13c03 r8c49c0e  
    2929                virtual Type *mutate( PointerType *pointerType );
    3030          private:
    31                 void handleForall( const std::list< TypeDecl* > &forall );
     31                void handleForall( const Type::ForallList &forall );
    3232
    3333                std::list< FunctionType* > &functions;
     
    5151        }
    5252
    53         void FindFunction::handleForall( const std::list< TypeDecl* > &forall ) {
    54                 for ( std::list< TypeDecl* >::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
     53        void FindFunction::handleForall( const Type::ForallList &forall ) {
     54                for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    5555                        TyVarMap::iterator var = tyVars.find( (*i)->get_name() );
    5656                        if ( var != tyVars.end() ) {
  • src/GenPoly/GenPoly.cc

    r3c13c03 r8c49c0e  
    110110        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) {
    111111                if ( function->get_returnVals().empty() ) return 0;
    112                
     112
    113113                return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
    114114        }
     
    127127//              } // if
    128128                if ( isDynRet( adaptee, tyVars ) ) return true;
    129                
     129
    130130                for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
    131131//                      if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
     
    228228
    229229        void makeTyVarMap( Type *type, TyVarMap &tyVarMap ) {
    230                 for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
     230                for ( Type::ForallList::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
    231231                        assert( *tyVar );
    232232                        tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
Note: See TracChangeset for help on using the changeset viewer.