Changes in src/Common/PassVisitor.impl.h [c194661:d8893ca]
- File:
-
- 1 edited
-
src/Common/PassVisitor.impl.h (modified) (32 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
rc194661 rd8893ca 55 55 it, 56 56 [](Declaration * decl) -> auto { 57 return new DeclStmt( decl );57 return new DeclStmt( noLabels, decl ); 58 58 } 59 59 ); … … 62 62 63 63 template< typename pass_type > 64 inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {64 static inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) { 65 65 DeclList_t* beforeDecls = visitor.get_beforeDecls(); 66 66 DeclList_t* afterDecls = visitor.get_afterDecls(); 67 SemanticError Exceptionerrors;67 SemanticError errors; 68 68 69 69 for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { … … 76 76 // run visitor on declaration 77 77 maybeAccept_impl( *i, visitor ); 78 } catch( SemanticErrorException &e ) { 78 } catch( SemanticError &e ) { 79 e.set_location( (*i)->location ); 79 80 errors.append( e ); 80 81 } … … 89 90 90 91 template< typename pass_type > 91 inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {92 static inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) { 92 93 DeclList_t* beforeDecls = mutator.get_beforeDecls(); 93 94 DeclList_t* afterDecls = mutator.get_afterDecls(); 94 SemanticError Exceptionerrors;95 SemanticError errors; 95 96 96 97 for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { … … 102 103 // run mutator on declaration 103 104 maybeMutate_impl( *i, mutator ); 104 } catch( SemanticErrorException &e ) { 105 } catch( SemanticError &e ) { 106 e.set_location( (*i)->location ); 105 107 errors.append( e ); 106 108 } … … 125 127 inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) { 126 128 if ( ! visitor.get_visit_children() ) return; 127 SemanticError Exceptionerrors;129 SemanticError errors; 128 130 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { 129 131 try { … … 131 133 (*i)->accept( visitor ); 132 134 } 133 } catch( SemanticErrorException &e ) { 135 } catch( SemanticError &e ) { 136 e.set_location( (*i)->location ); 134 137 errors.append( e ); 135 138 } … … 152 155 inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) { 153 156 if ( ! mutator.get_visit_children() ) return; 154 SemanticError Exceptionerrors;157 SemanticError errors; 155 158 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { 156 159 try { … … 159 162 assert( *i ); 160 163 } // if 161 } catch( SemanticErrorException &e ) { 164 } catch( SemanticError &e ) { 165 e.set_location( (*i)->location ); 162 166 errors.append( e ); 163 167 } // try … … 172 176 void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) { 173 177 if ( ! get_visit_children() ) return; 174 SemanticError Exceptionerrors;178 SemanticError errors; 175 179 176 180 // don't want statements from outer CompoundStmts to be added to this CompoundStmt … … 195 199 || ( empty( beforeDecls ) && empty( afterDecls )) ); 196 200 197 } catch ( SemanticErrorException &e ) { 201 } catch ( SemanticError &e ) { 202 e.set_location( (*i)->location ); 198 203 errors.append( e ); 199 204 } … … 246 251 || ( empty( beforeDecls ) && empty( afterDecls )) ); 247 252 248 CompoundStmt *compound = new CompoundStmt( );253 CompoundStmt *compound = new CompoundStmt( noLabels ); 249 254 if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); } 250 255 if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); } … … 360 365 maybeAccept_impl ( node->attributes , *this ); 361 366 362 indexerAddId( node ); 367 if ( node->name != "" ) { 368 indexerAddId( node ); 369 } 363 370 364 371 VISIT_END( node ); … … 374 381 maybeMutate_impl ( node->attributes , *this ); 375 382 376 indexerAddId( node ); 383 if ( node->name != "" ) { 384 indexerAddId( node ); 385 } 377 386 378 387 MUTATE_END( DeclarationWithType, node ); … … 385 394 VISIT_START( node ); 386 395 387 indexerAddId( node ); 388 389 maybeAccept_impl( node->withExprs, *this ); 390 { 391 // with clause introduces a level of scope (for the with expression members). 392 // with clause exprs are added to the indexer before parameters so that parameters 393 // shadow with exprs and not the other way around. 394 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 395 indexerAddWith( node->withExprs, node ); 396 { 397 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 398 // implicit add __func__ identifier as specified in the C manual 6.4.2.2 399 static ObjectDecl func( 400 "__func__", noStorageClasses, LinkageSpec::C, nullptr, 401 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), 402 nullptr 403 ); 404 indexerAddId( &func ); 405 maybeAccept_impl( node->type, *this ); 406 // function body needs to have the same scope as parameters - CompoundStmt will not enter 407 // a new scope if inFunction is true 408 ValueGuard< bool > oldInFunction( inFunction ); 409 inFunction = true; 410 maybeAccept_impl( node->statements, *this ); 411 maybeAccept_impl( node->attributes, *this ); 412 } 396 if ( node->name != "" ) { 397 indexerAddId( node ); 398 } 399 400 { 401 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 402 // implicit add __func__ identifier as specified in the C manual 6.4.2.2 403 static ObjectDecl func( 404 "__func__", noStorageClasses, LinkageSpec::C, nullptr, 405 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), 406 nullptr 407 ); 408 indexerAddId( &func ); 409 maybeAccept_impl( node->type, *this ); 410 maybeAccept_impl( node->statements, *this ); 411 maybeAccept_impl( node->attributes, *this ); 413 412 } 414 413 … … 420 419 MUTATE_START( node ); 421 420 422 indexerAddId( node ); 423 424 { 425 // with clause introduces a level of scope (for the with expression members). 426 // with clause exprs are added to the indexer before parameters so that parameters 427 // shadow with exprs and not the other way around. 428 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 429 indexerAddWith( node->withExprs, node ); 430 { 431 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 432 // implicit add __func__ identifier as specified in the C manual 6.4.2.2 433 static ObjectDecl func( 434 "__func__", noStorageClasses, LinkageSpec::C, nullptr, 435 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), 436 nullptr 437 ); 438 indexerAddId( &func ); 439 maybeMutate_impl( node->type, *this ); 440 // function body needs to have the same scope as parameters - CompoundStmt will not enter 441 // a new scope if inFunction is true 442 ValueGuard< bool > oldInFunction( inFunction ); 443 inFunction = true; 444 maybeMutate_impl( node->statements, *this ); 445 maybeMutate_impl( node->attributes, *this ); 446 } 421 if ( node->name != "" ) { 422 indexerAddId( node ); 423 } 424 425 { 426 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 427 // implicit add __func__ identifier as specified in the C manual 6.4.2.2 428 static ObjectDecl func( 429 "__func__", noStorageClasses, LinkageSpec::C, nullptr, 430 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), 431 nullptr 432 ); 433 indexerAddId( &func ); 434 maybeMutate_impl( node->type, *this ); 435 maybeMutate_impl( node->statements, *this ); 436 maybeMutate_impl( node->attributes, *this ); 447 437 } 448 438 … … 693 683 694 684 //-------------------------------------------------------------------------- 695 // StaticAssertDecl696 template< typename pass_type >697 void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) {698 VISIT_START( node );699 700 node->condition = visitExpression( node->condition );701 maybeAccept_impl( node->message, *this );702 703 VISIT_END( node );704 }705 706 template< typename pass_type >707 StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) {708 MUTATE_START( node );709 710 node->condition = mutateExpression( node->condition );711 maybeMutate_impl( node->message, *this );712 713 MUTATE_END( StaticAssertDecl, node );714 }715 716 //--------------------------------------------------------------------------717 685 // CompoundStmt 718 686 template< typename pass_type > … … 720 688 VISIT_START( node ); 721 689 { 722 // do not enter a new scope if inFunction is true - needs to check old state before the assignment 723 ValueGuard< bool > oldInFunction( inFunction ); 724 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } ); 690 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 725 691 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 726 inFunction = false;727 692 visitStatementList( node->kids ); 728 693 } … … 734 699 MUTATE_START( node ); 735 700 { 736 // do not enter a new scope if inFunction is true - needs to check old state before the assignment 737 ValueGuard< bool > oldInFunction( inFunction ); 738 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } ); 701 auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 739 702 auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); 740 inFunction = false;741 703 mutateStatementList( node->kids ); 742 704 } … … 768 730 template< typename pass_type > 769 731 void PassVisitor< pass_type >::visit( AsmStmt * node ) { 770 VISIT_START( node ) 771 772 maybeAccept_impl( node->instruction, *this ); 773 maybeAccept_impl( node->output, *this ); 774 maybeAccept_impl( node->input, *this ); 775 maybeAccept_impl( node->clobber, *this ); 776 777 VISIT_END( node ); 732 VISIT_BODY( node ); 778 733 } 779 734 780 735 template< typename pass_type > 781 736 Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) { 782 MUTATE_START( node ); 783 784 maybeMutate_impl( node->instruction, *this ); 785 maybeMutate_impl( node->output, *this ); 786 maybeMutate_impl( node->input, *this ); 787 maybeMutate_impl( node->clobber, *this ); 788 789 MUTATE_END( Statement, node ); 790 } 791 792 //-------------------------------------------------------------------------- 793 // AsmStmt 794 template< typename pass_type > 795 void PassVisitor< pass_type >::visit( DirectiveStmt * node ) { 796 VISIT_START( node ) 797 798 VISIT_END( node ); 799 } 800 801 template< typename pass_type > 802 Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) { 803 MUTATE_START( node ); 804 805 MUTATE_END( Statement, node ); 737 MUTATE_BODY( Statement, node ); 806 738 } 807 739 … … 842 774 VISIT_START( node ); 843 775 844 { 845 // while statements introduce a level of scope (for the initialization) 846 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 847 maybeAccept_impl( node->initialization, *this ); 848 visitExpression ( node->condition ); 849 node->body = visitStatement( node->body ); 850 } 776 visitExpression( node->condition ); 777 node->body = visitStatement( node->body ); 851 778 852 779 VISIT_END( node ); … … 857 784 MUTATE_START( node ); 858 785 859 { 860 // while statements introduce a level of scope (for the initialization) 861 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 862 maybeMutate_impl( node->initialization, *this ); 863 node->condition = mutateExpression( node->condition ); 864 node->body = mutateStatement ( node->body ); 865 } 866 786 node->condition = mutateExpression( node->condition ); 787 node->body = mutateStatement ( node->body ); 867 788 868 789 MUTATE_END( Statement, node ); … … 947 868 template< typename pass_type > 948 869 void PassVisitor< pass_type >::visit( BranchStmt * node ) { 949 VISIT_START( node ); 950 VISIT_END( node ); 870 VISIT_BODY( node ); 951 871 } 952 872 953 873 template< typename pass_type > 954 874 Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) { 955 MUTATE_START( node ); 875 MUTATE_BODY( Statement, node ); 876 } 877 878 //-------------------------------------------------------------------------- 879 // ReturnStmt 880 template< typename pass_type > 881 void PassVisitor< pass_type >::visit( ReturnStmt * node ) { 882 VISIT_START( node ); 883 884 visitExpression( node->expr ); 885 886 VISIT_END( node ); 887 } 888 889 template< typename pass_type > 890 Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) { 891 MUTATE_START( node ); 892 893 node->expr = mutateExpression( node->expr ); 894 956 895 MUTATE_END( Statement, node ); 957 896 } 958 897 959 898 //-------------------------------------------------------------------------- 960 // ReturnStmt961 template< typename pass_type >962 void PassVisitor< pass_type >::visit( ReturnStmt * node ) {963 VISIT_START( node );964 965 visitExpression( node->expr );966 967 VISIT_END( node );968 }969 970 template< typename pass_type >971 Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {972 MUTATE_START( node );973 974 node->expr = mutateExpression( node->expr );975 976 MUTATE_END( Statement, node );977 }978 979 //--------------------------------------------------------------------------980 899 // ThrowStmt 981 900 982 901 template< typename pass_type > 983 902 void PassVisitor< pass_type >::visit( ThrowStmt * node ) { 984 VISIT_START( node ); 985 986 maybeAccept_impl( node->expr, *this ); 987 maybeAccept_impl( node->target, *this ); 988 989 VISIT_END( node ); 903 VISIT_BODY( node ); 990 904 } 991 905 992 906 template< typename pass_type > 993 907 Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) { 994 MUTATE_START( node ); 995 996 maybeMutate_impl( node->expr, *this ); 997 maybeMutate_impl( node->target, *this ); 998 999 MUTATE_END( Statement, node ); 908 MUTATE_BODY( Statement, node ); 1000 909 } 1001 910 … … 1056 965 template< typename pass_type > 1057 966 void PassVisitor< pass_type >::visit( FinallyStmt * node ) { 1058 VISIT_START( node ); 1059 1060 maybeAccept_impl( node->block, *this ); 1061 1062 VISIT_END( node ); 967 VISIT_BODY( node ); 1063 968 } 1064 969 1065 970 template< typename pass_type > 1066 971 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { 1067 MUTATE_START( node ); 1068 1069 maybeMutate_impl( node->block, *this ); 1070 972 MUTATE_BODY( Statement, node ); 973 } 974 975 //-------------------------------------------------------------------------- 976 // WaitForStmt 977 template< typename pass_type > 978 void PassVisitor< pass_type >::visit( WaitForStmt * node ) { 979 VISIT_BODY( node ); 980 } 981 982 template< typename pass_type > 983 Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) { 984 MUTATE_BODY( Statement, node ); 985 } 986 987 988 989 //-------------------------------------------------------------------------- 990 // NullStmt 991 template< typename pass_type > 992 void PassVisitor< pass_type >::visit( WithStmt * node ) { 993 VISIT_START( node ); 994 maybeAccept_impl( node->exprs, *this ); 995 { 996 // catch statements introduce a level of scope (for the caught exception) 997 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 998 indexerAddWith( node ); 999 maybeAccept_impl( node->stmt, *this ); 1000 } 1001 VISIT_END( node ); 1002 } 1003 1004 template< typename pass_type > 1005 Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) { 1006 MUTATE_START( node ); 1007 maybeMutate_impl( node->exprs, *this ); 1008 { 1009 // catch statements introduce a level of scope (for the caught exception) 1010 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); 1011 indexerAddWith( node ); 1012 maybeMutate_impl( node->stmt, *this ); 1013 } 1071 1014 MUTATE_END( Statement, node ); 1072 1015 } 1073 1016 1074 1017 //-------------------------------------------------------------------------- 1075 // WaitForStmt1076 template< typename pass_type >1077 void PassVisitor< pass_type >::visit( WaitForStmt * node ) {1078 VISIT_START( node );1079 1080 for( auto & clause : node->clauses ) {1081 maybeAccept_impl( clause.target.function, *this );1082 maybeAccept_impl( clause.target.arguments, *this );1083 1084 maybeAccept_impl( clause.statement, *this );1085 maybeAccept_impl( clause.condition, *this );1086 }1087 1088 maybeAccept_impl( node->timeout.time, *this );1089 maybeAccept_impl( node->timeout.statement, *this );1090 maybeAccept_impl( node->timeout.condition, *this );1091 maybeAccept_impl( node->orelse.statement, *this );1092 maybeAccept_impl( node->orelse.condition, *this );1093 1094 VISIT_END( node );1095 }1096 1097 template< typename pass_type >1098 Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {1099 MUTATE_START( node );1100 1101 for( auto & clause : node->clauses ) {1102 maybeMutate_impl( clause.target.function, *this );1103 maybeMutate_impl( clause.target.arguments, *this );1104 1105 maybeMutate_impl( clause.statement, *this );1106 maybeMutate_impl( clause.condition, *this );1107 }1108 1109 maybeMutate_impl( node->timeout.time, *this );1110 maybeMutate_impl( node->timeout.statement, *this );1111 maybeMutate_impl( node->timeout.condition, *this );1112 maybeMutate_impl( node->orelse.statement, *this );1113 maybeMutate_impl( node->orelse.condition, *this );1114 1115 MUTATE_END( Statement, node );1116 }1117 1118 1119 1120 //--------------------------------------------------------------------------1121 1018 // NullStmt 1122 1019 template< typename pass_type > 1123 void PassVisitor< pass_type >::visit( WithStmt * node ) {1124 VISIT_START( node );1125 maybeAccept_impl( node->exprs, *this );1126 {1127 // catch statements introduce a level of scope (for the caught exception)1128 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );1129 indexerAddWith( node->exprs, node );1130 maybeAccept_impl( node->stmt, *this );1131 }1132 VISIT_END( node );1133 }1134 1135 template< typename pass_type >1136 Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) {1137 MUTATE_START( node );1138 maybeMutate_impl( node->exprs, *this );1139 {1140 // catch statements introduce a level of scope (for the caught exception)1141 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );1142 indexerAddWith( node->exprs, node );1143 maybeMutate_impl( node->stmt, *this );1144 }1145 MUTATE_END( Statement, node );1146 }1147 1148 //--------------------------------------------------------------------------1149 // NullStmt1150 template< typename pass_type >1151 1020 void PassVisitor< pass_type >::visit( NullStmt * node ) { 1152 VISIT_START( node ); 1153 VISIT_END( node ); 1021 VISIT_BODY( node ); 1154 1022 } 1155 1023 1156 1024 template< typename pass_type > 1157 1025 NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) { 1158 MUTATE_START( node ); 1159 MUTATE_END( NullStmt, node ); 1026 MUTATE_BODY( NullStmt, node ); 1160 1027 } 1161 1028 … … 1164 1031 template< typename pass_type > 1165 1032 void PassVisitor< pass_type >::visit( DeclStmt * node ) { 1166 VISIT_START( node ); 1167 1168 maybeAccept_impl( node->decl, *this ); 1169 1170 VISIT_END( node ); 1033 VISIT_BODY( node ); 1171 1034 } 1172 1035 1173 1036 template< typename pass_type > 1174 1037 Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) { 1175 MUTATE_START( node ); 1176 1177 maybeMutate_impl( node->decl, *this ); 1178 1179 MUTATE_END( Statement, node ); 1038 MUTATE_BODY( Statement, node ); 1180 1039 } 1181 1040 … … 1184 1043 template< typename pass_type > 1185 1044 void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { 1186 VISIT_START( node ); 1187 1188 maybeAccept_impl( node->callStmt, *this ); 1189 1190 VISIT_END( node ); 1045 VISIT_BODY( node ); 1191 1046 } 1192 1047 1193 1048 template< typename pass_type > 1194 1049 Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) { 1195 MUTATE_START( node ); 1196 1197 maybeMutate_impl( node->callStmt, *this ); 1198 1199 MUTATE_END( Statement, node ); 1050 MUTATE_BODY( Statement, node ); 1200 1051 } 1201 1052 … … 1290 1141 template< typename pass_type > 1291 1142 Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) { 1292 MUTATE_START( node );1293 1294 indexerScopedMutate( node->env , *this );1295 indexerScopedMutate( node->result, *this );1296 maybeMutate_impl ( node->arg , *this );1297 1298 MUTATE_END( Expression, node );1299 }1300 1301 //--------------------------------------------------------------------------1302 // KeywordCastExpr1303 template< typename pass_type >1304 void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) {1305 VISIT_START( node );1306 1307 indexerScopedAccept( node->result, *this );1308 maybeAccept_impl ( node->arg , *this );1309 1310 VISIT_END( node );1311 }1312 1313 template< typename pass_type >1314 Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) {1315 1143 MUTATE_START( node ); 1316 1144 … … 1576 1404 indexerScopedAccept( node->result, *this ); 1577 1405 maybeAccept_impl ( node->type , *this ); 1406 maybeAccept_impl ( node->member, *this ); 1578 1407 1579 1408 VISIT_END( node ); … … 1587 1416 indexerScopedMutate( node->result, *this ); 1588 1417 maybeMutate_impl ( node->type , *this ); 1418 maybeMutate_impl ( node->member, *this ); 1589 1419 1590 1420 MUTATE_END( Expression, node ); … … 2023 1853 } 2024 1854 2025 //--------------------------------------------------------------------------2026 // UntypedInitExpr2027 template< typename pass_type >2028 void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) {2029 VISIT_START( node );2030 2031 indexerScopedAccept( node->result, *this );2032 maybeAccept_impl ( node->expr , *this );2033 // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.2034 2035 VISIT_END( node );2036 }2037 2038 template< typename pass_type >2039 Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) {2040 MUTATE_START( node );2041 2042 indexerScopedMutate( node->env , *this );2043 indexerScopedMutate( node->result, *this );2044 maybeMutate_impl ( node->expr , *this );2045 // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.2046 2047 MUTATE_END( Expression, node );2048 }2049 2050 //--------------------------------------------------------------------------2051 // InitExpr2052 template< typename pass_type >2053 void PassVisitor< pass_type >::visit( InitExpr * node ) {2054 VISIT_START( node );2055 2056 indexerScopedAccept( node->result, *this );2057 maybeAccept_impl ( node->expr , *this );2058 maybeAccept_impl ( node->designation, *this );2059 2060 VISIT_END( node );2061 }2062 2063 template< typename pass_type >2064 Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) {2065 MUTATE_START( node );2066 2067 indexerScopedMutate( node->env , *this );2068 indexerScopedMutate( node->result, *this );2069 maybeMutate_impl ( node->expr , *this );2070 maybeMutate_impl ( node->designation, *this );2071 2072 MUTATE_END( Expression, node );2073 }2074 2075 //--------------------------------------------------------------------------2076 // DeletedExpr2077 template< typename pass_type >2078 void PassVisitor< pass_type >::visit( DeletedExpr * node ) {2079 VISIT_START( node );2080 2081 indexerScopedAccept( node->result, *this );2082 maybeAccept_impl( node->expr, *this );2083 // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.2084 2085 VISIT_END( node );2086 }2087 2088 template< typename pass_type >2089 Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) {2090 MUTATE_START( node );2091 2092 indexerScopedMutate( node->env, *this );2093 indexerScopedMutate( node->result, *this );2094 maybeMutate_impl( node->expr, *this );2095 2096 MUTATE_END( Expression, node );2097 }2098 2099 //--------------------------------------------------------------------------2100 // DefaultArgExpr2101 template< typename pass_type >2102 void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) {2103 VISIT_START( node );2104 2105 indexerScopedAccept( node->result, *this );2106 maybeAccept_impl( node->expr, *this );2107 2108 VISIT_END( node );2109 }2110 2111 template< typename pass_type >2112 Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) {2113 MUTATE_START( node );2114 2115 indexerScopedMutate( node->env, *this );2116 indexerScopedMutate( node->result, *this );2117 maybeMutate_impl( node->expr, *this );2118 2119 MUTATE_END( Expression, node );2120 }2121 2122 //--------------------------------------------------------------------------2123 // GenericExpr2124 template< typename pass_type >2125 void PassVisitor< pass_type >::visit( GenericExpr * node ) {2126 VISIT_START( node );2127 2128 indexerScopedAccept( node->result, *this );2129 maybeAccept_impl( node->control, *this );2130 for ( GenericExpr::Association & assoc : node->associations ) {2131 indexerScopedAccept( assoc.type, *this );2132 maybeAccept_impl( assoc.expr, *this );2133 }2134 2135 VISIT_END( node );2136 }2137 2138 template< typename pass_type >2139 Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) {2140 MUTATE_START( node );2141 2142 indexerScopedMutate( node->env, *this );2143 indexerScopedMutate( node->result, *this );2144 maybeMutate_impl( node->control, *this );2145 for ( GenericExpr::Association & assoc : node->associations ) {2146 indexerScopedMutate( assoc.type, *this );2147 maybeMutate_impl( assoc.expr, *this );2148 }2149 2150 MUTATE_END( Expression, node );2151 }2152 2153 //--------------------------------------------------------------------------2154 // VoidType2155 1855 template< typename pass_type > 2156 1856 void PassVisitor< pass_type >::visit( VoidType * node ) { 2157 VISIT_START( node ); 2158 2159 maybeAccept_impl( node->forall, *this ); 2160 2161 VISIT_END( node ); 2162 } 2163 2164 template< typename pass_type > 2165 Type * PassVisitor< pass_type >::mutate( VoidType * node ) { 2166 MUTATE_START( node ); 2167 2168 maybeMutate_impl( node->forall, *this ); 2169 2170 MUTATE_END( Type, node ); 2171 } 2172 2173 //-------------------------------------------------------------------------- 2174 // BasicType 1857 VISIT_BODY( node ); 1858 } 1859 2175 1860 template< typename pass_type > 2176 1861 void PassVisitor< pass_type >::visit( BasicType * node ) { 2177 VISIT_START( node ); 2178 2179 maybeAccept_impl( node->forall, *this ); 2180 2181 VISIT_END( node ); 2182 } 2183 2184 template< typename pass_type > 2185 Type * PassVisitor< pass_type >::mutate( BasicType * node ) { 2186 MUTATE_START( node ); 2187 2188 maybeMutate_impl( node->forall, *this ); 2189 2190 MUTATE_END( Type, node ); 2191 } 2192 2193 //-------------------------------------------------------------------------- 2194 // PointerType 1862 VISIT_BODY( node ); 1863 } 1864 2195 1865 template< typename pass_type > 2196 1866 void PassVisitor< pass_type >::visit( PointerType * node ) { 2197 VISIT_START( node ); 2198 2199 maybeAccept_impl( node->forall, *this ); 2200 // xxx - should PointerType visit/mutate dimension? 2201 maybeAccept_impl( node->base, *this ); 2202 2203 VISIT_END( node ); 2204 } 2205 2206 template< typename pass_type > 2207 Type * PassVisitor< pass_type >::mutate( PointerType * node ) { 2208 MUTATE_START( node ); 2209 2210 maybeMutate_impl( node->forall, *this ); 2211 // xxx - should PointerType visit/mutate dimension? 2212 maybeMutate_impl( node->base, *this ); 2213 2214 MUTATE_END( Type, node ); 2215 } 2216 2217 //-------------------------------------------------------------------------- 2218 // ArrayType 1867 VISIT_BODY( node ); 1868 } 1869 2219 1870 template< typename pass_type > 2220 1871 void PassVisitor< pass_type >::visit( ArrayType * node ) { 2221 VISIT_START( node ); 2222 2223 maybeAccept_impl( node->forall, *this ); 2224 maybeAccept_impl( node->dimension, *this ); 2225 maybeAccept_impl( node->base, *this ); 2226 2227 VISIT_END( node ); 2228 } 2229 2230 template< typename pass_type > 2231 Type * PassVisitor< pass_type >::mutate( ArrayType * node ) { 2232 MUTATE_START( node ); 2233 2234 maybeMutate_impl( node->forall, *this ); 2235 maybeMutate_impl( node->dimension, *this ); 2236 maybeMutate_impl( node->base, *this ); 2237 2238 MUTATE_END( Type, node ); 2239 } 2240 2241 //-------------------------------------------------------------------------- 2242 // ReferenceType 1872 VISIT_BODY( node ); 1873 } 1874 2243 1875 template< typename pass_type > 2244 1876 void PassVisitor< pass_type >::visit( ReferenceType * node ) { 2245 VISIT_START( node ); 2246 2247 maybeAccept_impl( node->forall, *this ); 2248 maybeAccept_impl( node->base, *this ); 2249 2250 VISIT_END( node ); 2251 } 2252 2253 template< typename pass_type > 2254 Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) { 2255 MUTATE_START( node ); 2256 2257 maybeMutate_impl( node->forall, *this ); 2258 maybeMutate_impl( node->base, *this ); 2259 2260 MUTATE_END( Type, node ); 2261 } 2262 2263 //-------------------------------------------------------------------------- 2264 // QualifiedType 2265 template< typename pass_type > 2266 void PassVisitor< pass_type >::visit( QualifiedType * node ) { 2267 VISIT_START( node ); 2268 2269 maybeAccept_impl( node->forall, *this ); 2270 maybeAccept_impl( node->parent, *this ); 2271 maybeAccept_impl( node->child, *this ); 2272 2273 VISIT_END( node ); 2274 } 2275 2276 template< typename pass_type > 2277 Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) { 2278 MUTATE_START( node ); 2279 2280 maybeMutate_impl( node->forall, *this ); 2281 maybeMutate_impl( node->parent, *this ); 2282 maybeMutate_impl( node->child, *this ); 2283 2284 MUTATE_END( Type, node ); 2285 } 2286 2287 //-------------------------------------------------------------------------- 2288 // FunctionType 1877 VISIT_BODY( node ); 1878 } 1879 2289 1880 template< typename pass_type > 2290 1881 void PassVisitor< pass_type >::visit( FunctionType * node ) { 2291 VISIT_START( node ); 2292 2293 maybeAccept_impl( node->forall, *this ); 2294 maybeAccept_impl( node->returnVals, *this ); 2295 maybeAccept_impl( node->parameters, *this ); 2296 2297 VISIT_END( node ); 2298 } 2299 2300 template< typename pass_type > 2301 Type * PassVisitor< pass_type >::mutate( FunctionType * node ) { 2302 MUTATE_START( node ); 2303 2304 maybeMutate_impl( node->forall, *this ); 2305 maybeMutate_impl( node->returnVals, *this ); 2306 maybeMutate_impl( node->parameters, *this ); 2307 2308 MUTATE_END( Type, node ); 1882 VISIT_BODY( node ); 2309 1883 } 2310 1884 … … 2377 1951 template< typename pass_type > 2378 1952 void PassVisitor< pass_type >::visit( EnumInstType * node ) { 2379 VISIT_START( node ); 2380 2381 maybeAccept_impl( node->forall, *this ); 2382 maybeAccept_impl( node->parameters, *this ); 2383 2384 VISIT_END( node ); 1953 VISIT_BODY( node ); 2385 1954 } 2386 1955 2387 1956 template< typename pass_type > 2388 1957 Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) { 2389 MUTATE_START( node ); 2390 2391 maybeMutate_impl( node->forall, *this ); 2392 maybeMutate_impl( node->parameters, *this ); 2393 2394 MUTATE_END( Type, node ); 1958 MUTATE_BODY( Type, node ); 2395 1959 } 2396 1960 … … 2421 1985 template< typename pass_type > 2422 1986 void PassVisitor< pass_type >::visit( TypeInstType * node ) { 2423 VISIT_START( node ); 2424 2425 maybeAccept_impl( node->forall , *this ); 2426 maybeAccept_impl( node->parameters, *this ); 2427 2428 VISIT_END( node ); 1987 VISIT_BODY( node ); 1988 } 1989 1990 template< typename pass_type > 1991 void PassVisitor< pass_type >::visit( TupleType * node ) { 1992 VISIT_BODY( node ); 1993 } 1994 1995 template< typename pass_type > 1996 void PassVisitor< pass_type >::visit( TypeofType * node ) { 1997 VISIT_BODY( node ); 1998 } 1999 2000 template< typename pass_type > 2001 void PassVisitor< pass_type >::visit( AttrType * node ) { 2002 VISIT_BODY( node ); 2003 } 2004 2005 template< typename pass_type > 2006 void PassVisitor< pass_type >::visit( VarArgsType * node ) { 2007 VISIT_BODY( node ); 2008 } 2009 2010 template< typename pass_type > 2011 void PassVisitor< pass_type >::visit( ZeroType * node ) { 2012 VISIT_BODY( node ); 2013 } 2014 2015 template< typename pass_type > 2016 void PassVisitor< pass_type >::visit( OneType * node ) { 2017 VISIT_BODY( node ); 2018 } 2019 2020 template< typename pass_type > 2021 void PassVisitor< pass_type >::visit( Designation * node ) { 2022 VISIT_START( node ); 2023 2024 maybeAccept_impl( node->get_designators(), *this ); 2025 2026 VISIT_END( node ); 2027 } 2028 2029 template< typename pass_type > 2030 Designation * PassVisitor< pass_type >::mutate( Designation * node ) { 2031 MUTATE_START( node ); 2032 2033 maybeMutate_impl( node->get_designators(), *this ); 2034 2035 MUTATE_END( Designation, node ); 2036 } 2037 2038 //-------------------------------------------------------------------------- 2039 // SingleInit 2040 template< typename pass_type > 2041 void PassVisitor< pass_type >::visit( SingleInit * node ) { 2042 VISIT_START( node ); 2043 2044 visitExpression( node->get_value() ); 2045 2046 VISIT_END( node ); 2047 } 2048 2049 template< typename pass_type > 2050 Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) { 2051 MUTATE_START( node ); 2052 2053 node->set_value( mutateExpression( node->get_value() ) ); 2054 2055 MUTATE_END( Initializer, node ); 2056 } 2057 2058 template< typename pass_type > 2059 void PassVisitor< pass_type >::visit( ListInit * node ) { 2060 VISIT_BODY( node ); 2061 } 2062 2063 template< typename pass_type > 2064 void PassVisitor< pass_type >::visit( ConstructorInit * node ) { 2065 VISIT_BODY( node ); 2066 } 2067 2068 template< typename pass_type > 2069 void PassVisitor< pass_type >::visit( Subrange * node ) { 2070 VISIT_BODY( node ); 2071 } 2072 2073 template< typename pass_type > 2074 void PassVisitor< pass_type >::visit( Constant * node ) { 2075 VISIT_BODY( node ); 2076 } 2077 2078 template< typename pass_type > 2079 void PassVisitor< pass_type >::visit( Attribute * node ) { 2080 VISIT_BODY( node ); 2081 } 2082 2083 //--------------------------------------------------------------------------------------------------------------- 2084 template< typename pass_type > 2085 Type * PassVisitor< pass_type >::mutate( VoidType * node ) { 2086 MUTATE_BODY( Type, node ); 2087 } 2088 2089 template< typename pass_type > 2090 Type * PassVisitor< pass_type >::mutate( BasicType * node ) { 2091 MUTATE_BODY( Type, node ); 2092 } 2093 2094 template< typename pass_type > 2095 Type * PassVisitor< pass_type >::mutate( PointerType * node ) { 2096 MUTATE_BODY( Type, node ); 2097 } 2098 2099 template< typename pass_type > 2100 Type * PassVisitor< pass_type >::mutate( ArrayType * node ) { 2101 MUTATE_BODY( Type, node ); 2102 } 2103 2104 template< typename pass_type > 2105 Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) { 2106 MUTATE_BODY( Type, node ); 2107 } 2108 2109 template< typename pass_type > 2110 Type * PassVisitor< pass_type >::mutate( FunctionType * node ) { 2111 MUTATE_BODY( Type, node ); 2429 2112 } 2430 2113 2431 2114 template< typename pass_type > 2432 2115 Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) { 2433 MUTATE_START( node ); 2434 2435 maybeMutate_impl( node->forall , *this ); 2436 maybeMutate_impl( node->parameters, *this ); 2437 2438 MUTATE_END( Type, node ); 2439 } 2440 2441 //-------------------------------------------------------------------------- 2442 // TupleType 2443 template< typename pass_type > 2444 void PassVisitor< pass_type >::visit( TupleType * node ) { 2445 VISIT_START( node ); 2446 2447 maybeAccept_impl( node->forall, *this ); 2448 maybeAccept_impl( node->types, *this ); 2449 maybeAccept_impl( node->members, *this ); 2450 2451 VISIT_END( node ); 2116 MUTATE_BODY( Type, node ); 2452 2117 } 2453 2118 2454 2119 template< typename pass_type > 2455 2120 Type * PassVisitor< pass_type >::mutate( TupleType * node ) { 2456 MUTATE_START( node ); 2457 2458 maybeMutate_impl( node->forall, *this ); 2459 maybeMutate_impl( node->types, *this ); 2460 maybeMutate_impl( node->members, *this ); 2461 2462 MUTATE_END( Type, node ); 2463 } 2464 2465 //-------------------------------------------------------------------------- 2466 // TypeofType 2467 template< typename pass_type > 2468 void PassVisitor< pass_type >::visit( TypeofType * node ) { 2469 VISIT_START( node ); 2470 2471 assert( node->expr ); 2472 maybeAccept_impl( node->expr, *this ); 2473 2474 VISIT_END( node ); 2121 MUTATE_BODY( Type, node ); 2475 2122 } 2476 2123 2477 2124 template< typename pass_type > 2478 2125 Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { 2479 MUTATE_START( node ); 2480 2481 assert( node->expr ); 2482 maybeMutate_impl( node->expr, *this ); 2483 2484 MUTATE_END( Type, node ); 2485 } 2486 2487 //-------------------------------------------------------------------------- 2488 // AttrType 2489 template< typename pass_type > 2490 void PassVisitor< pass_type >::visit( AttrType * node ) { 2491 VISIT_START( node ); 2492 2493 if ( node->isType ) { 2494 assert( node->type ); 2495 maybeAccept_impl( node->type, *this ); 2496 } else { 2497 assert( node->expr ); 2498 maybeAccept_impl( node->expr, *this ); 2499 } // if 2500 2501 VISIT_END( node ); 2126 MUTATE_BODY( Type, node ); 2502 2127 } 2503 2128 2504 2129 template< typename pass_type > 2505 2130 Type * PassVisitor< pass_type >::mutate( AttrType * node ) { 2506 MUTATE_START( node ); 2507 2508 if ( node->isType ) { 2509 assert( node->type ); 2510 maybeMutate_impl( node->type, *this ); 2511 } else { 2512 assert( node->expr ); 2513 maybeMutate_impl( node->expr, *this ); 2514 } // if 2515 2516 MUTATE_END( Type, node ); 2517 } 2518 2519 //-------------------------------------------------------------------------- 2520 // VarArgsType 2521 template< typename pass_type > 2522 void PassVisitor< pass_type >::visit( VarArgsType * node ) { 2523 VISIT_START( node ); 2524 2525 maybeAccept_impl( node->forall, *this ); 2526 2527 VISIT_END( node ); 2131 MUTATE_BODY( Type, node ); 2528 2132 } 2529 2133 2530 2134 template< typename pass_type > 2531 2135 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { 2532 MUTATE_START( node ); 2533 2534 maybeMutate_impl( node->forall, *this ); 2535 2536 MUTATE_END( Type, node ); 2537 } 2538 2539 //-------------------------------------------------------------------------- 2540 // ZeroType 2541 template< typename pass_type > 2542 void PassVisitor< pass_type >::visit( ZeroType * node ) { 2543 VISIT_START( node ); 2544 2545 maybeAccept_impl( node->forall, *this ); 2546 2547 VISIT_END( node ); 2136 MUTATE_BODY( Type, node ); 2548 2137 } 2549 2138 2550 2139 template< typename pass_type > 2551 2140 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { 2552 MUTATE_START( node ); 2553 2554 maybeMutate_impl( node->forall, *this ); 2555 2556 MUTATE_END( Type, node ); 2557 } 2558 2559 //-------------------------------------------------------------------------- 2560 // OneType 2561 template< typename pass_type > 2562 void PassVisitor< pass_type >::visit( OneType * node ) { 2563 VISIT_START( node ); 2564 2565 maybeAccept_impl( node->forall, *this ); 2566 2567 VISIT_END( node ); 2141 MUTATE_BODY( Type, node ); 2568 2142 } 2569 2143 2570 2144 template< typename pass_type > 2571 2145 Type * PassVisitor< pass_type >::mutate( OneType * node ) { 2572 MUTATE_START( node ); 2573 2574 maybeMutate_impl( node->forall, *this ); 2575 2576 MUTATE_END( Type, node ); 2577 } 2578 2579 //-------------------------------------------------------------------------- 2580 // GlobalScopeType 2581 template< typename pass_type > 2582 void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { 2583 VISIT_START( node ); 2584 2585 maybeAccept_impl( node->forall, *this ); 2586 2587 VISIT_END( node ); 2588 } 2589 2590 template< typename pass_type > 2591 Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { 2592 MUTATE_START( node ); 2593 2594 maybeMutate_impl( node->forall, *this ); 2595 2596 MUTATE_END( Type, node ); 2597 } 2598 2599 //-------------------------------------------------------------------------- 2600 // Designation 2601 template< typename pass_type > 2602 void PassVisitor< pass_type >::visit( Designation * node ) { 2603 VISIT_START( node ); 2604 2605 maybeAccept_impl( node->designators, *this ); 2606 2607 VISIT_END( node ); 2608 } 2609 2610 template< typename pass_type > 2611 Designation * PassVisitor< pass_type >::mutate( Designation * node ) { 2612 MUTATE_START( node ); 2613 2614 maybeMutate_impl( node->designators, *this ); 2615 2616 MUTATE_END( Designation, node ); 2617 } 2618 2619 //-------------------------------------------------------------------------- 2620 // SingleInit 2621 template< typename pass_type > 2622 void PassVisitor< pass_type >::visit( SingleInit * node ) { 2623 VISIT_START( node ); 2624 2625 visitExpression( node->value ); 2626 2627 VISIT_END( node ); 2628 } 2629 2630 template< typename pass_type > 2631 Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) { 2632 MUTATE_START( node ); 2633 2634 node->value = mutateExpression( node->value ); 2635 2636 MUTATE_END( Initializer, node ); 2637 } 2638 2639 //-------------------------------------------------------------------------- 2640 // ListInit 2641 template< typename pass_type > 2642 void PassVisitor< pass_type >::visit( ListInit * node ) { 2643 VISIT_START( node ); 2644 2645 maybeAccept_impl( node->designations, *this ); 2646 maybeAccept_impl( node->initializers, *this ); 2647 2648 VISIT_END( node ); 2146 MUTATE_BODY( Type, node ); 2649 2147 } 2650 2148 2651 2149 template< typename pass_type > 2652 2150 Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { 2653 MUTATE_START( node ); 2654 2655 maybeMutate_impl( node->designations, *this ); 2656 maybeMutate_impl( node->initializers, *this ); 2657 2658 MUTATE_END( Initializer, node ); 2659 } 2660 2661 //-------------------------------------------------------------------------- 2662 // ConstructorInit 2663 template< typename pass_type > 2664 void PassVisitor< pass_type >::visit( ConstructorInit * node ) { 2665 VISIT_START( node ); 2666 2667 maybeAccept_impl( node->ctor, *this ); 2668 maybeAccept_impl( node->dtor, *this ); 2669 maybeAccept_impl( node->init, *this ); 2670 2671 VISIT_END( node ); 2151 MUTATE_BODY( Initializer, node ); 2672 2152 } 2673 2153 2674 2154 template< typename pass_type > 2675 2155 Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { 2676 MUTATE_START( node ); 2677 2678 maybeMutate_impl( node->ctor, *this ); 2679 maybeMutate_impl( node->dtor, *this ); 2680 maybeMutate_impl( node->init, *this ); 2681 2682 MUTATE_END( Initializer, node ); 2683 } 2684 2685 //-------------------------------------------------------------------------- 2686 // Subrange 2687 template< typename pass_type > 2688 void PassVisitor< pass_type >::visit( Subrange * node ) { 2689 VISIT_START( node ); 2690 2691 VISIT_END( node ); 2156 MUTATE_BODY( Initializer, node ); 2692 2157 } 2693 2158 2694 2159 template< typename pass_type > 2695 2160 Subrange * PassVisitor< pass_type >::mutate( Subrange * node ) { 2696 MUTATE_START( node ); 2697 2698 MUTATE_END( Subrange, node ); 2699 } 2700 2701 //-------------------------------------------------------------------------- 2702 // Attribute 2703 template< typename pass_type > 2704 void PassVisitor< pass_type >::visit( Constant * node ) { 2705 VISIT_START( node ); 2706 2707 VISIT_END( node ); 2161 MUTATE_BODY( Subrange, node ); 2708 2162 } 2709 2163 2710 2164 template< typename pass_type > 2711 2165 Constant * PassVisitor< pass_type >::mutate( Constant * node ) { 2712 MUTATE_START( node ); 2713 2714 MUTATE_END( Constant, node ); 2715 } 2716 2717 //-------------------------------------------------------------------------- 2718 // Attribute 2719 template< typename pass_type > 2720 void PassVisitor< pass_type >::visit( Attribute * node ) { 2721 VISIT_START( node ); 2722 2723 maybeAccept_impl( node->parameters, *this ); 2724 2725 VISIT_END( node ); 2166 MUTATE_BODY( Constant, node ); 2726 2167 } 2727 2168 2728 2169 template< typename pass_type > 2729 2170 Attribute * PassVisitor< pass_type >::mutate( Attribute * node ) { 2730 MUTATE_START( node ); 2731 2732 maybeMutate_impl( node->parameters, *this ); 2733 2734 MUTATE_END( Attribute, node ); 2735 } 2736 2737 //-------------------------------------------------------------------------- 2738 // TypeSubstitution 2171 MUTATE_BODY( Attribute, node ); 2172 } 2173 2739 2174 template< typename pass_type > 2740 2175 TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
Note:
See TracChangeset
for help on using the changeset viewer.