Changeset 8c49c0e for src/GenPoly
- Timestamp:
- Sep 19, 2016, 4:39:33 PM (8 years ago)
- 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
- Location:
- src/GenPoly
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r3c13c03 r8c49c0e 110 110 void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ); 111 111 /// 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 ); 113 113 void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars ); 114 114 FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars ); … … 612 612 } 613 613 614 void Pass1::findTypeOps( const std::list< TypeDecl *>&forall ) {614 void Pass1::findTypeOps( const Type::ForallList &forall ) { 615 615 // what if a nested function uses an assignment operator? 616 616 // 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 ) { 618 618 for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { 619 619 std::string typeName; … … 680 680 std::list< DeclarationWithType *> ¶mList = functionType->get_parameters(); 681 681 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 ) { 683 683 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 684 684 findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter ); … … 946 946 void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) { 947 947 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 ) { 949 949 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 950 950 InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() ); … … 1013 1013 Statement *bodyStmt; 1014 1014 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(); 1018 1018 for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) { 1019 1019 assert( tyArg != realType->get_forall().end() ); … … 1064 1064 std::list< DeclarationWithType *> ¶mList = functionType->get_parameters(); 1065 1065 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 ) { 1067 1067 for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) { 1068 1068 findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter ); … … 1416 1416 // find each of its needed secondary assignment operators 1417 1417 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(); 1419 1419 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(); 1421 1421 for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) { 1422 1422 // Add appropriate mapping to assignment expression environment … … 1592 1592 ObjectDecl newPtr( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, 1593 1593 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 ) { 1595 1595 ObjectDecl *sizeParm, *alignParm; 1596 1596 // add all size and alignment parameters to parameter list -
src/GenPoly/CopyParams.cc
r3c13c03 r8c49c0e 54 54 std::map< std::string, DeclarationWithType* > assignOps; 55 55 // 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 ) { 57 57 if ( (*tyVar)->get_kind() == TypeDecl::Any ) { 58 58 assert( !(*tyVar)->get_assertions().empty() ); -
src/GenPoly/FindFunction.cc
r3c13c03 r8c49c0e 29 29 virtual Type *mutate( PointerType *pointerType ); 30 30 private: 31 void handleForall( const std::list< TypeDecl* >&forall );31 void handleForall( const Type::ForallList &forall ); 32 32 33 33 std::list< FunctionType* > &functions; … … 51 51 } 52 52 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 ) { 55 55 TyVarMap::iterator var = tyVars.find( (*i)->get_name() ); 56 56 if ( var != tyVars.end() ) { -
src/GenPoly/GenPoly.cc
r3c13c03 r8c49c0e 110 110 ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) { 111 111 if ( function->get_returnVals().empty() ) return 0; 112 112 113 113 return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes ); 114 114 } … … 127 127 // } // if 128 128 if ( isDynRet( adaptee, tyVars ) ) return true; 129 129 130 130 for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) { 131 131 // if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) { … … 228 228 229 229 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 ) { 231 231 assert( *tyVar ); 232 232 tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
Note: See TracChangeset
for help on using the changeset viewer.