Changeset 271a5d3
- Timestamp:
- Nov 9, 2022, 12:30:24 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 5ce0659
- Parents:
- 6411b7d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r6411b7d r271a5d3 582 582 assert( funcType ); 583 583 584 // These iterators don't advance in unison. 584 585 std::list< DeclarationWithType* >::const_iterator fnParm = funcType->get_parameters().begin(); 585 586 std::list< Expression* >::const_iterator fnArg = arg; … … 855 856 Statement *bodyStmt; 856 857 857 Type::ForallList::const_iterator tyArg = realType->forall.begin(); 858 Type::ForallList::const_iterator tyParam = adapterType->forall.begin(); 859 Type::ForallList::const_iterator realTyParam = adaptee->forall.begin(); 860 for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) { 861 assert( tyArg != realType->get_forall().end() ); 862 std::list< DeclarationWithType *>::const_iterator assertArg = (*tyArg)->get_assertions().begin(); 863 std::list< DeclarationWithType *>::const_iterator assertParam = (*tyParam)->get_assertions().begin(); 864 std::list< DeclarationWithType *>::const_iterator realAssertParam = (*realTyParam)->get_assertions().begin(); 865 for ( ; assertParam != (*tyParam)->get_assertions().end(); ++assertArg, ++assertParam, ++realAssertParam ) { 866 assert( assertArg != (*tyArg)->get_assertions().end() ); 867 adapteeApp->get_args().push_back( makeAdapterArg( *assertParam, *assertArg, *realAssertParam, tyVars ) ); 858 for ( auto tys : group_iterate( realType->forall, adapterType->forall, adaptee->forall ) ) { 859 TypeDecl * tyArg = std::get<0>( tys ); 860 TypeDecl * tyParam = std::get<1>( tys ); 861 TypeDecl * realTyParam = std::get<2>( tys ); 862 for ( auto asserts : group_iterate( tyArg->assertions, tyParam->assertions, realTyParam->assertions ) ) { 863 DeclarationWithType * assertArg = std::get<0>( asserts ); 864 DeclarationWithType * assertParam = std::get<1>( asserts ); 865 DeclarationWithType * realAssertParam = std::get<2>( asserts ); 866 adapteeApp->args.push_back( makeAdapterArg( assertParam, assertArg, realAssertParam, tyVars ) ); 868 867 } // for 869 868 } // for … … 1093 1092 Expression *Pass1::postmutate( ApplicationExpr *appExpr ) { 1094 1093 // std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl; 1095 // for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i) {1096 // std::cerr << i->first << " ";1094 // for ( auto tyVar : scopeTyVars ) { 1095 // std::cerr << tyVar.first << " "; 1097 1096 // } 1098 1097 // std::cerr << "\n"; … … 1683 1682 bool hasDynamicLayout = false; 1684 1683 1685 std::list< TypeDecl* >::const_iterator baseParam = baseParams.begin();1686 std::list< Expression* >::const_iterator typeParam = typeParams.begin();1687 for ( ; baseParam != baseParams.end() && typeParam != typeParams.end(); ++baseParam, ++typeParam ) {1684 for ( auto paramPair : group_iterate( baseParams, typeParams ) ) { 1685 TypeDecl * baseParam = std::get<0>( paramPair ); 1686 Expression * typeParam = std::get<1>( paramPair ); 1688 1687 // skip non-otype parameters 1689 if ( ! (*baseParam)->isComplete() ) continue;1690 TypeExpr *typeExpr = dynamic_cast< TypeExpr* >( *typeParam );1688 if ( ! baseParam->isComplete() ) continue; 1689 TypeExpr *typeExpr = dynamic_cast< TypeExpr* >( typeParam ); 1691 1690 assert( typeExpr && "all otype parameters should be type expressions" ); 1692 1691 … … 1695 1694 if ( isPolyType( type ) ) hasDynamicLayout = true; 1696 1695 } 1697 assert( baseParam == baseParams.end() && typeParam == typeParams.end() );1698 1696 1699 1697 return hasDynamicLayout; … … 1851 1849 // build initializer list for offset array 1852 1850 std::list< Initializer* > inits; 1853 for ( std::list< Declaration* >::const_iterator member = baseMembers.begin(); member != baseMembers.end(); ++member ) { 1854 if ( DeclarationWithType *memberDecl = dynamic_cast< DeclarationWithType* >( *member ) ) { 1855 inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) ); 1856 } else { 1857 assertf( false, "Requesting offset of Non-DWT member: %s", toString( *member ).c_str() ); 1858 } 1851 for ( Declaration * const member : baseMembers ) { 1852 DeclarationWithType *memberDecl = dynamic_cast< DeclarationWithType* >( member ); 1853 assertf( memberDecl, "Requesting offset of Non-DWT member: %s", toString( member ).c_str() ); 1854 inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) ); 1859 1855 } 1860 1856
Note: See TracChangeset
for help on using the changeset viewer.