[13932f14] | 1 | #pragma once |
---|
[3268a58] | 2 | // IWYU pragma: private, include "PassVisitor.h" |
---|
[13932f14] | 3 | |
---|
[3c398b6] | 4 | #define VISIT_START( node ) \ |
---|
| 5 | __attribute__((unused)) \ |
---|
| 6 | ChildrenGuard children_guard( get_visit_children_ptr() ); \ |
---|
| 7 | __attribute__((unused)) \ |
---|
[62423350] | 8 | guard_value_impl guard( at_cleanup_impl(pass, 0) ); \ |
---|
[3c398b6] | 9 | call_previsit( node ); \ |
---|
[6e09f211] | 10 | |
---|
| 11 | #define VISIT_END( node ) \ |
---|
| 12 | call_postvisit( node ); \ |
---|
[9c1600c] | 13 | |
---|
[3c398b6] | 14 | #define MUTATE_START( node ) \ |
---|
| 15 | __attribute__((unused)) \ |
---|
| 16 | ChildrenGuard children_guard( get_visit_children_ptr() ); \ |
---|
| 17 | __attribute__((unused)) \ |
---|
[62423350] | 18 | guard_value_impl guard( at_cleanup_impl(pass, 0) ); \ |
---|
[3c398b6] | 19 | call_premutate( node ); \ |
---|
[296b2be] | 20 | |
---|
| 21 | #define MUTATE_END( type, node ) \ |
---|
[6a625de] | 22 | auto __return = call_postmutate< type * >( node ); \ |
---|
| 23 | assert( __return ); \ |
---|
| 24 | return __return; |
---|
[296b2be] | 25 | |
---|
| 26 | |
---|
[134322e] | 27 | template<typename T> |
---|
| 28 | static inline bool empty( T * ptr ) { |
---|
| 29 | return !ptr || ptr->empty(); |
---|
| 30 | } |
---|
| 31 | |
---|
[6ca154b] | 32 | typedef std::list< Statement * > StmtList_t; |
---|
| 33 | typedef std::list< Declaration * > DeclList_t; |
---|
| 34 | |
---|
| 35 | template<typename iterator_t> |
---|
| 36 | static inline void splice( iterator_t it, DeclList_t * decls ) { |
---|
| 37 | std::transform( |
---|
| 38 | decls->begin(), |
---|
| 39 | decls->end(), |
---|
| 40 | it, |
---|
| 41 | [](Declaration * decl) -> auto { |
---|
[ba3706f] | 42 | return new DeclStmt( decl ); |
---|
[6ca154b] | 43 | } |
---|
| 44 | ); |
---|
| 45 | decls->clear(); |
---|
| 46 | } |
---|
[134322e] | 47 | |
---|
| 48 | template< typename pass_type > |
---|
[07c178f0] | 49 | inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) { |
---|
[6ca154b] | 50 | DeclList_t* beforeDecls = visitor.get_beforeDecls(); |
---|
| 51 | DeclList_t* afterDecls = visitor.get_afterDecls(); |
---|
[a16764a6] | 52 | SemanticErrorException errors; |
---|
[134322e] | 53 | |
---|
[675716e] | 54 | pass_visitor_stats.depth++; |
---|
| 55 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 56 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
[6ca154b] | 57 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { |
---|
[675716e] | 58 | |
---|
| 59 | |
---|
[6ca154b] | 60 | // splice in new declarations after previous decl |
---|
[d24d4e1] | 61 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } |
---|
[6ca154b] | 62 | |
---|
| 63 | if ( i == decls.end() ) break; |
---|
| 64 | |
---|
[522363e] | 65 | try { |
---|
| 66 | // run visitor on declaration |
---|
[3c398b6] | 67 | maybeAccept_impl( *i, visitor ); |
---|
[a16764a6] | 68 | } catch( SemanticErrorException &e ) { |
---|
[522363e] | 69 | errors.append( e ); |
---|
| 70 | } |
---|
[6ca154b] | 71 | |
---|
| 72 | // splice in new declarations before current decl |
---|
| 73 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } |
---|
[134322e] | 74 | } |
---|
[675716e] | 75 | pass_visitor_stats.depth--; |
---|
[522363e] | 76 | if ( ! errors.isEmpty() ) { |
---|
| 77 | throw errors; |
---|
| 78 | } |
---|
[6ca154b] | 79 | } |
---|
[134322e] | 80 | |
---|
[7870799] | 81 | template< typename pass_type > |
---|
| 82 | inline void acceptAll( const std::list< const Declaration * > & decls, PassVisitor< pass_type >& visitor ) { |
---|
| 83 | SemanticErrorException errors; |
---|
| 84 | |
---|
| 85 | pass_visitor_stats.depth++; |
---|
| 86 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 87 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
| 88 | for ( const Declaration * decl : decls ) { |
---|
| 89 | try { |
---|
| 90 | // run visitor on declaration |
---|
| 91 | maybeAccept_impl( decl, visitor ); |
---|
| 92 | } |
---|
| 93 | catch( SemanticErrorException &e ) { |
---|
| 94 | errors.append( e ); |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | pass_visitor_stats.depth--; |
---|
| 98 | if ( ! errors.isEmpty() ) { |
---|
| 99 | throw errors; |
---|
| 100 | } |
---|
| 101 | } |
---|
| 102 | |
---|
[6ca154b] | 103 | template< typename pass_type > |
---|
[07c178f0] | 104 | inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) { |
---|
[6ca154b] | 105 | DeclList_t* beforeDecls = mutator.get_beforeDecls(); |
---|
| 106 | DeclList_t* afterDecls = mutator.get_afterDecls(); |
---|
[a16764a6] | 107 | SemanticErrorException errors; |
---|
[6ca154b] | 108 | |
---|
[675716e] | 109 | pass_visitor_stats.depth++; |
---|
| 110 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 111 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
[6ca154b] | 112 | for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { |
---|
| 113 | // splice in new declarations after previous decl |
---|
[d24d4e1] | 114 | if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } |
---|
[6ca154b] | 115 | |
---|
| 116 | if ( i == decls.end() ) break; |
---|
[522363e] | 117 | try { |
---|
| 118 | // run mutator on declaration |
---|
[3c398b6] | 119 | maybeMutate_impl( *i, mutator ); |
---|
[a16764a6] | 120 | } catch( SemanticErrorException &e ) { |
---|
[522363e] | 121 | errors.append( e ); |
---|
| 122 | } |
---|
[6ca154b] | 123 | |
---|
| 124 | // splice in new declarations before current decl |
---|
| 125 | if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } |
---|
| 126 | } |
---|
[675716e] | 127 | pass_visitor_stats.depth--; |
---|
[522363e] | 128 | if ( ! errors.isEmpty() ) { |
---|
| 129 | throw errors; |
---|
| 130 | } |
---|
[134322e] | 131 | } |
---|
| 132 | |
---|
[3c398b6] | 133 | template< typename TreeType, typename pass_type > |
---|
| 134 | inline void maybeAccept_impl( TreeType * tree, PassVisitor< pass_type > & visitor ) { |
---|
| 135 | if ( ! visitor.get_visit_children() ) return; |
---|
| 136 | if ( tree ) { |
---|
| 137 | tree->accept( visitor ); |
---|
| 138 | } |
---|
| 139 | } |
---|
| 140 | |
---|
[7870799] | 141 | template< typename TreeType, typename pass_type > |
---|
| 142 | inline void maybeAccept_impl( const TreeType * tree, PassVisitor< pass_type > & visitor ) { |
---|
| 143 | if ( ! visitor.get_visit_children() ) return; |
---|
| 144 | if ( tree ) { |
---|
| 145 | tree->accept( visitor ); |
---|
| 146 | } |
---|
| 147 | } |
---|
| 148 | |
---|
[3c398b6] | 149 | template< typename Container, typename pass_type > |
---|
| 150 | inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) { |
---|
| 151 | if ( ! visitor.get_visit_children() ) return; |
---|
[a16764a6] | 152 | SemanticErrorException errors; |
---|
[675716e] | 153 | |
---|
| 154 | pass_visitor_stats.depth++; |
---|
| 155 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 156 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
[e0886db] | 157 | for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { |
---|
| 158 | try { |
---|
| 159 | if ( *i ) { |
---|
| 160 | (*i)->accept( visitor ); |
---|
| 161 | } |
---|
[a16764a6] | 162 | } catch( SemanticErrorException &e ) { |
---|
[e0886db] | 163 | errors.append( e ); |
---|
| 164 | } |
---|
| 165 | } |
---|
[675716e] | 166 | pass_visitor_stats.depth--; |
---|
[e0886db] | 167 | if ( ! errors.isEmpty() ) { |
---|
| 168 | throw errors; |
---|
| 169 | } |
---|
| 170 | } |
---|
| 171 | |
---|
[7870799] | 172 | template< typename Container, typename pass_type > |
---|
| 173 | inline void maybeAccept_impl( const Container & container, PassVisitor< pass_type > & visitor ) { |
---|
| 174 | if ( ! visitor.get_visit_children() ) return; |
---|
| 175 | SemanticErrorException errors; |
---|
| 176 | |
---|
| 177 | pass_visitor_stats.depth++; |
---|
| 178 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 179 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
| 180 | for ( const auto & i : container ) { |
---|
| 181 | try { |
---|
| 182 | if ( i ) { |
---|
| 183 | i->accept( visitor ); |
---|
| 184 | } |
---|
| 185 | } catch( SemanticErrorException &e ) { |
---|
| 186 | errors.append( e ); |
---|
| 187 | } |
---|
| 188 | } |
---|
| 189 | pass_visitor_stats.depth--; |
---|
| 190 | if ( ! errors.isEmpty() ) { |
---|
| 191 | throw errors; |
---|
| 192 | } |
---|
| 193 | } |
---|
| 194 | |
---|
[3c398b6] | 195 | template< typename TreeType, typename pass_type > |
---|
| 196 | inline void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_type > & mutator ) { |
---|
| 197 | if ( ! mutator.get_visit_children() ) return; |
---|
| 198 | |
---|
| 199 | if ( tree ) { |
---|
| 200 | tree = strict_dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) ); |
---|
| 201 | } |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | template< typename Container, typename pass_type > |
---|
| 205 | inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) { |
---|
[37e3af4] | 206 | |
---|
[3c398b6] | 207 | if ( ! mutator.get_visit_children() ) return; |
---|
[a16764a6] | 208 | SemanticErrorException errors; |
---|
[675716e] | 209 | |
---|
| 210 | pass_visitor_stats.depth++; |
---|
| 211 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 212 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
[e0886db] | 213 | for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { |
---|
| 214 | try { |
---|
| 215 | if ( *i ) { |
---|
| 216 | *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) ); |
---|
| 217 | assert( *i ); |
---|
| 218 | } // if |
---|
[a16764a6] | 219 | } catch( SemanticErrorException &e ) { |
---|
[e0886db] | 220 | errors.append( e ); |
---|
| 221 | } // try |
---|
| 222 | } // for |
---|
[675716e] | 223 | pass_visitor_stats.depth--; |
---|
[e0886db] | 224 | if ( ! errors.isEmpty() ) { |
---|
| 225 | throw errors; |
---|
| 226 | } // if |
---|
| 227 | } |
---|
| 228 | |
---|
[296b2be] | 229 | template< typename pass_type > |
---|
[6ca154b] | 230 | template< typename func_t > |
---|
| 231 | void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) { |
---|
[3c398b6] | 232 | if ( ! get_visit_children() ) return; |
---|
[a16764a6] | 233 | SemanticErrorException errors; |
---|
[296b2be] | 234 | |
---|
[2a7b3ca] | 235 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt |
---|
| 236 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() ); |
---|
| 237 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () ); |
---|
| 238 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); |
---|
| 239 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); |
---|
| 240 | |
---|
[134322e] | 241 | StmtList_t* beforeStmts = get_beforeStmts(); |
---|
| 242 | StmtList_t* afterStmts = get_afterStmts(); |
---|
[6ca154b] | 243 | DeclList_t* beforeDecls = get_beforeDecls(); |
---|
| 244 | DeclList_t* afterDecls = get_afterDecls(); |
---|
[134322e] | 245 | |
---|
[675716e] | 246 | pass_visitor_stats.depth++; |
---|
| 247 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 248 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
[296b2be] | 249 | for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) { |
---|
[6ca154b] | 250 | |
---|
| 251 | if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); } |
---|
[134322e] | 252 | if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); } |
---|
[6ca154b] | 253 | |
---|
[296b2be] | 254 | try { |
---|
[6ca154b] | 255 | func( *i ); |
---|
[37e3af4] | 256 | assert( *i ); |
---|
[6ca154b] | 257 | assert(( empty( beforeStmts ) && empty( afterStmts )) |
---|
| 258 | || ( empty( beforeDecls ) && empty( afterDecls )) ); |
---|
| 259 | |
---|
[a16764a6] | 260 | } catch ( SemanticErrorException &e ) { |
---|
[296b2be] | 261 | errors.append( e ); |
---|
[134322e] | 262 | } |
---|
[6ca154b] | 263 | |
---|
| 264 | if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); } |
---|
[134322e] | 265 | if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); } |
---|
[296b2be] | 266 | } |
---|
[675716e] | 267 | pass_visitor_stats.depth--; |
---|
[134322e] | 268 | |
---|
[6ca154b] | 269 | if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); } |
---|
[134322e] | 270 | if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); } |
---|
| 271 | if ( !errors.isEmpty() ) { throw errors; } |
---|
[296b2be] | 272 | } |
---|
| 273 | |
---|
| 274 | template< typename pass_type > |
---|
[6ca154b] | 275 | void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) { |
---|
| 276 | handleStatementList( statements, [this]( Statement * stmt) { |
---|
[3c398b6] | 277 | maybeAccept_impl( stmt, *this ); |
---|
[6ca154b] | 278 | }); |
---|
| 279 | } |
---|
[134322e] | 280 | |
---|
[7870799] | 281 | template< typename pass_type > |
---|
| 282 | void PassVisitor< pass_type >::visitStatementList( const std::list< Statement * > & statements ) { |
---|
| 283 | if ( ! get_visit_children() ) return; |
---|
| 284 | SemanticErrorException errors; |
---|
| 285 | |
---|
| 286 | pass_visitor_stats.depth++; |
---|
| 287 | pass_visitor_stats.max->push(pass_visitor_stats.depth); |
---|
| 288 | pass_visitor_stats.avg->push(pass_visitor_stats.depth); |
---|
| 289 | for ( const Statement * i : statements ) { |
---|
| 290 | try { |
---|
| 291 | maybeAccept_impl( i, *this ); |
---|
| 292 | } catch ( SemanticErrorException &e ) { |
---|
| 293 | errors.append( e ); |
---|
| 294 | } |
---|
| 295 | } |
---|
| 296 | pass_visitor_stats.depth--; |
---|
| 297 | if ( !errors.isEmpty() ) { throw errors; } |
---|
| 298 | } |
---|
| 299 | |
---|
[6ca154b] | 300 | template< typename pass_type > |
---|
| 301 | void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) { |
---|
| 302 | handleStatementList( statements, [this]( Statement *& stmt) { |
---|
[3c398b6] | 303 | maybeMutate_impl( stmt, *this ); |
---|
[6ca154b] | 304 | }); |
---|
[134322e] | 305 | } |
---|
| 306 | |
---|
[6ca154b] | 307 | |
---|
[134322e] | 308 | template< typename pass_type > |
---|
[6ca154b] | 309 | template< typename func_t > |
---|
| 310 | Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) { |
---|
[3c398b6] | 311 | if ( ! get_visit_children() ) return stmt; |
---|
| 312 | |
---|
[134322e] | 313 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt |
---|
[02fdb8e] | 314 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
[6ca154b] | 315 | ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); |
---|
| 316 | ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); |
---|
| 317 | ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() ); |
---|
| 318 | ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () ); |
---|
[296b2be] | 319 | |
---|
[6ca154b] | 320 | Statement *newStmt = func( stmt ); |
---|
[134322e] | 321 | |
---|
| 322 | StmtList_t* beforeStmts = get_beforeStmts(); |
---|
| 323 | StmtList_t* afterStmts = get_afterStmts(); |
---|
[6ca154b] | 324 | DeclList_t* beforeDecls = get_beforeDecls(); |
---|
| 325 | DeclList_t* afterDecls = get_afterDecls(); |
---|
[134322e] | 326 | |
---|
[6ca154b] | 327 | if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; } |
---|
| 328 | assert(( empty( beforeStmts ) && empty( afterStmts )) |
---|
| 329 | || ( empty( beforeDecls ) && empty( afterDecls )) ); |
---|
[134322e] | 330 | |
---|
[ba3706f] | 331 | CompoundStmt *compound = new CompoundStmt(); |
---|
[6ca154b] | 332 | if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); } |
---|
[134322e] | 333 | if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); } |
---|
| 334 | compound->get_kids().push_back( newStmt ); |
---|
[6ca154b] | 335 | if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); } |
---|
[134322e] | 336 | if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); } |
---|
| 337 | return compound; |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | template< typename pass_type > |
---|
[6ca154b] | 341 | Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) { |
---|
| 342 | return handleStatement( stmt, [this]( Statement * stmt ) { |
---|
[3c398b6] | 343 | maybeAccept_impl( stmt, *this ); |
---|
[6ca154b] | 344 | return stmt; |
---|
| 345 | }); |
---|
| 346 | } |
---|
[134322e] | 347 | |
---|
[7870799] | 348 | template< typename pass_type > |
---|
| 349 | void PassVisitor< pass_type >::visitStatement( const Statement * stmt ) { |
---|
| 350 | if ( ! get_visit_children() ) return; |
---|
| 351 | |
---|
| 352 | // don't want statements from outer CompoundStmts to be added to this CompoundStmt |
---|
| 353 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
| 354 | |
---|
| 355 | maybeAccept_impl( stmt, *this ); |
---|
| 356 | } |
---|
| 357 | |
---|
[6ca154b] | 358 | template< typename pass_type > |
---|
| 359 | Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) { |
---|
| 360 | return handleStatement( stmt, [this]( Statement * stmt ) { |
---|
[3c398b6] | 361 | maybeMutate_impl( stmt, *this ); |
---|
| 362 | return stmt; |
---|
[6ca154b] | 363 | }); |
---|
[296b2be] | 364 | } |
---|
| 365 | |
---|
| 366 | template< typename pass_type > |
---|
[6ca154b] | 367 | template< typename func_t > |
---|
| 368 | Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) { |
---|
[3c398b6] | 369 | if ( ! get_visit_children() ) return expr; |
---|
[296b2be] | 370 | if( !expr ) return nullptr; |
---|
| 371 | |
---|
[134322e] | 372 | auto env_ptr = get_env_ptr(); |
---|
| 373 | if ( env_ptr && expr->get_env() ) { |
---|
| 374 | *env_ptr = expr->get_env(); |
---|
[296b2be] | 375 | } |
---|
[6ca154b] | 376 | |
---|
[3c398b6] | 377 | // should env be moved onto the result of the mutate? |
---|
[6ca154b] | 378 | return func( expr ); |
---|
| 379 | } |
---|
| 380 | |
---|
| 381 | template< typename pass_type > |
---|
| 382 | Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) { |
---|
| 383 | return handleExpression(expr, [this]( Expression * expr ) { |
---|
[3c398b6] | 384 | maybeAccept_impl( expr, *this ); |
---|
[6ca154b] | 385 | return expr; |
---|
[d24d4e1] | 386 | }); |
---|
[296b2be] | 387 | } |
---|
[ab904dc] | 388 | |
---|
[7870799] | 389 | template< typename pass_type > |
---|
| 390 | void PassVisitor< pass_type >::visitExpression( const Expression * expr ) { |
---|
| 391 | if ( ! get_visit_children() ) return; |
---|
| 392 | if( !expr ) return; |
---|
| 393 | |
---|
| 394 | auto env_ptr = get_env_ptr(); |
---|
| 395 | if ( env_ptr && expr->get_env() ) { |
---|
| 396 | *env_ptr = expr->get_env(); |
---|
| 397 | } |
---|
| 398 | |
---|
| 399 | maybeAccept_impl( expr, *this ); |
---|
| 400 | } |
---|
| 401 | |
---|
[6ca154b] | 402 | template< typename pass_type > |
---|
| 403 | Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) { |
---|
| 404 | return handleExpression(expr, [this]( Expression * expr ) { |
---|
[3c398b6] | 405 | maybeMutate_impl( expr, *this ); |
---|
| 406 | return expr; |
---|
[6ca154b] | 407 | }); |
---|
| 408 | } |
---|
[ab904dc] | 409 | |
---|
[3c398b6] | 410 | template< typename TreeType, typename VisitorType > |
---|
| 411 | inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) { |
---|
| 412 | if ( ! visitor.get_visit_children() ) return; |
---|
| 413 | auto guard = makeFuncGuard( |
---|
| 414 | [&visitor]() { visitor.indexerScopeEnter(); }, |
---|
| 415 | [&visitor]() { visitor.indexerScopeLeave(); } |
---|
| 416 | ); |
---|
| 417 | maybeAccept_impl( tree, visitor ); |
---|
| 418 | } |
---|
| 419 | |
---|
[7870799] | 420 | template< typename TreeType, typename VisitorType > |
---|
| 421 | inline void indexerScopedAccept( const TreeType * tree, VisitorType & visitor ) { |
---|
| 422 | if ( ! visitor.get_visit_children() ) return; |
---|
| 423 | auto guard = makeFuncGuard( |
---|
| 424 | [&visitor]() { visitor.indexerScopeEnter(); }, |
---|
| 425 | [&visitor]() { visitor.indexerScopeLeave(); } |
---|
| 426 | ); |
---|
| 427 | maybeAccept_impl( tree, visitor ); |
---|
| 428 | } |
---|
| 429 | |
---|
[3c398b6] | 430 | template< typename TreeType, typename MutatorType > |
---|
| 431 | inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) { |
---|
| 432 | if ( ! mutator.get_visit_children() ) return; |
---|
| 433 | auto guard = makeFuncGuard( |
---|
| 434 | [&mutator]() { mutator.indexerScopeEnter(); }, |
---|
| 435 | [&mutator]() { mutator.indexerScopeLeave(); } |
---|
| 436 | ); |
---|
| 437 | maybeMutate_impl( tree, mutator ); |
---|
| 438 | } |
---|
| 439 | |
---|
[296b2be] | 440 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
---|
[e0886db] | 441 | //======================================================================================================================================================================== |
---|
| 442 | //======================================================================================================================================================================== |
---|
| 443 | //======================================================================================================================================================================== |
---|
| 444 | //======================================================================================================================================================================== |
---|
| 445 | //======================================================================================================================================================================== |
---|
| 446 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
---|
[13932f14] | 447 | |
---|
[33a25f9] | 448 | // A NOTE ON THE ORDER OF TRAVERSAL |
---|
| 449 | // |
---|
| 450 | // Types and typedefs have their base types visited before they are added to the type table. This is ok, since there is |
---|
| 451 | // no such thing as a recursive type or typedef. |
---|
| 452 | // |
---|
| 453 | // typedef struct { T *x; } T; // never allowed |
---|
| 454 | // |
---|
| 455 | // for structs/unions, it is possible to have recursion, so the decl should be added as if it's incomplete to begin, the |
---|
| 456 | // members are traversed, and then the complete type should be added (assuming the type is completed by this particular |
---|
| 457 | // declaration). |
---|
| 458 | // |
---|
| 459 | // struct T { struct T *x; }; // allowed |
---|
| 460 | // |
---|
| 461 | // It is important to add the complete type to the symbol table *after* the members/base has been traversed, since that |
---|
| 462 | // traversal may modify the definition of the type and these modifications should be visible when the symbol table is |
---|
| 463 | // queried later in this pass. |
---|
| 464 | // |
---|
| 465 | // TODO: figure out whether recursive contexts are sensible/possible/reasonable. |
---|
[e0886db] | 466 | |
---|
| 467 | //-------------------------------------------------------------------------- |
---|
| 468 | // ObjectDecl |
---|
[13932f14] | 469 | template< typename pass_type > |
---|
[ab904dc] | 470 | void PassVisitor< pass_type >::visit( ObjectDecl * node ) { |
---|
[e0886db] | 471 | VISIT_START( node ); |
---|
| 472 | |
---|
| 473 | indexerScopedAccept( node->type , *this ); |
---|
[3c398b6] | 474 | maybeAccept_impl ( node->init , *this ); |
---|
| 475 | maybeAccept_impl ( node->bitfieldWidth, *this ); |
---|
| 476 | maybeAccept_impl ( node->attributes , *this ); |
---|
[e0886db] | 477 | |
---|
[2cb70aa] | 478 | indexerAddId( node ); |
---|
[e0886db] | 479 | |
---|
| 480 | VISIT_END( node ); |
---|
| 481 | } |
---|
| 482 | |
---|
[7870799] | 483 | template< typename pass_type > |
---|
| 484 | void PassVisitor< pass_type >::visit( const ObjectDecl * node ) { |
---|
| 485 | VISIT_START( node ); |
---|
| 486 | |
---|
| 487 | maybeAccept_impl( node->type , *this ); |
---|
| 488 | maybeAccept_impl( node->init , *this ); |
---|
| 489 | maybeAccept_impl( node->bitfieldWidth, *this ); |
---|
| 490 | maybeAccept_impl( node->attributes , *this ); |
---|
| 491 | |
---|
| 492 | VISIT_END( node ); |
---|
| 493 | } |
---|
| 494 | |
---|
[e0886db] | 495 | template< typename pass_type > |
---|
| 496 | DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) { |
---|
| 497 | MUTATE_START( node ); |
---|
| 498 | |
---|
| 499 | indexerScopedMutate( node->type , *this ); |
---|
[3c398b6] | 500 | maybeMutate_impl ( node->init , *this ); |
---|
| 501 | maybeMutate_impl ( node->bitfieldWidth, *this ); |
---|
| 502 | maybeMutate_impl ( node->attributes , *this ); |
---|
[e0886db] | 503 | |
---|
[2cb70aa] | 504 | indexerAddId( node ); |
---|
[e0886db] | 505 | |
---|
| 506 | MUTATE_END( DeclarationWithType, node ); |
---|
[13932f14] | 507 | } |
---|
| 508 | |
---|
[e0886db] | 509 | //-------------------------------------------------------------------------- |
---|
| 510 | // FunctionDecl |
---|
[13932f14] | 511 | template< typename pass_type > |
---|
[ab904dc] | 512 | void PassVisitor< pass_type >::visit( FunctionDecl * node ) { |
---|
[e0886db] | 513 | VISIT_START( node ); |
---|
| 514 | |
---|
[2cb70aa] | 515 | indexerAddId( node ); |
---|
[e0886db] | 516 | |
---|
[7aaec67] | 517 | maybeAccept_impl( node->withExprs, *this ); |
---|
[e0886db] | 518 | { |
---|
[2cb70aa] | 519 | // with clause introduces a level of scope (for the with expression members). |
---|
| 520 | // with clause exprs are added to the indexer before parameters so that parameters |
---|
| 521 | // shadow with exprs and not the other way around. |
---|
[e0886db] | 522 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[0ac366b] | 523 | indexerAddWith( node->withExprs, node ); |
---|
[7aaec67] | 524 | { |
---|
| 525 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 526 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 |
---|
| 527 | static ObjectDecl func( |
---|
| 528 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, |
---|
| 529 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), |
---|
| 530 | nullptr |
---|
| 531 | ); |
---|
| 532 | indexerAddId( &func ); |
---|
| 533 | maybeAccept_impl( node->type, *this ); |
---|
[c6c682cf] | 534 | // First remember that we are now within a function. |
---|
[61d9b4b] | 535 | ValueGuard< bool > oldInFunction( inFunction ); |
---|
| 536 | inFunction = true; |
---|
[c6c682cf] | 537 | // The function body needs to have the same scope as parameters. |
---|
| 538 | // A CompoundStmt will not enter a new scope if atFunctionTop is true. |
---|
| 539 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 540 | atFunctionTop = true; |
---|
[7aaec67] | 541 | maybeAccept_impl( node->statements, *this ); |
---|
| 542 | maybeAccept_impl( node->attributes, *this ); |
---|
| 543 | } |
---|
[e0886db] | 544 | } |
---|
| 545 | |
---|
| 546 | VISIT_END( node ); |
---|
| 547 | } |
---|
| 548 | |
---|
[7870799] | 549 | template< typename pass_type > |
---|
| 550 | void PassVisitor< pass_type >::visit( const FunctionDecl * node ) { |
---|
| 551 | VISIT_START( node ); |
---|
| 552 | |
---|
[e3d7f9f] | 553 | indexerAddId( node ); |
---|
| 554 | |
---|
[7870799] | 555 | maybeAccept_impl( node->withExprs, *this ); |
---|
| 556 | { |
---|
[e3d7f9f] | 557 | // with clause introduces a level of scope (for the with expression members). |
---|
| 558 | // with clause exprs are added to the indexer before parameters so that parameters |
---|
| 559 | // shadow with exprs and not the other way around. |
---|
| 560 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 561 | indexerAddWith( node->withExprs, node ); |
---|
| 562 | { |
---|
| 563 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 564 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 |
---|
| 565 | static ObjectDecl func( |
---|
| 566 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, |
---|
| 567 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), |
---|
| 568 | nullptr |
---|
| 569 | ); |
---|
| 570 | indexerAddId( &func ); |
---|
| 571 | maybeAccept_impl( node->type, *this ); |
---|
[c6c682cf] | 572 | // First remember that we are now within a function. |
---|
[e3d7f9f] | 573 | ValueGuard< bool > oldInFunction( inFunction ); |
---|
| 574 | inFunction = true; |
---|
[c6c682cf] | 575 | // The function body needs to have the same scope as parameters. |
---|
| 576 | // A CompoundStmt will not enter a new scope if atFunctionTop is true. |
---|
| 577 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 578 | atFunctionTop = true; |
---|
[e3d7f9f] | 579 | maybeAccept_impl( node->statements, *this ); |
---|
| 580 | maybeAccept_impl( node->attributes, *this ); |
---|
| 581 | } |
---|
[7870799] | 582 | } |
---|
| 583 | |
---|
| 584 | VISIT_END( node ); |
---|
| 585 | } |
---|
| 586 | |
---|
[e0886db] | 587 | template< typename pass_type > |
---|
| 588 | DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) { |
---|
| 589 | MUTATE_START( node ); |
---|
| 590 | |
---|
[2cb70aa] | 591 | indexerAddId( node ); |
---|
[e0886db] | 592 | |
---|
| 593 | { |
---|
[2cb70aa] | 594 | // with clause introduces a level of scope (for the with expression members). |
---|
| 595 | // with clause exprs are added to the indexer before parameters so that parameters |
---|
| 596 | // shadow with exprs and not the other way around. |
---|
[e0886db] | 597 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[0ac366b] | 598 | indexerAddWith( node->withExprs, node ); |
---|
[7aaec67] | 599 | { |
---|
| 600 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 601 | // implicit add __func__ identifier as specified in the C manual 6.4.2.2 |
---|
| 602 | static ObjectDecl func( |
---|
| 603 | "__func__", noStorageClasses, LinkageSpec::C, nullptr, |
---|
| 604 | new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ), |
---|
| 605 | nullptr |
---|
| 606 | ); |
---|
| 607 | indexerAddId( &func ); |
---|
| 608 | maybeMutate_impl( node->type, *this ); |
---|
[f2ff0a6] | 609 | maybeMutate_impl( node->attributes, *this ); |
---|
[c6c682cf] | 610 | // First remember that we are now within a function. |
---|
[61d9b4b] | 611 | ValueGuard< bool > oldInFunction( inFunction ); |
---|
| 612 | inFunction = true; |
---|
[c6c682cf] | 613 | // The function body needs to have the same scope as parameters. |
---|
| 614 | // A CompoundStmt will not enter a new scope if atFunctionTop is true. |
---|
| 615 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 616 | atFunctionTop = true; |
---|
[7aaec67] | 617 | maybeMutate_impl( node->statements, *this ); |
---|
| 618 | } |
---|
[e0886db] | 619 | } |
---|
| 620 | |
---|
| 621 | MUTATE_END( DeclarationWithType, node ); |
---|
[13932f14] | 622 | } |
---|
| 623 | |
---|
[e0886db] | 624 | //-------------------------------------------------------------------------- |
---|
| 625 | // StructDecl |
---|
[13932f14] | 626 | template< typename pass_type > |
---|
[ab904dc] | 627 | void PassVisitor< pass_type >::visit( StructDecl * node ) { |
---|
[e0886db] | 628 | VISIT_START( node ); |
---|
| 629 | |
---|
| 630 | // make up a forward declaration and add it before processing the members |
---|
| 631 | // needs to be on the heap because addStruct saves the pointer |
---|
| 632 | indexerAddStructFwd( node ); |
---|
| 633 | |
---|
| 634 | { |
---|
| 635 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 636 | maybeAccept_impl( node->parameters, *this ); |
---|
| 637 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 638 | maybeAccept_impl( node->attributes, *this ); |
---|
[e0886db] | 639 | } |
---|
| 640 | |
---|
| 641 | // this addition replaces the forward declaration |
---|
| 642 | indexerAddStruct( node ); |
---|
| 643 | |
---|
| 644 | VISIT_END( node ); |
---|
| 645 | } |
---|
| 646 | |
---|
[7870799] | 647 | template< typename pass_type > |
---|
| 648 | void PassVisitor< pass_type >::visit( const StructDecl * node ) { |
---|
| 649 | VISIT_START( node ); |
---|
| 650 | |
---|
[e3d7f9f] | 651 | // make up a forward declaration and add it before processing the members |
---|
| 652 | // needs to be on the heap because addStruct saves the pointer |
---|
| 653 | indexerAddStructFwd( node ); |
---|
| 654 | |
---|
| 655 | { |
---|
| 656 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 657 | maybeAccept_impl( node->parameters, *this ); |
---|
| 658 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 659 | maybeAccept_impl( node->attributes, *this ); |
---|
[e3d7f9f] | 660 | } |
---|
| 661 | |
---|
| 662 | // this addition replaces the forward declaration |
---|
| 663 | indexerAddStruct( node ); |
---|
[7870799] | 664 | |
---|
| 665 | VISIT_END( node ); |
---|
| 666 | } |
---|
| 667 | |
---|
[e0886db] | 668 | template< typename pass_type > |
---|
| 669 | Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) { |
---|
| 670 | MUTATE_START( node ); |
---|
| 671 | |
---|
| 672 | // make up a forward declaration and add it before processing the members |
---|
| 673 | // needs to be on the heap because addStruct saves the pointer |
---|
| 674 | indexerAddStructFwd( node ); |
---|
| 675 | |
---|
| 676 | { |
---|
| 677 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 678 | maybeMutate_impl( node->parameters, *this ); |
---|
| 679 | maybeMutate_impl( node->members , *this ); |
---|
[798a8b3] | 680 | maybeMutate_impl( node->attributes, *this ); |
---|
[e0886db] | 681 | } |
---|
| 682 | |
---|
| 683 | // this addition replaces the forward declaration |
---|
| 684 | indexerAddStruct( node ); |
---|
| 685 | |
---|
| 686 | MUTATE_END( Declaration, node ); |
---|
[13932f14] | 687 | } |
---|
| 688 | |
---|
[e0886db] | 689 | //-------------------------------------------------------------------------- |
---|
| 690 | // UnionDecl |
---|
[13932f14] | 691 | template< typename pass_type > |
---|
[ab904dc] | 692 | void PassVisitor< pass_type >::visit( UnionDecl * node ) { |
---|
[e0886db] | 693 | VISIT_START( node ); |
---|
| 694 | |
---|
| 695 | // make up a forward declaration and add it before processing the members |
---|
| 696 | indexerAddUnionFwd( node ); |
---|
| 697 | |
---|
| 698 | { |
---|
| 699 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 700 | maybeAccept_impl( node->parameters, *this ); |
---|
| 701 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 702 | maybeAccept_impl( node->attributes, *this ); |
---|
[e0886db] | 703 | } |
---|
| 704 | |
---|
| 705 | indexerAddUnion( node ); |
---|
| 706 | |
---|
| 707 | VISIT_END( node ); |
---|
| 708 | } |
---|
[7870799] | 709 | template< typename pass_type > |
---|
| 710 | void PassVisitor< pass_type >::visit( const UnionDecl * node ) { |
---|
| 711 | VISIT_START( node ); |
---|
| 712 | |
---|
[e3d7f9f] | 713 | // make up a forward declaration and add it before processing the members |
---|
| 714 | indexerAddUnionFwd( node ); |
---|
| 715 | |
---|
| 716 | { |
---|
| 717 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 718 | maybeAccept_impl( node->parameters, *this ); |
---|
| 719 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 720 | maybeAccept_impl( node->attributes, *this ); |
---|
[e3d7f9f] | 721 | } |
---|
| 722 | |
---|
| 723 | indexerAddUnion( node ); |
---|
[7870799] | 724 | |
---|
| 725 | VISIT_END( node ); |
---|
| 726 | } |
---|
[e0886db] | 727 | |
---|
| 728 | template< typename pass_type > |
---|
| 729 | Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) { |
---|
| 730 | MUTATE_START( node ); |
---|
| 731 | |
---|
| 732 | // make up a forward declaration and add it before processing the members |
---|
| 733 | indexerAddUnionFwd( node ); |
---|
| 734 | |
---|
| 735 | { |
---|
| 736 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 737 | maybeMutate_impl( node->parameters, *this ); |
---|
| 738 | maybeMutate_impl( node->members , *this ); |
---|
[798a8b3] | 739 | maybeMutate_impl( node->attributes, *this ); |
---|
[e0886db] | 740 | } |
---|
| 741 | |
---|
| 742 | indexerAddUnion( node ); |
---|
| 743 | |
---|
| 744 | MUTATE_END( Declaration, node ); |
---|
[13932f14] | 745 | } |
---|
| 746 | |
---|
[e0886db] | 747 | //-------------------------------------------------------------------------- |
---|
| 748 | // EnumDecl |
---|
[13932f14] | 749 | template< typename pass_type > |
---|
[ab904dc] | 750 | void PassVisitor< pass_type >::visit( EnumDecl * node ) { |
---|
[e0886db] | 751 | VISIT_START( node ); |
---|
| 752 | |
---|
| 753 | indexerAddEnum( node ); |
---|
| 754 | |
---|
[33a25f9] | 755 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
[4559b34] | 756 | // if ( node->base ) maybeAccept_impl( node->base, *this ); // Need this? Maybe not? |
---|
[3c398b6] | 757 | maybeAccept_impl( node->parameters, *this ); |
---|
| 758 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 759 | maybeAccept_impl( node->attributes, *this ); |
---|
[e0886db] | 760 | |
---|
| 761 | VISIT_END( node ); |
---|
[13932f14] | 762 | } |
---|
| 763 | |
---|
[7870799] | 764 | template< typename pass_type > |
---|
| 765 | void PassVisitor< pass_type >::visit( const EnumDecl * node ) { |
---|
| 766 | VISIT_START( node ); |
---|
| 767 | |
---|
[e3d7f9f] | 768 | indexerAddEnum( node ); |
---|
| 769 | |
---|
[7870799] | 770 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
| 771 | maybeAccept_impl( node->parameters, *this ); |
---|
| 772 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 773 | maybeAccept_impl( node->attributes, *this ); |
---|
[7870799] | 774 | |
---|
| 775 | VISIT_END( node ); |
---|
| 776 | } |
---|
| 777 | |
---|
[e0886db] | 778 | template< typename pass_type > |
---|
| 779 | Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) { |
---|
| 780 | MUTATE_START( node ); |
---|
| 781 | |
---|
| 782 | indexerAddEnum( node ); |
---|
| 783 | |
---|
[522363e] | 784 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
[3c398b6] | 785 | maybeMutate_impl( node->parameters, *this ); |
---|
| 786 | maybeMutate_impl( node->members , *this ); |
---|
[798a8b3] | 787 | maybeMutate_impl( node->attributes, *this ); |
---|
[e0886db] | 788 | |
---|
| 789 | MUTATE_END( Declaration, node ); |
---|
| 790 | } |
---|
| 791 | |
---|
| 792 | //-------------------------------------------------------------------------- |
---|
| 793 | // TraitDecl |
---|
[13932f14] | 794 | template< typename pass_type > |
---|
[ab904dc] | 795 | void PassVisitor< pass_type >::visit( TraitDecl * node ) { |
---|
[e0886db] | 796 | VISIT_START( node ); |
---|
| 797 | |
---|
| 798 | { |
---|
| 799 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 800 | maybeAccept_impl( node->parameters, *this ); |
---|
| 801 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 802 | maybeAccept_impl( node->attributes, *this ); |
---|
[e0886db] | 803 | } |
---|
| 804 | |
---|
| 805 | indexerAddTrait( node ); |
---|
| 806 | |
---|
| 807 | VISIT_END( node ); |
---|
[13932f14] | 808 | } |
---|
| 809 | |
---|
[7870799] | 810 | template< typename pass_type > |
---|
| 811 | void PassVisitor< pass_type >::visit( const TraitDecl * node ) { |
---|
| 812 | VISIT_START( node ); |
---|
| 813 | |
---|
[e3d7f9f] | 814 | { |
---|
| 815 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 816 | maybeAccept_impl( node->parameters, *this ); |
---|
| 817 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 818 | maybeAccept_impl( node->attributes, *this ); |
---|
[e3d7f9f] | 819 | } |
---|
| 820 | |
---|
| 821 | indexerAddTrait( node ); |
---|
[7870799] | 822 | |
---|
| 823 | VISIT_END( node ); |
---|
| 824 | } |
---|
| 825 | |
---|
[e0886db] | 826 | template< typename pass_type > |
---|
| 827 | Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) { |
---|
| 828 | MUTATE_START( node ); |
---|
| 829 | |
---|
| 830 | { |
---|
| 831 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 832 | maybeMutate_impl( node->parameters, *this ); |
---|
| 833 | maybeMutate_impl( node->members , *this ); |
---|
[798a8b3] | 834 | maybeMutate_impl( node->attributes, *this ); |
---|
[e0886db] | 835 | } |
---|
| 836 | |
---|
| 837 | indexerAddTrait( node ); |
---|
| 838 | |
---|
| 839 | MUTATE_END( Declaration, node ); |
---|
| 840 | } |
---|
| 841 | |
---|
| 842 | //-------------------------------------------------------------------------- |
---|
| 843 | // TypeDecl |
---|
[13932f14] | 844 | template< typename pass_type > |
---|
[ab904dc] | 845 | void PassVisitor< pass_type >::visit( TypeDecl * node ) { |
---|
[e0886db] | 846 | VISIT_START( node ); |
---|
| 847 | |
---|
| 848 | { |
---|
| 849 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 850 | maybeAccept_impl( node->base , *this ); |
---|
[e0886db] | 851 | } |
---|
| 852 | |
---|
[33a25f9] | 853 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
| 854 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
| 855 | // and may depend on the type itself |
---|
[e0886db] | 856 | indexerAddType( node ); |
---|
| 857 | |
---|
[3c398b6] | 858 | maybeAccept_impl( node->assertions, *this ); |
---|
[e0886db] | 859 | |
---|
| 860 | indexerScopedAccept( node->init, *this ); |
---|
| 861 | |
---|
| 862 | VISIT_END( node ); |
---|
| 863 | } |
---|
| 864 | |
---|
[7870799] | 865 | |
---|
| 866 | template< typename pass_type > |
---|
| 867 | void PassVisitor< pass_type >::visit( const TypeDecl * node ) { |
---|
| 868 | VISIT_START( node ); |
---|
| 869 | |
---|
[e3d7f9f] | 870 | { |
---|
| 871 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 872 | maybeAccept_impl( node->base , *this ); |
---|
| 873 | } |
---|
| 874 | |
---|
| 875 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
| 876 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
| 877 | // and may depend on the type itself |
---|
| 878 | indexerAddType( node ); |
---|
| 879 | |
---|
[7870799] | 880 | maybeAccept_impl( node->assertions, *this ); |
---|
| 881 | |
---|
[e3d7f9f] | 882 | indexerScopedAccept( node->init, *this ); |
---|
| 883 | |
---|
[7870799] | 884 | VISIT_END( node ); |
---|
| 885 | } |
---|
| 886 | |
---|
[e0886db] | 887 | template< typename pass_type > |
---|
[982832e] | 888 | Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) { |
---|
[e0886db] | 889 | MUTATE_START( node ); |
---|
| 890 | |
---|
| 891 | { |
---|
| 892 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 893 | maybeMutate_impl( node->base , *this ); |
---|
[e0886db] | 894 | } |
---|
| 895 | |
---|
[33a25f9] | 896 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
| 897 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
| 898 | // and may depend on the type itself |
---|
[e0886db] | 899 | indexerAddType( node ); |
---|
| 900 | |
---|
[3c398b6] | 901 | maybeMutate_impl( node->assertions, *this ); |
---|
[e0886db] | 902 | |
---|
| 903 | indexerScopedMutate( node->init, *this ); |
---|
| 904 | |
---|
[982832e] | 905 | MUTATE_END( Declaration, node ); |
---|
[13932f14] | 906 | } |
---|
| 907 | |
---|
[e0886db] | 908 | //-------------------------------------------------------------------------- |
---|
| 909 | // TypedefDecl |
---|
[13932f14] | 910 | template< typename pass_type > |
---|
[ab904dc] | 911 | void PassVisitor< pass_type >::visit( TypedefDecl * node ) { |
---|
[e0886db] | 912 | VISIT_START( node ); |
---|
| 913 | |
---|
| 914 | { |
---|
| 915 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 916 | maybeAccept_impl( node->base , *this ); |
---|
[e0886db] | 917 | } |
---|
| 918 | |
---|
| 919 | indexerAddType( node ); |
---|
| 920 | |
---|
[3c398b6] | 921 | maybeAccept_impl( node->assertions, *this ); |
---|
[e0886db] | 922 | |
---|
| 923 | VISIT_END( node ); |
---|
[13932f14] | 924 | } |
---|
| 925 | |
---|
[7870799] | 926 | template< typename pass_type > |
---|
| 927 | void PassVisitor< pass_type >::visit( const TypedefDecl * node ) { |
---|
| 928 | VISIT_START( node ); |
---|
| 929 | |
---|
[e3d7f9f] | 930 | { |
---|
| 931 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 932 | maybeAccept_impl( node->base , *this ); |
---|
| 933 | } |
---|
| 934 | |
---|
| 935 | indexerAddType( node ); |
---|
| 936 | |
---|
[7870799] | 937 | maybeAccept_impl( node->assertions, *this ); |
---|
| 938 | |
---|
| 939 | VISIT_END( node ); |
---|
| 940 | } |
---|
| 941 | |
---|
[13932f14] | 942 | template< typename pass_type > |
---|
[e0886db] | 943 | Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) { |
---|
| 944 | MUTATE_START( node ); |
---|
| 945 | |
---|
| 946 | { |
---|
| 947 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 948 | maybeMutate_impl( node->base , *this ); |
---|
[e0886db] | 949 | } |
---|
| 950 | |
---|
| 951 | indexerAddType( node ); |
---|
| 952 | |
---|
[3c398b6] | 953 | maybeMutate_impl( node->assertions, *this ); |
---|
[e0886db] | 954 | |
---|
| 955 | MUTATE_END( Declaration, node ); |
---|
[13932f14] | 956 | } |
---|
| 957 | |
---|
[9c1600c] | 958 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 959 | // AsmDecl |
---|
[13932f14] | 960 | template< typename pass_type > |
---|
[e0886db] | 961 | void PassVisitor< pass_type >::visit( AsmDecl * node ) { |
---|
[9c1600c] | 962 | VISIT_START( node ); |
---|
| 963 | |
---|
[3c398b6] | 964 | maybeAccept_impl( node->stmt, *this ); |
---|
[9c1600c] | 965 | |
---|
| 966 | VISIT_END( node ); |
---|
[13932f14] | 967 | } |
---|
| 968 | |
---|
[7870799] | 969 | template< typename pass_type > |
---|
| 970 | void PassVisitor< pass_type >::visit( const AsmDecl * node ) { |
---|
| 971 | VISIT_START( node ); |
---|
| 972 | |
---|
| 973 | maybeAccept_impl( node->stmt, *this ); |
---|
| 974 | |
---|
| 975 | VISIT_END( node ); |
---|
| 976 | } |
---|
| 977 | |
---|
[296b2be] | 978 | template< typename pass_type > |
---|
[e0886db] | 979 | AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) { |
---|
[296b2be] | 980 | MUTATE_START( node ); |
---|
| 981 | |
---|
[3c398b6] | 982 | maybeMutate_impl( node->stmt, *this ); |
---|
[e0886db] | 983 | |
---|
| 984 | MUTATE_END( AsmDecl, node ); |
---|
| 985 | } |
---|
| 986 | |
---|
[2d019af] | 987 | //-------------------------------------------------------------------------- |
---|
| 988 | // DirectiveDecl |
---|
| 989 | template< typename pass_type > |
---|
| 990 | void PassVisitor< pass_type >::visit( DirectiveDecl * node ) { |
---|
| 991 | VISIT_START( node ); |
---|
| 992 | |
---|
| 993 | maybeAccept_impl( node->stmt, *this ); |
---|
| 994 | |
---|
| 995 | VISIT_END( node ); |
---|
| 996 | } |
---|
| 997 | |
---|
| 998 | template< typename pass_type > |
---|
| 999 | void PassVisitor< pass_type >::visit( const DirectiveDecl * node ) { |
---|
| 1000 | VISIT_START( node ); |
---|
| 1001 | |
---|
| 1002 | maybeAccept_impl( node->stmt, *this ); |
---|
| 1003 | |
---|
| 1004 | VISIT_END( node ); |
---|
| 1005 | } |
---|
| 1006 | |
---|
| 1007 | template< typename pass_type > |
---|
| 1008 | DirectiveDecl * PassVisitor< pass_type >::mutate( DirectiveDecl * node ) { |
---|
| 1009 | MUTATE_START( node ); |
---|
| 1010 | |
---|
| 1011 | maybeMutate_impl( node->stmt, *this ); |
---|
| 1012 | |
---|
| 1013 | MUTATE_END( DirectiveDecl, node ); |
---|
| 1014 | } |
---|
| 1015 | |
---|
[f6e3e34] | 1016 | //-------------------------------------------------------------------------- |
---|
| 1017 | // StaticAssertDecl |
---|
| 1018 | template< typename pass_type > |
---|
| 1019 | void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) { |
---|
| 1020 | VISIT_START( node ); |
---|
| 1021 | |
---|
[842c3d3] | 1022 | node->condition = visitExpression( node->condition ); |
---|
| 1023 | maybeAccept_impl( node->message, *this ); |
---|
[f6e3e34] | 1024 | |
---|
| 1025 | VISIT_END( node ); |
---|
| 1026 | } |
---|
| 1027 | |
---|
[7870799] | 1028 | template< typename pass_type > |
---|
| 1029 | void PassVisitor< pass_type >::visit( const StaticAssertDecl * node ) { |
---|
| 1030 | VISIT_START( node ); |
---|
| 1031 | |
---|
| 1032 | visitExpression( node->condition ); |
---|
| 1033 | maybeAccept_impl( node->message, *this ); |
---|
| 1034 | |
---|
| 1035 | VISIT_END( node ); |
---|
| 1036 | } |
---|
| 1037 | |
---|
[f6e3e34] | 1038 | template< typename pass_type > |
---|
| 1039 | StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) { |
---|
| 1040 | MUTATE_START( node ); |
---|
| 1041 | |
---|
[842c3d3] | 1042 | node->condition = mutateExpression( node->condition ); |
---|
| 1043 | maybeMutate_impl( node->message, *this ); |
---|
[f6e3e34] | 1044 | |
---|
| 1045 | MUTATE_END( StaticAssertDecl, node ); |
---|
| 1046 | } |
---|
| 1047 | |
---|
[e874605] | 1048 | //-------------------------------------------------------------------------- |
---|
[71806e0] | 1049 | // InlineMemberDecl |
---|
[e874605] | 1050 | template< typename pass_type > |
---|
[71806e0] | 1051 | void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) { |
---|
[e874605] | 1052 | VISIT_START( node ); |
---|
| 1053 | |
---|
| 1054 | maybeAccept_impl( node->type, *this ); |
---|
| 1055 | |
---|
| 1056 | VISIT_END( node ); |
---|
| 1057 | } |
---|
| 1058 | |
---|
| 1059 | template< typename pass_type > |
---|
[71806e0] | 1060 | void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) { |
---|
[e874605] | 1061 | VISIT_START( node ); |
---|
| 1062 | |
---|
| 1063 | maybeAccept_impl( node->type, *this ); |
---|
| 1064 | |
---|
| 1065 | VISIT_END( node ); |
---|
| 1066 | } |
---|
| 1067 | |
---|
| 1068 | template< typename pass_type > |
---|
[71806e0] | 1069 | DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) { |
---|
[e874605] | 1070 | MUTATE_START( node ); |
---|
| 1071 | |
---|
| 1072 | maybeMutate_impl( node->type, *this ); |
---|
| 1073 | |
---|
| 1074 | MUTATE_END( DeclarationWithType, node ); |
---|
| 1075 | } |
---|
| 1076 | |
---|
[e0886db] | 1077 | //-------------------------------------------------------------------------- |
---|
| 1078 | // CompoundStmt |
---|
| 1079 | template< typename pass_type > |
---|
| 1080 | void PassVisitor< pass_type >::visit( CompoundStmt * node ) { |
---|
| 1081 | VISIT_START( node ); |
---|
| 1082 | { |
---|
[c6c682cf] | 1083 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
| 1084 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 1085 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
[e0886db] | 1086 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
[c6c682cf] | 1087 | atFunctionTop = false; |
---|
[e0886db] | 1088 | visitStatementList( node->kids ); |
---|
| 1089 | } |
---|
| 1090 | VISIT_END( node ); |
---|
| 1091 | } |
---|
[296b2be] | 1092 | |
---|
[7870799] | 1093 | template< typename pass_type > |
---|
| 1094 | void PassVisitor< pass_type >::visit( const CompoundStmt * node ) { |
---|
| 1095 | VISIT_START( node ); |
---|
| 1096 | { |
---|
[c6c682cf] | 1097 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
| 1098 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 1099 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
[7870799] | 1100 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
[c6c682cf] | 1101 | atFunctionTop = false; |
---|
[7870799] | 1102 | visitStatementList( node->kids ); |
---|
| 1103 | } |
---|
| 1104 | VISIT_END( node ); |
---|
| 1105 | } |
---|
| 1106 | |
---|
[e0886db] | 1107 | template< typename pass_type > |
---|
| 1108 | CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) { |
---|
| 1109 | MUTATE_START( node ); |
---|
| 1110 | { |
---|
[c6c682cf] | 1111 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
| 1112 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 1113 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
[e0886db] | 1114 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
[c6c682cf] | 1115 | atFunctionTop = false; |
---|
[e0886db] | 1116 | mutateStatementList( node->kids ); |
---|
| 1117 | } |
---|
[296b2be] | 1118 | MUTATE_END( CompoundStmt, node ); |
---|
| 1119 | } |
---|
| 1120 | |
---|
[9c1600c] | 1121 | //-------------------------------------------------------------------------- |
---|
| 1122 | // ExprStmt |
---|
[13932f14] | 1123 | template< typename pass_type > |
---|
[ab904dc] | 1124 | void PassVisitor< pass_type >::visit( ExprStmt * node ) { |
---|
[9c1600c] | 1125 | VISIT_START( node ); |
---|
| 1126 | |
---|
[e0886db] | 1127 | visitExpression( node->expr ); |
---|
[9c1600c] | 1128 | |
---|
| 1129 | VISIT_END( node ); |
---|
[13932f14] | 1130 | } |
---|
| 1131 | |
---|
[7870799] | 1132 | template< typename pass_type > |
---|
| 1133 | void PassVisitor< pass_type >::visit( const ExprStmt * node ) { |
---|
| 1134 | VISIT_START( node ); |
---|
| 1135 | |
---|
| 1136 | visitExpression( node->expr ); |
---|
| 1137 | |
---|
| 1138 | VISIT_END( node ); |
---|
| 1139 | } |
---|
| 1140 | |
---|
[296b2be] | 1141 | template< typename pass_type > |
---|
| 1142 | Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) { |
---|
| 1143 | MUTATE_START( node ); |
---|
| 1144 | |
---|
[e0886db] | 1145 | node->expr = mutateExpression( node->expr ); |
---|
[296b2be] | 1146 | |
---|
| 1147 | MUTATE_END( Statement, node ); |
---|
| 1148 | } |
---|
| 1149 | |
---|
[6ca154b] | 1150 | //-------------------------------------------------------------------------- |
---|
| 1151 | // AsmStmt |
---|
[13932f14] | 1152 | template< typename pass_type > |
---|
[ab904dc] | 1153 | void PassVisitor< pass_type >::visit( AsmStmt * node ) { |
---|
[bc6f918] | 1154 | VISIT_START( node ) |
---|
| 1155 | |
---|
| 1156 | maybeAccept_impl( node->instruction, *this ); |
---|
| 1157 | maybeAccept_impl( node->output, *this ); |
---|
| 1158 | maybeAccept_impl( node->input, *this ); |
---|
| 1159 | maybeAccept_impl( node->clobber, *this ); |
---|
| 1160 | |
---|
| 1161 | VISIT_END( node ); |
---|
[13932f14] | 1162 | } |
---|
| 1163 | |
---|
[7870799] | 1164 | template< typename pass_type > |
---|
| 1165 | void PassVisitor< pass_type >::visit( const AsmStmt * node ) { |
---|
| 1166 | VISIT_START( node ) |
---|
| 1167 | |
---|
| 1168 | maybeAccept_impl( node->instruction, *this ); |
---|
| 1169 | maybeAccept_impl( node->output, *this ); |
---|
| 1170 | maybeAccept_impl( node->input, *this ); |
---|
| 1171 | maybeAccept_impl( node->clobber, *this ); |
---|
| 1172 | |
---|
| 1173 | VISIT_END( node ); |
---|
| 1174 | } |
---|
| 1175 | |
---|
[6ca154b] | 1176 | template< typename pass_type > |
---|
| 1177 | Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) { |
---|
[bc6f918] | 1178 | MUTATE_START( node ); |
---|
| 1179 | |
---|
| 1180 | maybeMutate_impl( node->instruction, *this ); |
---|
| 1181 | maybeMutate_impl( node->output, *this ); |
---|
| 1182 | maybeMutate_impl( node->input, *this ); |
---|
| 1183 | maybeMutate_impl( node->clobber, *this ); |
---|
| 1184 | |
---|
| 1185 | MUTATE_END( Statement, node ); |
---|
[6ca154b] | 1186 | } |
---|
| 1187 | |
---|
[cc32d83] | 1188 | //-------------------------------------------------------------------------- |
---|
| 1189 | // AsmStmt |
---|
| 1190 | template< typename pass_type > |
---|
| 1191 | void PassVisitor< pass_type >::visit( DirectiveStmt * node ) { |
---|
| 1192 | VISIT_START( node ) |
---|
| 1193 | |
---|
| 1194 | VISIT_END( node ); |
---|
| 1195 | } |
---|
| 1196 | |
---|
[7870799] | 1197 | template< typename pass_type > |
---|
| 1198 | void PassVisitor< pass_type >::visit( const DirectiveStmt * node ) { |
---|
| 1199 | VISIT_START( node ) |
---|
| 1200 | |
---|
| 1201 | VISIT_END( node ); |
---|
| 1202 | } |
---|
| 1203 | |
---|
[cc32d83] | 1204 | template< typename pass_type > |
---|
| 1205 | Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) { |
---|
| 1206 | MUTATE_START( node ); |
---|
| 1207 | |
---|
| 1208 | MUTATE_END( Statement, node ); |
---|
| 1209 | } |
---|
| 1210 | |
---|
[9c1600c] | 1211 | //-------------------------------------------------------------------------- |
---|
| 1212 | // IfStmt |
---|
[13932f14] | 1213 | template< typename pass_type > |
---|
[ab904dc] | 1214 | void PassVisitor< pass_type >::visit( IfStmt * node ) { |
---|
[4551a6e] | 1215 | VISIT_START( node ); |
---|
[33a25f9] | 1216 | { |
---|
| 1217 | // if statements introduce a level of scope (for the initialization) |
---|
| 1218 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[7870799] | 1219 | maybeAccept_impl( node->initialization, *this ); |
---|
[3c398b6] | 1220 | visitExpression ( node->condition ); |
---|
[3b0bc16] | 1221 | node->then = visitStatement( node->then ); |
---|
| 1222 | node->else_ = visitStatement( node->else_ ); |
---|
[33a25f9] | 1223 | } |
---|
[9c1600c] | 1224 | VISIT_END( node ); |
---|
[13932f14] | 1225 | } |
---|
| 1226 | |
---|
[7870799] | 1227 | template< typename pass_type > |
---|
| 1228 | void PassVisitor< pass_type >::visit( const IfStmt * node ) { |
---|
| 1229 | VISIT_START( node ); |
---|
[e3d7f9f] | 1230 | { |
---|
| 1231 | // if statements introduce a level of scope (for the initialization) |
---|
| 1232 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1233 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1234 | visitExpression ( node->condition ); |
---|
[3b0bc16] | 1235 | visitStatement ( node->then ); |
---|
| 1236 | visitStatement ( node->else_ ); |
---|
[e3d7f9f] | 1237 | } |
---|
[7870799] | 1238 | VISIT_END( node ); |
---|
| 1239 | } |
---|
| 1240 | |
---|
[296b2be] | 1241 | template< typename pass_type > |
---|
| 1242 | Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) { |
---|
[4551a6e] | 1243 | MUTATE_START( node ); |
---|
[e0886db] | 1244 | { |
---|
[33a25f9] | 1245 | // if statements introduce a level of scope (for the initialization) |
---|
[e0886db] | 1246 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[7870799] | 1247 | maybeMutate_impl( node->initialization, *this ); |
---|
[e0886db] | 1248 | node->condition = mutateExpression( node->condition ); |
---|
[3b0bc16] | 1249 | node->then = mutateStatement ( node->then ); |
---|
| 1250 | node->else_ = mutateStatement ( node->else_ ); |
---|
[e0886db] | 1251 | } |
---|
[296b2be] | 1252 | MUTATE_END( Statement, node ); |
---|
| 1253 | } |
---|
| 1254 | |
---|
[9c1600c] | 1255 | //-------------------------------------------------------------------------- |
---|
[3b0bc16] | 1256 | // WhileDoStmt |
---|
[13932f14] | 1257 | template< typename pass_type > |
---|
[3b0bc16] | 1258 | void PassVisitor< pass_type >::visit( WhileDoStmt * node ) { |
---|
[4551a6e] | 1259 | VISIT_START( node ); |
---|
[9c1600c] | 1260 | |
---|
[ee3c93d] | 1261 | { |
---|
| 1262 | // while statements introduce a level of scope (for the initialization) |
---|
| 1263 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1264 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1265 | visitExpression ( node->condition ); |
---|
| 1266 | node->body = visitStatement( node->body ); |
---|
| 1267 | } |
---|
[9c1600c] | 1268 | |
---|
| 1269 | VISIT_END( node ); |
---|
[13932f14] | 1270 | } |
---|
| 1271 | |
---|
[7870799] | 1272 | template< typename pass_type > |
---|
[3b0bc16] | 1273 | void PassVisitor< pass_type >::visit( const WhileDoStmt * node ) { |
---|
[7870799] | 1274 | VISIT_START( node ); |
---|
| 1275 | |
---|
[e3d7f9f] | 1276 | { |
---|
| 1277 | // while statements introduce a level of scope (for the initialization) |
---|
| 1278 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1279 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1280 | visitExpression ( node->condition ); |
---|
| 1281 | visitStatement ( node->body ); |
---|
| 1282 | } |
---|
[7870799] | 1283 | |
---|
| 1284 | VISIT_END( node ); |
---|
| 1285 | } |
---|
| 1286 | |
---|
[296b2be] | 1287 | template< typename pass_type > |
---|
[3b0bc16] | 1288 | Statement * PassVisitor< pass_type >::mutate( WhileDoStmt * node ) { |
---|
[4551a6e] | 1289 | MUTATE_START( node ); |
---|
[296b2be] | 1290 | |
---|
[ee3c93d] | 1291 | { |
---|
| 1292 | // while statements introduce a level of scope (for the initialization) |
---|
| 1293 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1294 | maybeMutate_impl( node->initialization, *this ); |
---|
| 1295 | node->condition = mutateExpression( node->condition ); |
---|
| 1296 | node->body = mutateStatement ( node->body ); |
---|
| 1297 | } |
---|
| 1298 | |
---|
[296b2be] | 1299 | |
---|
| 1300 | MUTATE_END( Statement, node ); |
---|
| 1301 | } |
---|
| 1302 | |
---|
[9c1600c] | 1303 | //-------------------------------------------------------------------------- |
---|
[6ca154b] | 1304 | // ForStmt |
---|
[13932f14] | 1305 | template< typename pass_type > |
---|
[ab904dc] | 1306 | void PassVisitor< pass_type >::visit( ForStmt * node ) { |
---|
[4551a6e] | 1307 | VISIT_START( node ); |
---|
[e0886db] | 1308 | { |
---|
[33a25f9] | 1309 | // for statements introduce a level of scope (for the initialization) |
---|
[e0886db] | 1310 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1311 | maybeAccept_impl( node->initialization, *this ); |
---|
[e0886db] | 1312 | visitExpression( node->condition ); |
---|
| 1313 | visitExpression( node->increment ); |
---|
| 1314 | node->body = visitStatement( node->body ); |
---|
| 1315 | } |
---|
[9c1600c] | 1316 | VISIT_END( node ); |
---|
[13932f14] | 1317 | } |
---|
| 1318 | |
---|
[7870799] | 1319 | template< typename pass_type > |
---|
| 1320 | void PassVisitor< pass_type >::visit( const ForStmt * node ) { |
---|
| 1321 | VISIT_START( node ); |
---|
[e3d7f9f] | 1322 | { |
---|
| 1323 | // for statements introduce a level of scope (for the initialization) |
---|
| 1324 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1325 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1326 | visitExpression( node->condition ); |
---|
| 1327 | visitExpression( node->increment ); |
---|
| 1328 | visitStatement ( node->body ); |
---|
| 1329 | } |
---|
[7870799] | 1330 | VISIT_END( node ); |
---|
| 1331 | } |
---|
| 1332 | |
---|
[296b2be] | 1333 | template< typename pass_type > |
---|
| 1334 | Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) { |
---|
[4551a6e] | 1335 | MUTATE_START( node ); |
---|
[e0886db] | 1336 | { |
---|
[33a25f9] | 1337 | // for statements introduce a level of scope (for the initialization) |
---|
[e0886db] | 1338 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1339 | maybeMutate_impl( node->initialization, *this ); |
---|
[e0886db] | 1340 | node->condition = mutateExpression( node->condition ); |
---|
| 1341 | node->increment = mutateExpression( node->increment ); |
---|
| 1342 | node->body = mutateStatement ( node->body ); |
---|
| 1343 | } |
---|
[296b2be] | 1344 | MUTATE_END( Statement, node ); |
---|
| 1345 | } |
---|
| 1346 | |
---|
[9c1600c] | 1347 | //-------------------------------------------------------------------------- |
---|
| 1348 | // SwitchStmt |
---|
[13932f14] | 1349 | template< typename pass_type > |
---|
[ab904dc] | 1350 | void PassVisitor< pass_type >::visit( SwitchStmt * node ) { |
---|
[4551a6e] | 1351 | VISIT_START( node ); |
---|
[9c1600c] | 1352 | |
---|
[e0886db] | 1353 | visitExpression ( node->condition ); |
---|
| 1354 | visitStatementList( node->statements ); |
---|
[9c1600c] | 1355 | |
---|
| 1356 | VISIT_END( node ); |
---|
[13932f14] | 1357 | } |
---|
| 1358 | |
---|
[7870799] | 1359 | template< typename pass_type > |
---|
| 1360 | void PassVisitor< pass_type >::visit( const SwitchStmt * node ) { |
---|
| 1361 | VISIT_START( node ); |
---|
| 1362 | |
---|
| 1363 | visitExpression ( node->condition ); |
---|
| 1364 | visitStatementList( node->statements ); |
---|
| 1365 | |
---|
| 1366 | VISIT_END( node ); |
---|
| 1367 | } |
---|
| 1368 | |
---|
[296b2be] | 1369 | template< typename pass_type > |
---|
| 1370 | Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) { |
---|
[4551a6e] | 1371 | MUTATE_START( node ); |
---|
| 1372 | |
---|
[e0886db] | 1373 | node->condition = mutateExpression( node->condition ); |
---|
| 1374 | mutateStatementList( node->statements ); |
---|
[4551a6e] | 1375 | |
---|
[296b2be] | 1376 | MUTATE_END( Statement, node ); |
---|
| 1377 | } |
---|
| 1378 | |
---|
[9c1600c] | 1379 | //-------------------------------------------------------------------------- |
---|
[35df560] | 1380 | // CaseStmt |
---|
[13932f14] | 1381 | template< typename pass_type > |
---|
[ab904dc] | 1382 | void PassVisitor< pass_type >::visit( CaseStmt * node ) { |
---|
[4551a6e] | 1383 | VISIT_START( node ); |
---|
| 1384 | |
---|
[e0886db] | 1385 | visitExpression ( node->condition ); |
---|
| 1386 | visitStatementList( node->stmts ); |
---|
[4551a6e] | 1387 | |
---|
[9c1600c] | 1388 | VISIT_END( node ); |
---|
[13932f14] | 1389 | } |
---|
| 1390 | |
---|
[7870799] | 1391 | template< typename pass_type > |
---|
| 1392 | void PassVisitor< pass_type >::visit( const CaseStmt * node ) { |
---|
| 1393 | VISIT_START( node ); |
---|
| 1394 | |
---|
| 1395 | visitExpression ( node->condition ); |
---|
| 1396 | visitStatementList( node->stmts ); |
---|
| 1397 | |
---|
| 1398 | VISIT_END( node ); |
---|
| 1399 | } |
---|
| 1400 | |
---|
[296b2be] | 1401 | template< typename pass_type > |
---|
| 1402 | Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) { |
---|
[4551a6e] | 1403 | MUTATE_START( node ); |
---|
| 1404 | |
---|
[e0886db] | 1405 | node->condition = mutateExpression( node->condition ); |
---|
| 1406 | mutateStatementList( node->stmts ); |
---|
[4551a6e] | 1407 | |
---|
[296b2be] | 1408 | MUTATE_END( Statement, node ); |
---|
| 1409 | } |
---|
| 1410 | |
---|
[6ca154b] | 1411 | //-------------------------------------------------------------------------- |
---|
| 1412 | // BranchStmt |
---|
[13932f14] | 1413 | template< typename pass_type > |
---|
[ab904dc] | 1414 | void PassVisitor< pass_type >::visit( BranchStmt * node ) { |
---|
[33c0ce8] | 1415 | VISIT_START( node ); |
---|
| 1416 | VISIT_END( node ); |
---|
[13932f14] | 1417 | } |
---|
| 1418 | |
---|
[7870799] | 1419 | template< typename pass_type > |
---|
| 1420 | void PassVisitor< pass_type >::visit( const BranchStmt * node ) { |
---|
| 1421 | VISIT_START( node ); |
---|
| 1422 | VISIT_END( node ); |
---|
| 1423 | } |
---|
| 1424 | |
---|
[6ca154b] | 1425 | template< typename pass_type > |
---|
| 1426 | Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) { |
---|
[33c0ce8] | 1427 | MUTATE_START( node ); |
---|
| 1428 | MUTATE_END( Statement, node ); |
---|
[6ca154b] | 1429 | } |
---|
| 1430 | |
---|
[9c1600c] | 1431 | //-------------------------------------------------------------------------- |
---|
| 1432 | // ReturnStmt |
---|
[13932f14] | 1433 | template< typename pass_type > |
---|
[ab904dc] | 1434 | void PassVisitor< pass_type >::visit( ReturnStmt * node ) { |
---|
[9c1600c] | 1435 | VISIT_START( node ); |
---|
| 1436 | |
---|
[e0886db] | 1437 | visitExpression( node->expr ); |
---|
[9c1600c] | 1438 | |
---|
| 1439 | VISIT_END( node ); |
---|
[13932f14] | 1440 | } |
---|
| 1441 | |
---|
[7870799] | 1442 | template< typename pass_type > |
---|
| 1443 | void PassVisitor< pass_type >::visit( const ReturnStmt * node ) { |
---|
| 1444 | VISIT_START( node ); |
---|
| 1445 | |
---|
| 1446 | visitExpression( node->expr ); |
---|
| 1447 | |
---|
| 1448 | VISIT_END( node ); |
---|
| 1449 | } |
---|
| 1450 | |
---|
[296b2be] | 1451 | template< typename pass_type > |
---|
| 1452 | Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) { |
---|
| 1453 | MUTATE_START( node ); |
---|
| 1454 | |
---|
[e0886db] | 1455 | node->expr = mutateExpression( node->expr ); |
---|
[296b2be] | 1456 | |
---|
| 1457 | MUTATE_END( Statement, node ); |
---|
| 1458 | } |
---|
| 1459 | |
---|
[6e09f211] | 1460 | //-------------------------------------------------------------------------- |
---|
| 1461 | // ThrowStmt |
---|
| 1462 | template< typename pass_type > |
---|
| 1463 | void PassVisitor< pass_type >::visit( ThrowStmt * node ) { |
---|
[33c0ce8] | 1464 | VISIT_START( node ); |
---|
| 1465 | |
---|
| 1466 | maybeAccept_impl( node->expr, *this ); |
---|
| 1467 | maybeAccept_impl( node->target, *this ); |
---|
| 1468 | |
---|
| 1469 | VISIT_END( node ); |
---|
[6e09f211] | 1470 | } |
---|
| 1471 | |
---|
[7870799] | 1472 | template< typename pass_type > |
---|
| 1473 | void PassVisitor< pass_type >::visit( const ThrowStmt * node ) { |
---|
| 1474 | VISIT_START( node ); |
---|
| 1475 | |
---|
| 1476 | maybeAccept_impl( node->expr, *this ); |
---|
| 1477 | maybeAccept_impl( node->target, *this ); |
---|
| 1478 | |
---|
| 1479 | VISIT_END( node ); |
---|
| 1480 | } |
---|
| 1481 | |
---|
[6e09f211] | 1482 | template< typename pass_type > |
---|
| 1483 | Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) { |
---|
[33c0ce8] | 1484 | MUTATE_START( node ); |
---|
| 1485 | |
---|
| 1486 | maybeMutate_impl( node->expr, *this ); |
---|
| 1487 | maybeMutate_impl( node->target, *this ); |
---|
| 1488 | |
---|
| 1489 | MUTATE_END( Statement, node ); |
---|
[6e09f211] | 1490 | } |
---|
| 1491 | |
---|
[9c1600c] | 1492 | //-------------------------------------------------------------------------- |
---|
| 1493 | // TryStmt |
---|
[13932f14] | 1494 | template< typename pass_type > |
---|
[ab904dc] | 1495 | void PassVisitor< pass_type >::visit( TryStmt * node ) { |
---|
[9c1600c] | 1496 | VISIT_START( node ); |
---|
| 1497 | |
---|
[3c398b6] | 1498 | maybeAccept_impl( node->block , *this ); |
---|
| 1499 | maybeAccept_impl( node->handlers , *this ); |
---|
| 1500 | maybeAccept_impl( node->finallyBlock, *this ); |
---|
[9c1600c] | 1501 | |
---|
| 1502 | VISIT_END( node ); |
---|
[13932f14] | 1503 | } |
---|
| 1504 | |
---|
[7870799] | 1505 | template< typename pass_type > |
---|
| 1506 | void PassVisitor< pass_type >::visit( const TryStmt * node ) { |
---|
| 1507 | VISIT_START( node ); |
---|
| 1508 | |
---|
| 1509 | maybeAccept_impl( node->block , *this ); |
---|
| 1510 | maybeAccept_impl( node->handlers , *this ); |
---|
| 1511 | maybeAccept_impl( node->finallyBlock, *this ); |
---|
| 1512 | |
---|
| 1513 | VISIT_END( node ); |
---|
| 1514 | } |
---|
| 1515 | |
---|
[296b2be] | 1516 | template< typename pass_type > |
---|
| 1517 | Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) { |
---|
| 1518 | MUTATE_START( node ); |
---|
| 1519 | |
---|
[3c398b6] | 1520 | maybeMutate_impl( node->block , *this ); |
---|
| 1521 | maybeMutate_impl( node->handlers , *this ); |
---|
| 1522 | maybeMutate_impl( node->finallyBlock, *this ); |
---|
[4551a6e] | 1523 | |
---|
[296b2be] | 1524 | MUTATE_END( Statement, node ); |
---|
| 1525 | } |
---|
| 1526 | |
---|
[9c1600c] | 1527 | //-------------------------------------------------------------------------- |
---|
| 1528 | // CatchStmt |
---|
[13932f14] | 1529 | template< typename pass_type > |
---|
[ab904dc] | 1530 | void PassVisitor< pass_type >::visit( CatchStmt * node ) { |
---|
[9c1600c] | 1531 | VISIT_START( node ); |
---|
[e0886db] | 1532 | { |
---|
[33a25f9] | 1533 | // catch statements introduce a level of scope (for the caught exception) |
---|
[e0886db] | 1534 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1535 | maybeAccept_impl( node->decl, *this ); |
---|
[e0886db] | 1536 | node->cond = visitExpression( node->cond ); |
---|
| 1537 | node->body = visitStatement ( node->body ); |
---|
| 1538 | } |
---|
[9c1600c] | 1539 | VISIT_END( node ); |
---|
[13932f14] | 1540 | } |
---|
| 1541 | |
---|
[7870799] | 1542 | template< typename pass_type > |
---|
| 1543 | void PassVisitor< pass_type >::visit( const CatchStmt * node ) { |
---|
| 1544 | VISIT_START( node ); |
---|
[e3d7f9f] | 1545 | { |
---|
| 1546 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1547 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1548 | maybeAccept_impl( node->decl, *this ); |
---|
| 1549 | visitExpression ( node->cond ); |
---|
| 1550 | visitStatement ( node->body ); |
---|
| 1551 | } |
---|
[7870799] | 1552 | VISIT_END( node ); |
---|
| 1553 | } |
---|
| 1554 | |
---|
[296b2be] | 1555 | template< typename pass_type > |
---|
| 1556 | Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) { |
---|
| 1557 | MUTATE_START( node ); |
---|
[e0886db] | 1558 | { |
---|
[33a25f9] | 1559 | // catch statements introduce a level of scope (for the caught exception) |
---|
[e0886db] | 1560 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1561 | maybeMutate_impl( node->decl, *this ); |
---|
[e0886db] | 1562 | node->cond = mutateExpression( node->cond ); |
---|
| 1563 | node->body = mutateStatement ( node->body ); |
---|
| 1564 | } |
---|
[296b2be] | 1565 | MUTATE_END( Statement, node ); |
---|
| 1566 | } |
---|
| 1567 | |
---|
[2065609] | 1568 | //-------------------------------------------------------------------------- |
---|
| 1569 | // FinallyStmt |
---|
[13932f14] | 1570 | template< typename pass_type > |
---|
[ab904dc] | 1571 | void PassVisitor< pass_type >::visit( FinallyStmt * node ) { |
---|
[11b7028] | 1572 | VISIT_START( node ); |
---|
| 1573 | |
---|
| 1574 | maybeAccept_impl( node->block, *this ); |
---|
| 1575 | |
---|
| 1576 | VISIT_END( node ); |
---|
[13932f14] | 1577 | } |
---|
| 1578 | |
---|
[7870799] | 1579 | template< typename pass_type > |
---|
| 1580 | void PassVisitor< pass_type >::visit( const FinallyStmt * node ) { |
---|
| 1581 | VISIT_START( node ); |
---|
| 1582 | |
---|
| 1583 | maybeAccept_impl( node->block, *this ); |
---|
| 1584 | |
---|
| 1585 | VISIT_END( node ); |
---|
| 1586 | } |
---|
| 1587 | |
---|
[2065609] | 1588 | template< typename pass_type > |
---|
| 1589 | Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { |
---|
[11b7028] | 1590 | MUTATE_START( node ); |
---|
| 1591 | |
---|
| 1592 | maybeMutate_impl( node->block, *this ); |
---|
| 1593 | |
---|
| 1594 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1595 | } |
---|
| 1596 | |
---|
[37cdd97] | 1597 | //-------------------------------------------------------------------------- |
---|
| 1598 | // SuspendStmt |
---|
| 1599 | template< typename pass_type > |
---|
| 1600 | void PassVisitor< pass_type >::visit( SuspendStmt * node ) { |
---|
| 1601 | VISIT_START( node ); |
---|
| 1602 | |
---|
| 1603 | maybeAccept_impl( node->then , *this ); |
---|
| 1604 | |
---|
| 1605 | VISIT_END( node ); |
---|
| 1606 | } |
---|
| 1607 | |
---|
| 1608 | template< typename pass_type > |
---|
| 1609 | void PassVisitor< pass_type >::visit( const SuspendStmt * node ) { |
---|
| 1610 | VISIT_START( node ); |
---|
| 1611 | |
---|
| 1612 | maybeAccept_impl( node->then , *this ); |
---|
| 1613 | |
---|
| 1614 | VISIT_END( node ); |
---|
| 1615 | } |
---|
| 1616 | |
---|
| 1617 | template< typename pass_type > |
---|
| 1618 | Statement * PassVisitor< pass_type >::mutate( SuspendStmt * node ) { |
---|
| 1619 | MUTATE_START( node ); |
---|
| 1620 | |
---|
| 1621 | maybeMutate_impl( node->then , *this ); |
---|
| 1622 | |
---|
| 1623 | MUTATE_END( Statement, node ); |
---|
| 1624 | } |
---|
| 1625 | |
---|
[2065609] | 1626 | //-------------------------------------------------------------------------- |
---|
| 1627 | // WaitForStmt |
---|
| 1628 | template< typename pass_type > |
---|
| 1629 | void PassVisitor< pass_type >::visit( WaitForStmt * node ) { |
---|
[834b892] | 1630 | VISIT_START( node ); |
---|
| 1631 | |
---|
| 1632 | for( auto & clause : node->clauses ) { |
---|
| 1633 | maybeAccept_impl( clause.target.function, *this ); |
---|
| 1634 | maybeAccept_impl( clause.target.arguments, *this ); |
---|
| 1635 | |
---|
| 1636 | maybeAccept_impl( clause.statement, *this ); |
---|
| 1637 | maybeAccept_impl( clause.condition, *this ); |
---|
| 1638 | } |
---|
| 1639 | |
---|
| 1640 | maybeAccept_impl( node->timeout.time, *this ); |
---|
| 1641 | maybeAccept_impl( node->timeout.statement, *this ); |
---|
| 1642 | maybeAccept_impl( node->timeout.condition, *this ); |
---|
| 1643 | maybeAccept_impl( node->orelse.statement, *this ); |
---|
| 1644 | maybeAccept_impl( node->orelse.condition, *this ); |
---|
| 1645 | |
---|
| 1646 | VISIT_END( node ); |
---|
[2065609] | 1647 | } |
---|
| 1648 | |
---|
[7870799] | 1649 | template< typename pass_type > |
---|
| 1650 | void PassVisitor< pass_type >::visit( const WaitForStmt * node ) { |
---|
| 1651 | VISIT_START( node ); |
---|
| 1652 | |
---|
| 1653 | for( auto & clause : node->clauses ) { |
---|
| 1654 | maybeAccept_impl( clause.target.function, *this ); |
---|
| 1655 | maybeAccept_impl( clause.target.arguments, *this ); |
---|
| 1656 | |
---|
| 1657 | maybeAccept_impl( clause.statement, *this ); |
---|
| 1658 | maybeAccept_impl( clause.condition, *this ); |
---|
| 1659 | } |
---|
| 1660 | |
---|
| 1661 | maybeAccept_impl( node->timeout.time, *this ); |
---|
| 1662 | maybeAccept_impl( node->timeout.statement, *this ); |
---|
| 1663 | maybeAccept_impl( node->timeout.condition, *this ); |
---|
| 1664 | maybeAccept_impl( node->orelse.statement, *this ); |
---|
| 1665 | maybeAccept_impl( node->orelse.condition, *this ); |
---|
| 1666 | |
---|
| 1667 | VISIT_END( node ); |
---|
| 1668 | } |
---|
| 1669 | |
---|
[2065609] | 1670 | template< typename pass_type > |
---|
| 1671 | Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) { |
---|
[834b892] | 1672 | MUTATE_START( node ); |
---|
| 1673 | |
---|
| 1674 | for( auto & clause : node->clauses ) { |
---|
| 1675 | maybeMutate_impl( clause.target.function, *this ); |
---|
| 1676 | maybeMutate_impl( clause.target.arguments, *this ); |
---|
| 1677 | |
---|
| 1678 | maybeMutate_impl( clause.statement, *this ); |
---|
| 1679 | maybeMutate_impl( clause.condition, *this ); |
---|
| 1680 | } |
---|
| 1681 | |
---|
| 1682 | maybeMutate_impl( node->timeout.time, *this ); |
---|
| 1683 | maybeMutate_impl( node->timeout.statement, *this ); |
---|
| 1684 | maybeMutate_impl( node->timeout.condition, *this ); |
---|
| 1685 | maybeMutate_impl( node->orelse.statement, *this ); |
---|
| 1686 | maybeMutate_impl( node->orelse.condition, *this ); |
---|
| 1687 | |
---|
| 1688 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1689 | } |
---|
| 1690 | |
---|
[d8893ca] | 1691 | |
---|
| 1692 | |
---|
[61255ad] | 1693 | //-------------------------------------------------------------------------- |
---|
[7870799] | 1694 | // WithStmt |
---|
[61255ad] | 1695 | template< typename pass_type > |
---|
| 1696 | void PassVisitor< pass_type >::visit( WithStmt * node ) { |
---|
[d8893ca] | 1697 | VISIT_START( node ); |
---|
| 1698 | maybeAccept_impl( node->exprs, *this ); |
---|
| 1699 | { |
---|
| 1700 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1701 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[0ac366b] | 1702 | indexerAddWith( node->exprs, node ); |
---|
[d8893ca] | 1703 | maybeAccept_impl( node->stmt, *this ); |
---|
| 1704 | } |
---|
| 1705 | VISIT_END( node ); |
---|
[61255ad] | 1706 | } |
---|
| 1707 | |
---|
[7870799] | 1708 | template< typename pass_type > |
---|
| 1709 | void PassVisitor< pass_type >::visit( const WithStmt * node ) { |
---|
| 1710 | VISIT_START( node ); |
---|
| 1711 | maybeAccept_impl( node->exprs, *this ); |
---|
[e3d7f9f] | 1712 | { |
---|
| 1713 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1714 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1715 | indexerAddWith( node->exprs, node ); |
---|
| 1716 | maybeAccept_impl( node->stmt, *this ); |
---|
| 1717 | } |
---|
[7870799] | 1718 | VISIT_END( node ); |
---|
| 1719 | } |
---|
| 1720 | |
---|
[61255ad] | 1721 | template< typename pass_type > |
---|
[e67991f] | 1722 | Declaration * PassVisitor< pass_type >::mutate( WithStmt * node ) { |
---|
[d8893ca] | 1723 | MUTATE_START( node ); |
---|
| 1724 | maybeMutate_impl( node->exprs, *this ); |
---|
| 1725 | { |
---|
| 1726 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1727 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[0ac366b] | 1728 | indexerAddWith( node->exprs, node ); |
---|
[d8893ca] | 1729 | maybeMutate_impl( node->stmt, *this ); |
---|
| 1730 | } |
---|
[e67991f] | 1731 | MUTATE_END( Declaration, node ); |
---|
[61255ad] | 1732 | } |
---|
| 1733 | |
---|
[2065609] | 1734 | //-------------------------------------------------------------------------- |
---|
| 1735 | // NullStmt |
---|
[13932f14] | 1736 | template< typename pass_type > |
---|
[ab904dc] | 1737 | void PassVisitor< pass_type >::visit( NullStmt * node ) { |
---|
[5964127] | 1738 | VISIT_START( node ); |
---|
| 1739 | VISIT_END( node ); |
---|
[13932f14] | 1740 | } |
---|
| 1741 | |
---|
[7870799] | 1742 | template< typename pass_type > |
---|
| 1743 | void PassVisitor< pass_type >::visit( const NullStmt * node ) { |
---|
| 1744 | VISIT_START( node ); |
---|
| 1745 | VISIT_END( node ); |
---|
| 1746 | } |
---|
| 1747 | |
---|
[2065609] | 1748 | template< typename pass_type > |
---|
| 1749 | NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) { |
---|
[5964127] | 1750 | MUTATE_START( node ); |
---|
| 1751 | MUTATE_END( NullStmt, node ); |
---|
[2065609] | 1752 | } |
---|
| 1753 | |
---|
| 1754 | //-------------------------------------------------------------------------- |
---|
| 1755 | // DeclStmt |
---|
[13932f14] | 1756 | template< typename pass_type > |
---|
[ab904dc] | 1757 | void PassVisitor< pass_type >::visit( DeclStmt * node ) { |
---|
[5964127] | 1758 | VISIT_START( node ); |
---|
| 1759 | |
---|
| 1760 | maybeAccept_impl( node->decl, *this ); |
---|
| 1761 | |
---|
| 1762 | VISIT_END( node ); |
---|
[13932f14] | 1763 | } |
---|
| 1764 | |
---|
[7870799] | 1765 | template< typename pass_type > |
---|
| 1766 | void PassVisitor< pass_type >::visit( const DeclStmt * node ) { |
---|
| 1767 | VISIT_START( node ); |
---|
| 1768 | |
---|
| 1769 | maybeAccept_impl( node->decl, *this ); |
---|
| 1770 | |
---|
| 1771 | VISIT_END( node ); |
---|
| 1772 | } |
---|
| 1773 | |
---|
[2065609] | 1774 | template< typename pass_type > |
---|
| 1775 | Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) { |
---|
[5964127] | 1776 | MUTATE_START( node ); |
---|
| 1777 | |
---|
| 1778 | maybeMutate_impl( node->decl, *this ); |
---|
| 1779 | |
---|
| 1780 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1781 | } |
---|
| 1782 | |
---|
| 1783 | //-------------------------------------------------------------------------- |
---|
| 1784 | // ImplicitCtorDtorStmt |
---|
[13932f14] | 1785 | template< typename pass_type > |
---|
[ab904dc] | 1786 | void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { |
---|
[599fbb6] | 1787 | VISIT_START( node ); |
---|
| 1788 | |
---|
| 1789 | maybeAccept_impl( node->callStmt, *this ); |
---|
| 1790 | |
---|
| 1791 | VISIT_END( node ); |
---|
[13932f14] | 1792 | } |
---|
| 1793 | |
---|
[7870799] | 1794 | template< typename pass_type > |
---|
| 1795 | void PassVisitor< pass_type >::visit( const ImplicitCtorDtorStmt * node ) { |
---|
| 1796 | VISIT_START( node ); |
---|
| 1797 | |
---|
| 1798 | maybeAccept_impl( node->callStmt, *this ); |
---|
| 1799 | |
---|
| 1800 | VISIT_END( node ); |
---|
| 1801 | } |
---|
| 1802 | |
---|
[2065609] | 1803 | template< typename pass_type > |
---|
| 1804 | Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) { |
---|
[599fbb6] | 1805 | MUTATE_START( node ); |
---|
| 1806 | |
---|
| 1807 | maybeMutate_impl( node->callStmt, *this ); |
---|
| 1808 | |
---|
| 1809 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1810 | } |
---|
| 1811 | |
---|
[6cebfef] | 1812 | //-------------------------------------------------------------------------- |
---|
| 1813 | // MutexStmt |
---|
| 1814 | template< typename pass_type > |
---|
| 1815 | void PassVisitor< pass_type >::visit( MutexStmt * node ) { |
---|
| 1816 | VISIT_START( node ); |
---|
| 1817 | // mutex statements introduce a level of scope (for the initialization) |
---|
| 1818 | maybeAccept_impl( node->mutexObjs, *this ); |
---|
| 1819 | { |
---|
| 1820 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1821 | node->stmt = visitStatement( node->stmt ); |
---|
| 1822 | } |
---|
| 1823 | VISIT_END( node ); |
---|
| 1824 | } |
---|
| 1825 | |
---|
| 1826 | template< typename pass_type > |
---|
| 1827 | void PassVisitor< pass_type >::visit( const MutexStmt * node ) { |
---|
| 1828 | VISIT_START( node ); |
---|
| 1829 | maybeAccept_impl( node->mutexObjs, *this ); |
---|
| 1830 | { |
---|
| 1831 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1832 | visitStatement( node->stmt ); |
---|
| 1833 | } |
---|
| 1834 | VISIT_END( node ); |
---|
| 1835 | } |
---|
| 1836 | |
---|
| 1837 | template< typename pass_type > |
---|
| 1838 | Statement * PassVisitor< pass_type >::mutate( MutexStmt * node ) { |
---|
| 1839 | MUTATE_START( node ); |
---|
| 1840 | maybeMutate_impl( node->mutexObjs, *this ); |
---|
| 1841 | { |
---|
| 1842 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1843 | node->stmt = mutateStatement( node->stmt ); |
---|
| 1844 | } |
---|
| 1845 | MUTATE_END( Statement, node ); |
---|
| 1846 | } |
---|
| 1847 | |
---|
[2065609] | 1848 | //-------------------------------------------------------------------------- |
---|
| 1849 | // ApplicationExpr |
---|
[13932f14] | 1850 | template< typename pass_type > |
---|
[ab904dc] | 1851 | void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { |
---|
[e0886db] | 1852 | VISIT_START( node ); |
---|
| 1853 | |
---|
| 1854 | indexerScopedAccept( node->result , *this ); |
---|
[e3d7f9f] | 1855 | maybeAccept_impl ( node->function, *this ); |
---|
| 1856 | maybeAccept_impl ( node->args , *this ); |
---|
[e0886db] | 1857 | |
---|
| 1858 | VISIT_END( node ); |
---|
[13932f14] | 1859 | } |
---|
| 1860 | |
---|
[7870799] | 1861 | template< typename pass_type > |
---|
| 1862 | void PassVisitor< pass_type >::visit( const ApplicationExpr * node ) { |
---|
| 1863 | VISIT_START( node ); |
---|
| 1864 | |
---|
[e3d7f9f] | 1865 | indexerScopedAccept( node->result , *this ); |
---|
| 1866 | maybeAccept_impl ( node->function, *this ); |
---|
| 1867 | maybeAccept_impl ( node->args , *this ); |
---|
[7870799] | 1868 | |
---|
| 1869 | VISIT_END( node ); |
---|
| 1870 | } |
---|
| 1871 | |
---|
[2065609] | 1872 | template< typename pass_type > |
---|
| 1873 | Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) { |
---|
[e0886db] | 1874 | MUTATE_START( node ); |
---|
| 1875 | |
---|
| 1876 | indexerScopedMutate( node->env , *this ); |
---|
| 1877 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 1878 | maybeMutate_impl ( node->function, *this ); |
---|
| 1879 | maybeMutate_impl ( node->args , *this ); |
---|
[e0886db] | 1880 | |
---|
| 1881 | MUTATE_END( Expression, node ); |
---|
[2065609] | 1882 | } |
---|
| 1883 | |
---|
[9c1600c] | 1884 | //-------------------------------------------------------------------------- |
---|
| 1885 | // UntypedExpr |
---|
[13932f14] | 1886 | template< typename pass_type > |
---|
[ab904dc] | 1887 | void PassVisitor< pass_type >::visit( UntypedExpr * node ) { |
---|
[9c1600c] | 1888 | VISIT_START( node ); |
---|
| 1889 | |
---|
[3c398b6] | 1890 | // maybeAccept_impl( node->get_env(), *this ); |
---|
[e0886db] | 1891 | indexerScopedAccept( node->result, *this ); |
---|
[2a7b3ca] | 1892 | |
---|
[e0886db] | 1893 | for ( auto expr : node->args ) { |
---|
[9c1600c] | 1894 | visitExpression( expr ); |
---|
| 1895 | } |
---|
| 1896 | |
---|
| 1897 | VISIT_END( node ); |
---|
[13932f14] | 1898 | } |
---|
| 1899 | |
---|
[7870799] | 1900 | template< typename pass_type > |
---|
| 1901 | void PassVisitor< pass_type >::visit( const UntypedExpr * node ) { |
---|
| 1902 | VISIT_START( node ); |
---|
| 1903 | |
---|
[e3d7f9f] | 1904 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 1905 | |
---|
| 1906 | for ( auto expr : node->args ) { |
---|
| 1907 | visitExpression( expr ); |
---|
| 1908 | } |
---|
| 1909 | |
---|
| 1910 | VISIT_END( node ); |
---|
| 1911 | } |
---|
| 1912 | |
---|
[296b2be] | 1913 | template< typename pass_type > |
---|
| 1914 | Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) { |
---|
| 1915 | MUTATE_START( node ); |
---|
| 1916 | |
---|
[e0886db] | 1917 | indexerScopedMutate( node->env , *this ); |
---|
| 1918 | indexerScopedMutate( node->result, *this ); |
---|
[2a7b3ca] | 1919 | |
---|
[e0886db] | 1920 | for ( auto& expr : node->args ) { |
---|
[296b2be] | 1921 | expr = mutateExpression( expr ); |
---|
| 1922 | } |
---|
| 1923 | |
---|
| 1924 | MUTATE_END( Expression, node ); |
---|
| 1925 | } |
---|
| 1926 | |
---|
[e0886db] | 1927 | //-------------------------------------------------------------------------- |
---|
| 1928 | // NameExpr |
---|
[13932f14] | 1929 | template< typename pass_type > |
---|
[ab904dc] | 1930 | void PassVisitor< pass_type >::visit( NameExpr * node ) { |
---|
[e0886db] | 1931 | VISIT_START( node ); |
---|
| 1932 | |
---|
| 1933 | indexerScopedAccept( node->result, *this ); |
---|
| 1934 | |
---|
| 1935 | VISIT_END( node ); |
---|
[13932f14] | 1936 | } |
---|
| 1937 | |
---|
[7870799] | 1938 | template< typename pass_type > |
---|
| 1939 | void PassVisitor< pass_type >::visit( const NameExpr * node ) { |
---|
| 1940 | VISIT_START( node ); |
---|
| 1941 | |
---|
[e3d7f9f] | 1942 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 1943 | |
---|
| 1944 | VISIT_END( node ); |
---|
| 1945 | } |
---|
| 1946 | |
---|
[13932f14] | 1947 | template< typename pass_type > |
---|
[e0886db] | 1948 | Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) { |
---|
| 1949 | MUTATE_START( node ); |
---|
| 1950 | |
---|
| 1951 | indexerScopedMutate( node->env , *this ); |
---|
| 1952 | indexerScopedMutate( node->result, *this ); |
---|
| 1953 | |
---|
[b0d9ff7] | 1954 | MUTATE_END( Expression, node ); |
---|
| 1955 | } |
---|
| 1956 | |
---|
| 1957 | //-------------------------------------------------------------------------- |
---|
| 1958 | // QualifiedNameExpr |
---|
| 1959 | template< typename pass_type > |
---|
| 1960 | void PassVisitor< pass_type >::visit( QualifiedNameExpr * node ) { |
---|
| 1961 | VISIT_START( node ); |
---|
| 1962 | |
---|
| 1963 | indexerScopedAccept( node->result, *this ); |
---|
| 1964 | maybeAccept_impl( node->type_decl, *this ); |
---|
| 1965 | |
---|
| 1966 | VISIT_END( node ); |
---|
| 1967 | } |
---|
| 1968 | |
---|
| 1969 | template< typename pass_type > |
---|
| 1970 | void PassVisitor< pass_type >::visit( const QualifiedNameExpr * node ) { |
---|
| 1971 | VISIT_START( node ); |
---|
| 1972 | |
---|
| 1973 | indexerScopedAccept( node->result, *this ); |
---|
| 1974 | maybeAccept_impl( node->type_decl, *this ); |
---|
| 1975 | |
---|
| 1976 | VISIT_END( node ); |
---|
| 1977 | } |
---|
| 1978 | |
---|
| 1979 | template< typename pass_type > |
---|
| 1980 | Expression * PassVisitor< pass_type >::mutate( QualifiedNameExpr * node ) { |
---|
| 1981 | MUTATE_START( node ); |
---|
| 1982 | |
---|
| 1983 | indexerScopedMutate( node->env , *this ); |
---|
| 1984 | indexerScopedMutate( node->result, *this ); |
---|
| 1985 | maybeMutate_impl( node->type_decl, *this ); |
---|
| 1986 | |
---|
[e0886db] | 1987 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 1988 | } |
---|
| 1989 | |
---|
[e0886db] | 1990 | //-------------------------------------------------------------------------- |
---|
| 1991 | // CastExpr |
---|
[a5f0529] | 1992 | template< typename pass_type > |
---|
[e0886db] | 1993 | void PassVisitor< pass_type >::visit( CastExpr * node ) { |
---|
| 1994 | VISIT_START( node ); |
---|
| 1995 | |
---|
| 1996 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 1997 | maybeAccept_impl ( node->arg , *this ); |
---|
[e0886db] | 1998 | |
---|
| 1999 | VISIT_END( node ); |
---|
[a5f0529] | 2000 | } |
---|
| 2001 | |
---|
[7870799] | 2002 | template< typename pass_type > |
---|
| 2003 | void PassVisitor< pass_type >::visit( const CastExpr * node ) { |
---|
| 2004 | VISIT_START( node ); |
---|
| 2005 | |
---|
[e3d7f9f] | 2006 | indexerScopedAccept( node->result, *this ); |
---|
| 2007 | maybeAccept_impl ( node->arg , *this ); |
---|
[7870799] | 2008 | |
---|
| 2009 | VISIT_END( node ); |
---|
| 2010 | } |
---|
| 2011 | |
---|
[13932f14] | 2012 | template< typename pass_type > |
---|
[e0886db] | 2013 | Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) { |
---|
| 2014 | MUTATE_START( node ); |
---|
| 2015 | |
---|
| 2016 | indexerScopedMutate( node->env , *this ); |
---|
| 2017 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2018 | maybeMutate_impl ( node->arg , *this ); |
---|
[e0886db] | 2019 | |
---|
| 2020 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2021 | } |
---|
| 2022 | |
---|
[e0886db] | 2023 | //-------------------------------------------------------------------------- |
---|
[9a705dc8] | 2024 | // KeywordCastExpr |
---|
| 2025 | template< typename pass_type > |
---|
| 2026 | void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) { |
---|
| 2027 | VISIT_START( node ); |
---|
| 2028 | |
---|
| 2029 | indexerScopedAccept( node->result, *this ); |
---|
| 2030 | maybeAccept_impl ( node->arg , *this ); |
---|
| 2031 | |
---|
| 2032 | VISIT_END( node ); |
---|
| 2033 | } |
---|
| 2034 | |
---|
[7870799] | 2035 | template< typename pass_type > |
---|
| 2036 | void PassVisitor< pass_type >::visit( const KeywordCastExpr * node ) { |
---|
| 2037 | VISIT_START( node ); |
---|
| 2038 | |
---|
[e3d7f9f] | 2039 | indexerScopedAccept( node->result, *this ); |
---|
| 2040 | maybeAccept_impl ( node->arg , *this ); |
---|
[7870799] | 2041 | |
---|
| 2042 | VISIT_END( node ); |
---|
| 2043 | } |
---|
| 2044 | |
---|
[9a705dc8] | 2045 | template< typename pass_type > |
---|
| 2046 | Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) { |
---|
| 2047 | MUTATE_START( node ); |
---|
| 2048 | |
---|
| 2049 | indexerScopedMutate( node->env , *this ); |
---|
| 2050 | indexerScopedMutate( node->result, *this ); |
---|
| 2051 | maybeMutate_impl ( node->arg , *this ); |
---|
| 2052 | |
---|
| 2053 | MUTATE_END( Expression, node ); |
---|
| 2054 | } |
---|
| 2055 | |
---|
| 2056 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 2057 | // VirtualCastExpr |
---|
[13932f14] | 2058 | template< typename pass_type > |
---|
[e0886db] | 2059 | void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) { |
---|
| 2060 | VISIT_START( node ); |
---|
| 2061 | |
---|
| 2062 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 2063 | maybeAccept_impl ( node->arg, *this ); |
---|
[e0886db] | 2064 | |
---|
| 2065 | VISIT_END( node ); |
---|
[13932f14] | 2066 | } |
---|
| 2067 | |
---|
[7870799] | 2068 | template< typename pass_type > |
---|
| 2069 | void PassVisitor< pass_type >::visit( const VirtualCastExpr * node ) { |
---|
| 2070 | VISIT_START( node ); |
---|
| 2071 | |
---|
[e3d7f9f] | 2072 | indexerScopedAccept( node->result, *this ); |
---|
| 2073 | maybeAccept_impl ( node->arg, *this ); |
---|
[7870799] | 2074 | |
---|
| 2075 | VISIT_END( node ); |
---|
| 2076 | } |
---|
| 2077 | |
---|
[13932f14] | 2078 | template< typename pass_type > |
---|
[e0886db] | 2079 | Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) { |
---|
| 2080 | MUTATE_START( node ); |
---|
| 2081 | |
---|
| 2082 | indexerScopedMutate( node->env , *this ); |
---|
| 2083 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2084 | maybeMutate_impl ( node->arg , *this ); |
---|
[e0886db] | 2085 | |
---|
| 2086 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2087 | } |
---|
| 2088 | |
---|
[e0886db] | 2089 | //-------------------------------------------------------------------------- |
---|
| 2090 | // AddressExpr |
---|
[13932f14] | 2091 | template< typename pass_type > |
---|
[e0886db] | 2092 | void PassVisitor< pass_type >::visit( AddressExpr * node ) { |
---|
| 2093 | VISIT_START( node ); |
---|
| 2094 | |
---|
| 2095 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2096 | maybeAccept_impl ( node->arg , *this ); |
---|
[e0886db] | 2097 | |
---|
| 2098 | VISIT_END( node ); |
---|
[13932f14] | 2099 | } |
---|
| 2100 | |
---|
[7870799] | 2101 | template< typename pass_type > |
---|
| 2102 | void PassVisitor< pass_type >::visit( const AddressExpr * node ) { |
---|
| 2103 | VISIT_START( node ); |
---|
| 2104 | |
---|
[e3d7f9f] | 2105 | indexerScopedAccept( node->result, *this ); |
---|
| 2106 | maybeAccept_impl ( node->arg , *this ); |
---|
[7870799] | 2107 | |
---|
| 2108 | VISIT_END( node ); |
---|
| 2109 | } |
---|
| 2110 | |
---|
[13932f14] | 2111 | template< typename pass_type > |
---|
[e0886db] | 2112 | Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) { |
---|
| 2113 | MUTATE_START( node ); |
---|
| 2114 | |
---|
| 2115 | indexerScopedMutate( node->env , *this ); |
---|
| 2116 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2117 | maybeMutate_impl ( node->arg , *this ); |
---|
[e0886db] | 2118 | |
---|
| 2119 | MUTATE_END( Expression, node ); |
---|
| 2120 | } |
---|
| 2121 | |
---|
| 2122 | //-------------------------------------------------------------------------- |
---|
| 2123 | // LabelAddressExpr |
---|
| 2124 | template< typename pass_type > |
---|
| 2125 | void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) { |
---|
| 2126 | VISIT_START( node ); |
---|
| 2127 | |
---|
| 2128 | indexerScopedAccept( node->result, *this ); |
---|
| 2129 | |
---|
| 2130 | VISIT_END( node ); |
---|
| 2131 | } |
---|
| 2132 | |
---|
[7870799] | 2133 | template< typename pass_type > |
---|
| 2134 | void PassVisitor< pass_type >::visit( const LabelAddressExpr * node ) { |
---|
| 2135 | VISIT_START( node ); |
---|
| 2136 | |
---|
[e3d7f9f] | 2137 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2138 | |
---|
| 2139 | VISIT_END( node ); |
---|
| 2140 | } |
---|
| 2141 | |
---|
[e0886db] | 2142 | template< typename pass_type > |
---|
| 2143 | Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) { |
---|
| 2144 | MUTATE_START( node ); |
---|
| 2145 | |
---|
| 2146 | indexerScopedMutate( node->env , *this ); |
---|
| 2147 | indexerScopedMutate( node->result, *this ); |
---|
| 2148 | |
---|
| 2149 | MUTATE_END( Expression, node ); |
---|
| 2150 | } |
---|
| 2151 | |
---|
| 2152 | //-------------------------------------------------------------------------- |
---|
| 2153 | // UntypedMemberExpr |
---|
| 2154 | template< typename pass_type > |
---|
| 2155 | void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) { |
---|
| 2156 | VISIT_START( node ); |
---|
| 2157 | |
---|
| 2158 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2159 | maybeAccept_impl ( node->aggregate, *this ); |
---|
| 2160 | maybeAccept_impl ( node->member , *this ); |
---|
[e0886db] | 2161 | |
---|
| 2162 | VISIT_END( node ); |
---|
[13932f14] | 2163 | } |
---|
| 2164 | |
---|
[7870799] | 2165 | template< typename pass_type > |
---|
| 2166 | void PassVisitor< pass_type >::visit( const UntypedMemberExpr * node ) { |
---|
| 2167 | VISIT_START( node ); |
---|
| 2168 | |
---|
[e3d7f9f] | 2169 | indexerScopedAccept( node->result , *this ); |
---|
| 2170 | maybeAccept_impl ( node->aggregate, *this ); |
---|
| 2171 | maybeAccept_impl ( node->member , *this ); |
---|
[7870799] | 2172 | |
---|
| 2173 | VISIT_END( node ); |
---|
| 2174 | } |
---|
| 2175 | |
---|
[e0886db] | 2176 | template< typename pass_type > |
---|
| 2177 | Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) { |
---|
| 2178 | MUTATE_START( node ); |
---|
| 2179 | |
---|
| 2180 | indexerScopedMutate( node->env , *this ); |
---|
| 2181 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2182 | maybeMutate_impl ( node->aggregate, *this ); |
---|
| 2183 | maybeMutate_impl ( node->member , *this ); |
---|
[e0886db] | 2184 | |
---|
| 2185 | MUTATE_END( Expression, node ); |
---|
| 2186 | } |
---|
| 2187 | |
---|
| 2188 | //-------------------------------------------------------------------------- |
---|
| 2189 | // MemberExpr |
---|
| 2190 | template< typename pass_type > |
---|
| 2191 | void PassVisitor< pass_type >::visit( MemberExpr * node ) { |
---|
| 2192 | VISIT_START( node ); |
---|
| 2193 | |
---|
| 2194 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2195 | maybeAccept_impl ( node->aggregate, *this ); |
---|
[e0886db] | 2196 | |
---|
| 2197 | VISIT_END( node ); |
---|
| 2198 | } |
---|
| 2199 | |
---|
[7870799] | 2200 | template< typename pass_type > |
---|
| 2201 | void PassVisitor< pass_type >::visit( const MemberExpr * node ) { |
---|
| 2202 | VISIT_START( node ); |
---|
| 2203 | |
---|
[e3d7f9f] | 2204 | indexerScopedAccept( node->result , *this ); |
---|
| 2205 | maybeAccept_impl ( node->aggregate, *this ); |
---|
[7870799] | 2206 | |
---|
| 2207 | VISIT_END( node ); |
---|
| 2208 | } |
---|
| 2209 | |
---|
[e0886db] | 2210 | template< typename pass_type > |
---|
| 2211 | Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) { |
---|
| 2212 | MUTATE_START( node ); |
---|
| 2213 | |
---|
| 2214 | indexerScopedMutate( node->env , *this ); |
---|
| 2215 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2216 | maybeMutate_impl ( node->aggregate, *this ); |
---|
[e0886db] | 2217 | |
---|
| 2218 | MUTATE_END( Expression, node ); |
---|
| 2219 | } |
---|
| 2220 | |
---|
| 2221 | //-------------------------------------------------------------------------- |
---|
| 2222 | // VariableExpr |
---|
| 2223 | template< typename pass_type > |
---|
| 2224 | void PassVisitor< pass_type >::visit( VariableExpr * node ) { |
---|
| 2225 | VISIT_START( node ); |
---|
| 2226 | |
---|
| 2227 | indexerScopedAccept( node->result, *this ); |
---|
| 2228 | |
---|
| 2229 | VISIT_END( node ); |
---|
| 2230 | } |
---|
| 2231 | |
---|
[7870799] | 2232 | template< typename pass_type > |
---|
| 2233 | void PassVisitor< pass_type >::visit( const VariableExpr * node ) { |
---|
| 2234 | VISIT_START( node ); |
---|
| 2235 | |
---|
[e3d7f9f] | 2236 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2237 | |
---|
| 2238 | VISIT_END( node ); |
---|
| 2239 | } |
---|
| 2240 | |
---|
[e0886db] | 2241 | template< typename pass_type > |
---|
| 2242 | Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) { |
---|
| 2243 | MUTATE_START( node ); |
---|
| 2244 | |
---|
| 2245 | indexerScopedMutate( node->env , *this ); |
---|
| 2246 | indexerScopedMutate( node->result, *this ); |
---|
| 2247 | |
---|
| 2248 | MUTATE_END( Expression, node ); |
---|
| 2249 | } |
---|
| 2250 | |
---|
| 2251 | //-------------------------------------------------------------------------- |
---|
| 2252 | // ConstantExpr |
---|
[13932f14] | 2253 | template< typename pass_type > |
---|
[ab904dc] | 2254 | void PassVisitor< pass_type >::visit( ConstantExpr * node ) { |
---|
[e0886db] | 2255 | VISIT_START( node ); |
---|
| 2256 | |
---|
| 2257 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2258 | maybeAccept_impl ( &node->constant, *this ); |
---|
[e0886db] | 2259 | |
---|
| 2260 | VISIT_END( node ); |
---|
[13932f14] | 2261 | } |
---|
| 2262 | |
---|
[7870799] | 2263 | template< typename pass_type > |
---|
| 2264 | void PassVisitor< pass_type >::visit( const ConstantExpr * node ) { |
---|
| 2265 | VISIT_START( node ); |
---|
| 2266 | |
---|
[e3d7f9f] | 2267 | indexerScopedAccept( node->result , *this ); |
---|
| 2268 | maybeAccept_impl ( &node->constant, *this ); |
---|
[7870799] | 2269 | |
---|
| 2270 | VISIT_END( node ); |
---|
| 2271 | } |
---|
| 2272 | |
---|
[e0886db] | 2273 | template< typename pass_type > |
---|
| 2274 | Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) { |
---|
| 2275 | MUTATE_START( node ); |
---|
| 2276 | |
---|
| 2277 | indexerScopedMutate( node->env , *this ); |
---|
| 2278 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2279 | Constant * ptr = &node->constant; |
---|
| 2280 | maybeMutate_impl( ptr, *this ); |
---|
| 2281 | node->constant = *ptr; |
---|
[e0886db] | 2282 | |
---|
| 2283 | MUTATE_END( Expression, node ); |
---|
| 2284 | } |
---|
| 2285 | |
---|
| 2286 | //-------------------------------------------------------------------------- |
---|
| 2287 | // SizeofExpr |
---|
[13932f14] | 2288 | template< typename pass_type > |
---|
[ab904dc] | 2289 | void PassVisitor< pass_type >::visit( SizeofExpr * node ) { |
---|
[e0886db] | 2290 | VISIT_START( node ); |
---|
| 2291 | |
---|
| 2292 | indexerScopedAccept( node->result, *this ); |
---|
| 2293 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2294 | maybeAccept_impl( node->type, *this ); |
---|
[e0886db] | 2295 | } else { |
---|
[3c398b6] | 2296 | maybeAccept_impl( node->expr, *this ); |
---|
[e0886db] | 2297 | } |
---|
| 2298 | |
---|
| 2299 | VISIT_END( node ); |
---|
[13932f14] | 2300 | } |
---|
| 2301 | |
---|
[7870799] | 2302 | template< typename pass_type > |
---|
| 2303 | void PassVisitor< pass_type >::visit( const SizeofExpr * node ) { |
---|
| 2304 | VISIT_START( node ); |
---|
| 2305 | |
---|
[e3d7f9f] | 2306 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2307 | if ( node->get_isType() ) { |
---|
| 2308 | maybeAccept_impl( node->type, *this ); |
---|
| 2309 | } else { |
---|
| 2310 | maybeAccept_impl( node->expr, *this ); |
---|
| 2311 | } |
---|
| 2312 | |
---|
| 2313 | VISIT_END( node ); |
---|
| 2314 | } |
---|
| 2315 | |
---|
[e0886db] | 2316 | template< typename pass_type > |
---|
| 2317 | Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) { |
---|
| 2318 | MUTATE_START( node ); |
---|
| 2319 | |
---|
| 2320 | indexerScopedMutate( node->env , *this ); |
---|
| 2321 | indexerScopedMutate( node->result, *this ); |
---|
| 2322 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2323 | maybeMutate_impl( node->type, *this ); |
---|
[e0886db] | 2324 | } else { |
---|
[3c398b6] | 2325 | maybeMutate_impl( node->expr, *this ); |
---|
[e0886db] | 2326 | } |
---|
| 2327 | |
---|
| 2328 | MUTATE_END( Expression, node ); |
---|
| 2329 | } |
---|
| 2330 | |
---|
| 2331 | //-------------------------------------------------------------------------- |
---|
| 2332 | // AlignofExpr |
---|
[13932f14] | 2333 | template< typename pass_type > |
---|
[ab904dc] | 2334 | void PassVisitor< pass_type >::visit( AlignofExpr * node ) { |
---|
[e0886db] | 2335 | VISIT_START( node ); |
---|
| 2336 | |
---|
| 2337 | indexerScopedAccept( node->result, *this ); |
---|
| 2338 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2339 | maybeAccept_impl( node->type, *this ); |
---|
[e0886db] | 2340 | } else { |
---|
[3c398b6] | 2341 | maybeAccept_impl( node->expr, *this ); |
---|
[e0886db] | 2342 | } |
---|
| 2343 | |
---|
| 2344 | VISIT_END( node ); |
---|
[13932f14] | 2345 | } |
---|
| 2346 | |
---|
[7870799] | 2347 | template< typename pass_type > |
---|
| 2348 | void PassVisitor< pass_type >::visit( const AlignofExpr * node ) { |
---|
| 2349 | VISIT_START( node ); |
---|
| 2350 | |
---|
[e3d7f9f] | 2351 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2352 | if ( node->get_isType() ) { |
---|
| 2353 | maybeAccept_impl( node->type, *this ); |
---|
| 2354 | } else { |
---|
| 2355 | maybeAccept_impl( node->expr, *this ); |
---|
| 2356 | } |
---|
| 2357 | |
---|
| 2358 | VISIT_END( node ); |
---|
| 2359 | } |
---|
| 2360 | |
---|
[e0886db] | 2361 | template< typename pass_type > |
---|
| 2362 | Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) { |
---|
| 2363 | MUTATE_START( node ); |
---|
| 2364 | |
---|
| 2365 | indexerScopedMutate( node->env , *this ); |
---|
| 2366 | indexerScopedMutate( node->result, *this ); |
---|
| 2367 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2368 | maybeMutate_impl( node->type, *this ); |
---|
[e0886db] | 2369 | } else { |
---|
[3c398b6] | 2370 | maybeMutate_impl( node->expr, *this ); |
---|
[e0886db] | 2371 | } |
---|
| 2372 | |
---|
| 2373 | MUTATE_END( Expression, node ); |
---|
| 2374 | } |
---|
| 2375 | |
---|
| 2376 | //-------------------------------------------------------------------------- |
---|
| 2377 | // UntypedOffsetofExpr |
---|
[13932f14] | 2378 | template< typename pass_type > |
---|
[ab904dc] | 2379 | void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) { |
---|
[e0886db] | 2380 | VISIT_START( node ); |
---|
| 2381 | |
---|
| 2382 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2383 | maybeAccept_impl ( node->type , *this ); |
---|
[e0886db] | 2384 | |
---|
| 2385 | VISIT_END( node ); |
---|
[13932f14] | 2386 | } |
---|
| 2387 | |
---|
[7870799] | 2388 | template< typename pass_type > |
---|
| 2389 | void PassVisitor< pass_type >::visit( const UntypedOffsetofExpr * node ) { |
---|
| 2390 | VISIT_START( node ); |
---|
| 2391 | |
---|
[e3d7f9f] | 2392 | indexerScopedAccept( node->result, *this ); |
---|
| 2393 | maybeAccept_impl ( node->type , *this ); |
---|
[7870799] | 2394 | |
---|
| 2395 | VISIT_END( node ); |
---|
| 2396 | } |
---|
| 2397 | |
---|
[e0886db] | 2398 | template< typename pass_type > |
---|
| 2399 | Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) { |
---|
| 2400 | MUTATE_START( node ); |
---|
| 2401 | |
---|
| 2402 | indexerScopedMutate( node->env , *this ); |
---|
| 2403 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2404 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2405 | |
---|
| 2406 | MUTATE_END( Expression, node ); |
---|
| 2407 | } |
---|
| 2408 | |
---|
| 2409 | //-------------------------------------------------------------------------- |
---|
| 2410 | // OffsetofExpr |
---|
[13932f14] | 2411 | template< typename pass_type > |
---|
[ab904dc] | 2412 | void PassVisitor< pass_type >::visit( OffsetofExpr * node ) { |
---|
[e0886db] | 2413 | VISIT_START( node ); |
---|
| 2414 | |
---|
| 2415 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2416 | maybeAccept_impl ( node->type , *this ); |
---|
[e0886db] | 2417 | |
---|
| 2418 | VISIT_END( node ); |
---|
[13932f14] | 2419 | } |
---|
| 2420 | |
---|
[7870799] | 2421 | template< typename pass_type > |
---|
| 2422 | void PassVisitor< pass_type >::visit( const OffsetofExpr * node ) { |
---|
| 2423 | VISIT_START( node ); |
---|
| 2424 | |
---|
[e3d7f9f] | 2425 | indexerScopedAccept( node->result, *this ); |
---|
| 2426 | maybeAccept_impl ( node->type , *this ); |
---|
[7870799] | 2427 | |
---|
| 2428 | VISIT_END( node ); |
---|
| 2429 | } |
---|
| 2430 | |
---|
[e0886db] | 2431 | template< typename pass_type > |
---|
| 2432 | Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) { |
---|
| 2433 | MUTATE_START( node ); |
---|
| 2434 | |
---|
| 2435 | indexerScopedMutate( node->env , *this ); |
---|
| 2436 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2437 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2438 | |
---|
| 2439 | MUTATE_END( Expression, node ); |
---|
| 2440 | } |
---|
| 2441 | |
---|
| 2442 | //-------------------------------------------------------------------------- |
---|
| 2443 | // OffsetPackExpr |
---|
[13932f14] | 2444 | template< typename pass_type > |
---|
[ab904dc] | 2445 | void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) { |
---|
[e0886db] | 2446 | VISIT_START( node ); |
---|
| 2447 | |
---|
| 2448 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2449 | maybeAccept_impl ( node->type , *this ); |
---|
[e0886db] | 2450 | |
---|
| 2451 | VISIT_END( node ); |
---|
[13932f14] | 2452 | } |
---|
| 2453 | |
---|
[7870799] | 2454 | template< typename pass_type > |
---|
| 2455 | void PassVisitor< pass_type >::visit( const OffsetPackExpr * node ) { |
---|
| 2456 | VISIT_START( node ); |
---|
| 2457 | |
---|
[e3d7f9f] | 2458 | indexerScopedAccept( node->result, *this ); |
---|
| 2459 | maybeAccept_impl ( node->type , *this ); |
---|
[7870799] | 2460 | |
---|
| 2461 | VISIT_END( node ); |
---|
| 2462 | } |
---|
| 2463 | |
---|
[e0886db] | 2464 | template< typename pass_type > |
---|
| 2465 | Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) { |
---|
| 2466 | MUTATE_START( node ); |
---|
| 2467 | |
---|
| 2468 | indexerScopedMutate( node->env , *this ); |
---|
| 2469 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2470 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2471 | |
---|
| 2472 | MUTATE_END( Expression, node ); |
---|
| 2473 | } |
---|
| 2474 | |
---|
| 2475 | //-------------------------------------------------------------------------- |
---|
| 2476 | // LogicalExpr |
---|
[13932f14] | 2477 | template< typename pass_type > |
---|
[ab904dc] | 2478 | void PassVisitor< pass_type >::visit( LogicalExpr * node ) { |
---|
[e0886db] | 2479 | VISIT_START( node ); |
---|
| 2480 | |
---|
| 2481 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2482 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2483 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2484 | |
---|
| 2485 | VISIT_END( node ); |
---|
| 2486 | } |
---|
| 2487 | |
---|
[7870799] | 2488 | template< typename pass_type > |
---|
| 2489 | void PassVisitor< pass_type >::visit( const LogicalExpr * node ) { |
---|
| 2490 | VISIT_START( node ); |
---|
| 2491 | |
---|
[e3d7f9f] | 2492 | indexerScopedAccept( node->result, *this ); |
---|
| 2493 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2494 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[7870799] | 2495 | |
---|
| 2496 | VISIT_END( node ); |
---|
| 2497 | } |
---|
| 2498 | |
---|
[e0886db] | 2499 | template< typename pass_type > |
---|
| 2500 | Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) { |
---|
| 2501 | MUTATE_START( node ); |
---|
| 2502 | |
---|
| 2503 | indexerScopedMutate( node->env , *this ); |
---|
| 2504 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2505 | maybeMutate_impl ( node->arg1 , *this ); |
---|
| 2506 | maybeMutate_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2507 | |
---|
| 2508 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2509 | } |
---|
| 2510 | |
---|
[e0886db] | 2511 | //-------------------------------------------------------------------------- |
---|
| 2512 | // ConditionalExpr |
---|
[13932f14] | 2513 | template< typename pass_type > |
---|
[ab904dc] | 2514 | void PassVisitor< pass_type >::visit( ConditionalExpr * node ) { |
---|
[e0886db] | 2515 | VISIT_START( node ); |
---|
| 2516 | |
---|
| 2517 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2518 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2519 | maybeAccept_impl ( node->arg2 , *this ); |
---|
| 2520 | maybeAccept_impl ( node->arg3 , *this ); |
---|
[e0886db] | 2521 | |
---|
| 2522 | VISIT_END( node ); |
---|
[13932f14] | 2523 | } |
---|
| 2524 | |
---|
[e0886db] | 2525 | template< typename pass_type > |
---|
[7870799] | 2526 | void PassVisitor< pass_type >::visit( const ConditionalExpr * node ) { |
---|
| 2527 | VISIT_START( node ); |
---|
| 2528 | |
---|
[e3d7f9f] | 2529 | indexerScopedAccept( node->result, *this ); |
---|
| 2530 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2531 | maybeAccept_impl ( node->arg2 , *this ); |
---|
| 2532 | maybeAccept_impl ( node->arg3 , *this ); |
---|
[7870799] | 2533 | |
---|
| 2534 | VISIT_END( node ); |
---|
| 2535 | } |
---|
| 2536 | |
---|
| 2537 | template< typename pass_type > |
---|
| 2538 | Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) { |
---|
| 2539 | MUTATE_START( node ); |
---|
[e0886db] | 2540 | |
---|
| 2541 | indexerScopedMutate( node->env , *this ); |
---|
| 2542 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2543 | maybeMutate_impl ( node->arg1 , *this ); |
---|
| 2544 | maybeMutate_impl ( node->arg2 , *this ); |
---|
| 2545 | maybeMutate_impl ( node->arg3 , *this ); |
---|
[e0886db] | 2546 | |
---|
| 2547 | MUTATE_END( Expression, node ); |
---|
| 2548 | } |
---|
| 2549 | |
---|
| 2550 | //-------------------------------------------------------------------------- |
---|
| 2551 | // CommaExpr |
---|
[13932f14] | 2552 | template< typename pass_type > |
---|
[ab904dc] | 2553 | void PassVisitor< pass_type >::visit( CommaExpr * node ) { |
---|
[e0886db] | 2554 | VISIT_START( node ); |
---|
| 2555 | |
---|
| 2556 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2557 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2558 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2559 | |
---|
| 2560 | VISIT_END( node ); |
---|
| 2561 | } |
---|
| 2562 | |
---|
[7870799] | 2563 | template< typename pass_type > |
---|
| 2564 | void PassVisitor< pass_type >::visit( const CommaExpr * node ) { |
---|
| 2565 | VISIT_START( node ); |
---|
| 2566 | |
---|
[e3d7f9f] | 2567 | indexerScopedAccept( node->result, *this ); |
---|
| 2568 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2569 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[7870799] | 2570 | |
---|
| 2571 | VISIT_END( node ); |
---|
| 2572 | } |
---|
| 2573 | |
---|
[e0886db] | 2574 | template< typename pass_type > |
---|
| 2575 | Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) { |
---|
| 2576 | MUTATE_START( node ); |
---|
| 2577 | |
---|
| 2578 | indexerScopedMutate( node->env , *this ); |
---|
| 2579 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2580 | maybeMutate_impl ( node->arg1 , *this ); |
---|
| 2581 | maybeMutate_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2582 | |
---|
| 2583 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2584 | } |
---|
| 2585 | |
---|
[e0886db] | 2586 | //-------------------------------------------------------------------------- |
---|
| 2587 | // TypeExpr |
---|
[13932f14] | 2588 | template< typename pass_type > |
---|
[ab904dc] | 2589 | void PassVisitor< pass_type >::visit( TypeExpr * node ) { |
---|
[e0886db] | 2590 | VISIT_START( node ); |
---|
| 2591 | |
---|
| 2592 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2593 | maybeAccept_impl ( node->type, *this ); |
---|
[e0886db] | 2594 | |
---|
| 2595 | VISIT_END( node ); |
---|
[13932f14] | 2596 | } |
---|
| 2597 | |
---|
[7870799] | 2598 | template< typename pass_type > |
---|
| 2599 | void PassVisitor< pass_type >::visit( const TypeExpr * node ) { |
---|
| 2600 | VISIT_START( node ); |
---|
| 2601 | |
---|
[e3d7f9f] | 2602 | indexerScopedAccept( node->result, *this ); |
---|
| 2603 | maybeAccept_impl ( node->type, *this ); |
---|
[7870799] | 2604 | |
---|
| 2605 | VISIT_END( node ); |
---|
| 2606 | } |
---|
| 2607 | |
---|
[e0886db] | 2608 | template< typename pass_type > |
---|
| 2609 | Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) { |
---|
| 2610 | MUTATE_START( node ); |
---|
| 2611 | |
---|
| 2612 | indexerScopedMutate( node->env , *this ); |
---|
| 2613 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2614 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2615 | |
---|
| 2616 | MUTATE_END( Expression, node ); |
---|
| 2617 | } |
---|
| 2618 | |
---|
[6e50a6b] | 2619 | //-------------------------------------------------------------------------- |
---|
| 2620 | // DimensionExpr |
---|
| 2621 | template< typename pass_type > |
---|
| 2622 | void PassVisitor< pass_type >::visit( DimensionExpr * node ) { |
---|
| 2623 | VISIT_START( node ); |
---|
| 2624 | |
---|
| 2625 | indexerScopedAccept( node->result, *this ); |
---|
| 2626 | |
---|
| 2627 | VISIT_END( node ); |
---|
| 2628 | } |
---|
| 2629 | |
---|
| 2630 | template< typename pass_type > |
---|
| 2631 | void PassVisitor< pass_type >::visit( const DimensionExpr * node ) { |
---|
| 2632 | VISIT_START( node ); |
---|
| 2633 | |
---|
| 2634 | indexerScopedAccept( node->result, *this ); |
---|
| 2635 | |
---|
| 2636 | VISIT_END( node ); |
---|
| 2637 | } |
---|
| 2638 | |
---|
| 2639 | template< typename pass_type > |
---|
| 2640 | Expression * PassVisitor< pass_type >::mutate( DimensionExpr * node ) { |
---|
| 2641 | MUTATE_START( node ); |
---|
| 2642 | |
---|
| 2643 | indexerScopedMutate( node->env , *this ); |
---|
| 2644 | indexerScopedMutate( node->result, *this ); |
---|
| 2645 | |
---|
| 2646 | MUTATE_END( Expression, node ); |
---|
| 2647 | } |
---|
| 2648 | |
---|
[e0886db] | 2649 | //-------------------------------------------------------------------------- |
---|
| 2650 | // AsmExpr |
---|
[13932f14] | 2651 | template< typename pass_type > |
---|
[ab904dc] | 2652 | void PassVisitor< pass_type >::visit( AsmExpr * node ) { |
---|
[e0886db] | 2653 | VISIT_START( node ); |
---|
| 2654 | |
---|
| 2655 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2656 | maybeAccept_impl ( node->constraint, *this ); |
---|
| 2657 | maybeAccept_impl ( node->operand , *this ); |
---|
[e0886db] | 2658 | |
---|
| 2659 | VISIT_END( node ); |
---|
[13932f14] | 2660 | } |
---|
| 2661 | |
---|
[7870799] | 2662 | template< typename pass_type > |
---|
| 2663 | void PassVisitor< pass_type >::visit( const AsmExpr * node ) { |
---|
| 2664 | VISIT_START( node ); |
---|
| 2665 | |
---|
[e3d7f9f] | 2666 | indexerScopedAccept( node->result , *this ); |
---|
| 2667 | maybeAccept_impl ( node->constraint, *this ); |
---|
| 2668 | maybeAccept_impl ( node->operand , *this ); |
---|
[7870799] | 2669 | |
---|
| 2670 | VISIT_END( node ); |
---|
| 2671 | } |
---|
| 2672 | |
---|
[e0886db] | 2673 | template< typename pass_type > |
---|
| 2674 | Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) { |
---|
| 2675 | MUTATE_START( node ); |
---|
| 2676 | |
---|
| 2677 | indexerScopedMutate( node->env , *this ); |
---|
| 2678 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2679 | maybeMutate_impl ( node->constraint, *this ); |
---|
| 2680 | maybeMutate_impl ( node->operand , *this ); |
---|
[e0886db] | 2681 | |
---|
| 2682 | MUTATE_END( Expression, node ); |
---|
| 2683 | } |
---|
| 2684 | |
---|
| 2685 | //-------------------------------------------------------------------------- |
---|
| 2686 | // ImplicitCopyCtorExpr |
---|
[13932f14] | 2687 | template< typename pass_type > |
---|
[ab904dc] | 2688 | void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) { |
---|
[e0886db] | 2689 | VISIT_START( node ); |
---|
| 2690 | |
---|
[2f86ddf] | 2691 | indexerScopedAccept( node->result , *this ); |
---|
| 2692 | maybeAccept_impl ( node->callExpr , *this ); |
---|
[e0886db] | 2693 | |
---|
| 2694 | VISIT_END( node ); |
---|
| 2695 | } |
---|
| 2696 | |
---|
[7870799] | 2697 | template< typename pass_type > |
---|
| 2698 | void PassVisitor< pass_type >::visit( const ImplicitCopyCtorExpr * node ) { |
---|
| 2699 | VISIT_START( node ); |
---|
| 2700 | |
---|
[e3d7f9f] | 2701 | indexerScopedAccept( node->result , *this ); |
---|
| 2702 | maybeAccept_impl ( node->callExpr , *this ); |
---|
[7870799] | 2703 | |
---|
| 2704 | VISIT_END( node ); |
---|
| 2705 | } |
---|
| 2706 | |
---|
[e0886db] | 2707 | template< typename pass_type > |
---|
| 2708 | Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) { |
---|
| 2709 | MUTATE_START( node ); |
---|
| 2710 | |
---|
[2f86ddf] | 2711 | indexerScopedMutate( node->env , *this ); |
---|
| 2712 | indexerScopedMutate( node->result , *this ); |
---|
| 2713 | maybeMutate_impl ( node->callExpr , *this ); |
---|
[e0886db] | 2714 | |
---|
| 2715 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2716 | } |
---|
| 2717 | |
---|
[e0886db] | 2718 | //-------------------------------------------------------------------------- |
---|
| 2719 | // ConstructorExpr |
---|
[13932f14] | 2720 | template< typename pass_type > |
---|
[ab904dc] | 2721 | void PassVisitor< pass_type >::visit( ConstructorExpr * node ) { |
---|
[e0886db] | 2722 | VISIT_START( node ); |
---|
| 2723 | |
---|
| 2724 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2725 | maybeAccept_impl ( node->callExpr, *this ); |
---|
[e0886db] | 2726 | |
---|
| 2727 | VISIT_END( node ); |
---|
| 2728 | } |
---|
| 2729 | |
---|
[7870799] | 2730 | template< typename pass_type > |
---|
| 2731 | void PassVisitor< pass_type >::visit( const ConstructorExpr * node ) { |
---|
| 2732 | VISIT_START( node ); |
---|
| 2733 | |
---|
[e3d7f9f] | 2734 | indexerScopedAccept( node->result , *this ); |
---|
| 2735 | maybeAccept_impl ( node->callExpr, *this ); |
---|
[7870799] | 2736 | |
---|
| 2737 | VISIT_END( node ); |
---|
| 2738 | } |
---|
| 2739 | |
---|
[e0886db] | 2740 | template< typename pass_type > |
---|
| 2741 | Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) { |
---|
| 2742 | MUTATE_START( node ); |
---|
| 2743 | |
---|
| 2744 | indexerScopedMutate( node->env , *this ); |
---|
| 2745 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2746 | maybeMutate_impl ( node->callExpr, *this ); |
---|
[e0886db] | 2747 | |
---|
| 2748 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2749 | } |
---|
| 2750 | |
---|
[e0886db] | 2751 | //-------------------------------------------------------------------------- |
---|
| 2752 | // CompoundLiteralExpr |
---|
[13932f14] | 2753 | template< typename pass_type > |
---|
[ab904dc] | 2754 | void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) { |
---|
[e0886db] | 2755 | VISIT_START( node ); |
---|
| 2756 | |
---|
| 2757 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2758 | maybeAccept_impl ( node->initializer, *this ); |
---|
[e0886db] | 2759 | |
---|
| 2760 | VISIT_END( node ); |
---|
[13932f14] | 2761 | } |
---|
| 2762 | |
---|
[7870799] | 2763 | template< typename pass_type > |
---|
| 2764 | void PassVisitor< pass_type >::visit( const CompoundLiteralExpr * node ) { |
---|
| 2765 | VISIT_START( node ); |
---|
| 2766 | |
---|
[e3d7f9f] | 2767 | indexerScopedAccept( node->result , *this ); |
---|
| 2768 | maybeAccept_impl ( node->initializer, *this ); |
---|
[7870799] | 2769 | |
---|
| 2770 | VISIT_END( node ); |
---|
| 2771 | } |
---|
| 2772 | |
---|
[e0886db] | 2773 | template< typename pass_type > |
---|
| 2774 | Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) { |
---|
| 2775 | MUTATE_START( node ); |
---|
| 2776 | |
---|
| 2777 | indexerScopedMutate( node->env , *this ); |
---|
| 2778 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2779 | maybeMutate_impl ( node->initializer, *this ); |
---|
[e0886db] | 2780 | |
---|
| 2781 | MUTATE_END( Expression, node ); |
---|
| 2782 | } |
---|
| 2783 | |
---|
| 2784 | //-------------------------------------------------------------------------- |
---|
| 2785 | // RangeExpr |
---|
[13932f14] | 2786 | template< typename pass_type > |
---|
[ab904dc] | 2787 | void PassVisitor< pass_type >::visit( RangeExpr * node ) { |
---|
[e0886db] | 2788 | VISIT_START( node ); |
---|
| 2789 | |
---|
| 2790 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2791 | maybeAccept_impl ( node->low , *this ); |
---|
| 2792 | maybeAccept_impl ( node->high , *this ); |
---|
[e0886db] | 2793 | |
---|
| 2794 | VISIT_END( node ); |
---|
[13932f14] | 2795 | } |
---|
| 2796 | |
---|
[7870799] | 2797 | template< typename pass_type > |
---|
| 2798 | void PassVisitor< pass_type >::visit( const RangeExpr * node ) { |
---|
| 2799 | VISIT_START( node ); |
---|
| 2800 | |
---|
[e3d7f9f] | 2801 | indexerScopedAccept( node->result, *this ); |
---|
| 2802 | maybeAccept_impl ( node->low , *this ); |
---|
| 2803 | maybeAccept_impl ( node->high , *this ); |
---|
[7870799] | 2804 | |
---|
| 2805 | VISIT_END( node ); |
---|
| 2806 | } |
---|
| 2807 | |
---|
[e0886db] | 2808 | template< typename pass_type > |
---|
| 2809 | Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) { |
---|
| 2810 | MUTATE_START( node ); |
---|
| 2811 | |
---|
| 2812 | indexerScopedMutate( node->env , *this ); |
---|
| 2813 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2814 | maybeMutate_impl ( node->low , *this ); |
---|
| 2815 | maybeMutate_impl ( node->high , *this ); |
---|
[e0886db] | 2816 | |
---|
| 2817 | MUTATE_END( Expression, node ); |
---|
| 2818 | } |
---|
| 2819 | |
---|
| 2820 | //-------------------------------------------------------------------------- |
---|
| 2821 | // UntypedTupleExpr |
---|
[13932f14] | 2822 | template< typename pass_type > |
---|
[ab904dc] | 2823 | void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) { |
---|
[e0886db] | 2824 | VISIT_START( node ); |
---|
| 2825 | |
---|
| 2826 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2827 | maybeAccept_impl ( node->exprs , *this ); |
---|
[e0886db] | 2828 | |
---|
| 2829 | VISIT_END( node ); |
---|
| 2830 | } |
---|
| 2831 | |
---|
[7870799] | 2832 | template< typename pass_type > |
---|
| 2833 | void PassVisitor< pass_type >::visit( const UntypedTupleExpr * node ) { |
---|
| 2834 | VISIT_START( node ); |
---|
| 2835 | |
---|
[e3d7f9f] | 2836 | indexerScopedAccept( node->result, *this ); |
---|
| 2837 | maybeAccept_impl ( node->exprs , *this ); |
---|
[7870799] | 2838 | |
---|
| 2839 | VISIT_END( node ); |
---|
| 2840 | } |
---|
| 2841 | |
---|
[e0886db] | 2842 | template< typename pass_type > |
---|
| 2843 | Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) { |
---|
| 2844 | MUTATE_START( node ); |
---|
| 2845 | |
---|
| 2846 | indexerScopedMutate( node->env , *this ); |
---|
| 2847 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2848 | maybeMutate_impl ( node->exprs , *this ); |
---|
[e0886db] | 2849 | |
---|
| 2850 | MUTATE_END( Expression, node ); |
---|
| 2851 | } |
---|
| 2852 | |
---|
| 2853 | //-------------------------------------------------------------------------- |
---|
| 2854 | // TupleExpr |
---|
| 2855 | template< typename pass_type > |
---|
| 2856 | void PassVisitor< pass_type >::visit( TupleExpr * node ) { |
---|
| 2857 | VISIT_START( node ); |
---|
| 2858 | |
---|
| 2859 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2860 | maybeAccept_impl ( node->exprs , *this ); |
---|
[e0886db] | 2861 | |
---|
| 2862 | VISIT_END( node ); |
---|
| 2863 | } |
---|
| 2864 | |
---|
[7870799] | 2865 | template< typename pass_type > |
---|
| 2866 | void PassVisitor< pass_type >::visit( const TupleExpr * node ) { |
---|
| 2867 | VISIT_START( node ); |
---|
| 2868 | |
---|
[e3d7f9f] | 2869 | indexerScopedAccept( node->result, *this ); |
---|
| 2870 | maybeAccept_impl ( node->exprs , *this ); |
---|
[7870799] | 2871 | |
---|
| 2872 | VISIT_END( node ); |
---|
| 2873 | } |
---|
| 2874 | |
---|
[e0886db] | 2875 | template< typename pass_type > |
---|
| 2876 | Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) { |
---|
| 2877 | MUTATE_START( node ); |
---|
| 2878 | |
---|
| 2879 | indexerScopedMutate( node->env , *this ); |
---|
| 2880 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2881 | maybeMutate_impl ( node->exprs , *this ); |
---|
[e0886db] | 2882 | |
---|
| 2883 | MUTATE_END( Expression, node ); |
---|
| 2884 | } |
---|
| 2885 | |
---|
| 2886 | //-------------------------------------------------------------------------- |
---|
| 2887 | // TupleIndexExpr |
---|
| 2888 | template< typename pass_type > |
---|
| 2889 | void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) { |
---|
| 2890 | VISIT_START( node ); |
---|
| 2891 | |
---|
| 2892 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2893 | maybeAccept_impl ( node->tuple , *this ); |
---|
[e0886db] | 2894 | |
---|
| 2895 | VISIT_END( node ); |
---|
| 2896 | } |
---|
| 2897 | |
---|
[7870799] | 2898 | template< typename pass_type > |
---|
| 2899 | void PassVisitor< pass_type >::visit( const TupleIndexExpr * node ) { |
---|
| 2900 | VISIT_START( node ); |
---|
| 2901 | |
---|
[e3d7f9f] | 2902 | indexerScopedAccept( node->result, *this ); |
---|
| 2903 | maybeAccept_impl ( node->tuple , *this ); |
---|
[7870799] | 2904 | |
---|
| 2905 | VISIT_END( node ); |
---|
| 2906 | } |
---|
| 2907 | |
---|
[e0886db] | 2908 | template< typename pass_type > |
---|
| 2909 | Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) { |
---|
| 2910 | MUTATE_START( node ); |
---|
| 2911 | |
---|
| 2912 | indexerScopedMutate( node->env , *this ); |
---|
| 2913 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2914 | maybeMutate_impl ( node->tuple , *this ); |
---|
[e0886db] | 2915 | |
---|
| 2916 | MUTATE_END( Expression, node ); |
---|
| 2917 | } |
---|
| 2918 | |
---|
| 2919 | //-------------------------------------------------------------------------- |
---|
| 2920 | // TupleAssignExpr |
---|
| 2921 | template< typename pass_type > |
---|
| 2922 | void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) { |
---|
| 2923 | VISIT_START( node ); |
---|
| 2924 | |
---|
| 2925 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2926 | maybeAccept_impl ( node->stmtExpr, *this ); |
---|
[e0886db] | 2927 | |
---|
| 2928 | VISIT_END( node ); |
---|
[13932f14] | 2929 | } |
---|
| 2930 | |
---|
[7870799] | 2931 | template< typename pass_type > |
---|
| 2932 | void PassVisitor< pass_type >::visit( const TupleAssignExpr * node ) { |
---|
| 2933 | VISIT_START( node ); |
---|
| 2934 | |
---|
[e3d7f9f] | 2935 | indexerScopedAccept( node->result , *this ); |
---|
[7870799] | 2936 | maybeAccept_impl( node->stmtExpr, *this ); |
---|
| 2937 | |
---|
| 2938 | VISIT_END( node ); |
---|
| 2939 | } |
---|
| 2940 | |
---|
[13932f14] | 2941 | template< typename pass_type > |
---|
[e0886db] | 2942 | Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) { |
---|
| 2943 | MUTATE_START( node ); |
---|
[13932f14] | 2944 | |
---|
[e0886db] | 2945 | indexerScopedMutate( node->env , *this ); |
---|
| 2946 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2947 | maybeMutate_impl ( node->stmtExpr, *this ); |
---|
[13932f14] | 2948 | |
---|
[e0886db] | 2949 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2950 | } |
---|
| 2951 | |
---|
[9c1600c] | 2952 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 2953 | // StmtExpr |
---|
[13932f14] | 2954 | template< typename pass_type > |
---|
[ab904dc] | 2955 | void PassVisitor< pass_type >::visit( StmtExpr * node ) { |
---|
[9c1600c] | 2956 | VISIT_START( node ); |
---|
| 2957 | |
---|
| 2958 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
[02fdb8e] | 2959 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
[9c1600c] | 2960 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
| 2961 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
| 2962 | |
---|
[e0886db] | 2963 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2964 | maybeAccept_impl ( node->statements , *this ); |
---|
| 2965 | maybeAccept_impl ( node->returnDecls, *this ); |
---|
| 2966 | maybeAccept_impl ( node->dtors , *this ); |
---|
[9c1600c] | 2967 | |
---|
| 2968 | VISIT_END( node ); |
---|
[13932f14] | 2969 | } |
---|
| 2970 | |
---|
[7870799] | 2971 | template< typename pass_type > |
---|
| 2972 | void PassVisitor< pass_type >::visit( const StmtExpr * node ) { |
---|
| 2973 | VISIT_START( node ); |
---|
| 2974 | |
---|
[e3d7f9f] | 2975 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
| 2976 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
| 2977 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
| 2978 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
| 2979 | |
---|
| 2980 | indexerScopedAccept( node->result , *this ); |
---|
| 2981 | maybeAccept_impl ( node->statements , *this ); |
---|
| 2982 | maybeAccept_impl ( node->returnDecls, *this ); |
---|
| 2983 | maybeAccept_impl ( node->dtors , *this ); |
---|
[7870799] | 2984 | |
---|
| 2985 | VISIT_END( node ); |
---|
| 2986 | } |
---|
| 2987 | |
---|
[296b2be] | 2988 | template< typename pass_type > |
---|
| 2989 | Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) { |
---|
| 2990 | MUTATE_START( node ); |
---|
[4551a6e] | 2991 | |
---|
[296b2be] | 2992 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
[02fdb8e] | 2993 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
[134322e] | 2994 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
| 2995 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
[296b2be] | 2996 | |
---|
[e0886db] | 2997 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2998 | maybeMutate_impl ( node->statements , *this ); |
---|
| 2999 | maybeMutate_impl ( node->returnDecls, *this ); |
---|
| 3000 | maybeMutate_impl ( node->dtors , *this ); |
---|
[296b2be] | 3001 | |
---|
| 3002 | MUTATE_END( Expression, node ); |
---|
| 3003 | } |
---|
| 3004 | |
---|
[e0886db] | 3005 | //-------------------------------------------------------------------------- |
---|
| 3006 | // UniqueExpr |
---|
[13932f14] | 3007 | template< typename pass_type > |
---|
[ab904dc] | 3008 | void PassVisitor< pass_type >::visit( UniqueExpr * node ) { |
---|
[e0886db] | 3009 | VISIT_START( node ); |
---|
| 3010 | |
---|
| 3011 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 3012 | maybeAccept_impl ( node->expr , *this ); |
---|
[e0886db] | 3013 | |
---|
| 3014 | VISIT_END( node ); |
---|
| 3015 | } |
---|
| 3016 | |
---|
[7870799] | 3017 | template< typename pass_type > |
---|
| 3018 | void PassVisitor< pass_type >::visit( const UniqueExpr * node ) { |
---|
| 3019 | VISIT_START( node ); |
---|
| 3020 | |
---|
[e3d7f9f] | 3021 | indexerScopedAccept( node->result, *this ); |
---|
| 3022 | maybeAccept_impl ( node->expr , *this ); |
---|
[7870799] | 3023 | |
---|
| 3024 | VISIT_END( node ); |
---|
| 3025 | } |
---|
| 3026 | |
---|
[e0886db] | 3027 | template< typename pass_type > |
---|
| 3028 | Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) { |
---|
| 3029 | MUTATE_START( node ); |
---|
| 3030 | |
---|
| 3031 | indexerScopedMutate( node->env , *this ); |
---|
| 3032 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 3033 | maybeMutate_impl ( node->expr , *this ); |
---|
[e0886db] | 3034 | |
---|
| 3035 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 3036 | } |
---|
| 3037 | |
---|
[73367a8] | 3038 | //-------------------------------------------------------------------------- |
---|
| 3039 | // UntypedInitExpr |
---|
| 3040 | template< typename pass_type > |
---|
| 3041 | void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) { |
---|
| 3042 | VISIT_START( node ); |
---|
| 3043 | |
---|
| 3044 | indexerScopedAccept( node->result, *this ); |
---|
| 3045 | maybeAccept_impl ( node->expr , *this ); |
---|
| 3046 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
| 3047 | |
---|
| 3048 | VISIT_END( node ); |
---|
| 3049 | } |
---|
| 3050 | |
---|
[7870799] | 3051 | template< typename pass_type > |
---|
| 3052 | void PassVisitor< pass_type >::visit( const UntypedInitExpr * node ) { |
---|
| 3053 | VISIT_START( node ); |
---|
| 3054 | |
---|
[e3d7f9f] | 3055 | indexerScopedAccept( node->result, *this ); |
---|
| 3056 | maybeAccept_impl ( node->expr , *this ); |
---|
[7870799] | 3057 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
| 3058 | |
---|
| 3059 | VISIT_END( node ); |
---|
| 3060 | } |
---|
| 3061 | |
---|
[73367a8] | 3062 | template< typename pass_type > |
---|
| 3063 | Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) { |
---|
| 3064 | MUTATE_START( node ); |
---|
| 3065 | |
---|
| 3066 | indexerScopedMutate( node->env , *this ); |
---|
| 3067 | indexerScopedMutate( node->result, *this ); |
---|
| 3068 | maybeMutate_impl ( node->expr , *this ); |
---|
| 3069 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
| 3070 | |
---|
| 3071 | MUTATE_END( Expression, node ); |
---|
| 3072 | } |
---|
| 3073 | |
---|
| 3074 | //-------------------------------------------------------------------------- |
---|
| 3075 | // InitExpr |
---|
| 3076 | template< typename pass_type > |
---|
| 3077 | void PassVisitor< pass_type >::visit( InitExpr * node ) { |
---|
| 3078 | VISIT_START( node ); |
---|
| 3079 | |
---|
| 3080 | indexerScopedAccept( node->result, *this ); |
---|
| 3081 | maybeAccept_impl ( node->expr , *this ); |
---|
| 3082 | maybeAccept_impl ( node->designation, *this ); |
---|
| 3083 | |
---|
| 3084 | VISIT_END( node ); |
---|
| 3085 | } |
---|
| 3086 | |
---|
[7870799] | 3087 | template< typename pass_type > |
---|
| 3088 | void PassVisitor< pass_type >::visit( const InitExpr * node ) { |
---|
| 3089 | VISIT_START( node ); |
---|
| 3090 | |
---|
[e3d7f9f] | 3091 | indexerScopedAccept( node->result, *this ); |
---|
| 3092 | maybeAccept_impl ( node->expr , *this ); |
---|
| 3093 | maybeAccept_impl ( node->designation, *this ); |
---|
[7870799] | 3094 | |
---|
| 3095 | VISIT_END( node ); |
---|
| 3096 | } |
---|
| 3097 | |
---|
[73367a8] | 3098 | template< typename pass_type > |
---|
| 3099 | Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) { |
---|
| 3100 | MUTATE_START( node ); |
---|
| 3101 | |
---|
| 3102 | indexerScopedMutate( node->env , *this ); |
---|
| 3103 | indexerScopedMutate( node->result, *this ); |
---|
| 3104 | maybeMutate_impl ( node->expr , *this ); |
---|
| 3105 | maybeMutate_impl ( node->designation, *this ); |
---|
| 3106 | |
---|
| 3107 | MUTATE_END( Expression, node ); |
---|
| 3108 | } |
---|
| 3109 | |
---|
[44b4114] | 3110 | //-------------------------------------------------------------------------- |
---|
| 3111 | // DeletedExpr |
---|
| 3112 | template< typename pass_type > |
---|
| 3113 | void PassVisitor< pass_type >::visit( DeletedExpr * node ) { |
---|
| 3114 | VISIT_START( node ); |
---|
| 3115 | |
---|
| 3116 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 3117 | maybeAccept_impl ( node->expr, *this ); |
---|
[44b4114] | 3118 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. |
---|
| 3119 | |
---|
| 3120 | VISIT_END( node ); |
---|
| 3121 | } |
---|
| 3122 | |
---|
[7870799] | 3123 | template< typename pass_type > |
---|
| 3124 | void PassVisitor< pass_type >::visit( const DeletedExpr * node ) { |
---|
| 3125 | VISIT_START( node ); |
---|
| 3126 | |
---|
[e3d7f9f] | 3127 | indexerScopedAccept( node->result, *this ); |
---|
| 3128 | maybeAccept_impl ( node->expr, *this ); |
---|
[7870799] | 3129 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. |
---|
| 3130 | |
---|
| 3131 | VISIT_END( node ); |
---|
| 3132 | } |
---|
| 3133 | |
---|
[44b4114] | 3134 | template< typename pass_type > |
---|
| 3135 | Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) { |
---|
| 3136 | MUTATE_START( node ); |
---|
| 3137 | |
---|
| 3138 | indexerScopedMutate( node->env, *this ); |
---|
| 3139 | indexerScopedMutate( node->result, *this ); |
---|
| 3140 | maybeMutate_impl( node->expr, *this ); |
---|
| 3141 | |
---|
| 3142 | MUTATE_END( Expression, node ); |
---|
| 3143 | } |
---|
| 3144 | |
---|
[0f79853] | 3145 | //-------------------------------------------------------------------------- |
---|
| 3146 | // DefaultArgExpr |
---|
| 3147 | template< typename pass_type > |
---|
| 3148 | void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) { |
---|
| 3149 | VISIT_START( node ); |
---|
| 3150 | |
---|
| 3151 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 3152 | maybeAccept_impl ( node->expr, *this ); |
---|
[0f79853] | 3153 | |
---|
| 3154 | VISIT_END( node ); |
---|
| 3155 | } |
---|
| 3156 | |
---|
[7870799] | 3157 | template< typename pass_type > |
---|
| 3158 | void PassVisitor< pass_type >::visit( const DefaultArgExpr * node ) { |
---|
| 3159 | VISIT_START( node ); |
---|
| 3160 | |
---|
[e3d7f9f] | 3161 | indexerScopedAccept( node->result, *this ); |
---|
| 3162 | maybeAccept_impl ( node->expr, *this ); |
---|
[7870799] | 3163 | |
---|
| 3164 | VISIT_END( node ); |
---|
| 3165 | } |
---|
| 3166 | |
---|
[0f79853] | 3167 | template< typename pass_type > |
---|
| 3168 | Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) { |
---|
| 3169 | MUTATE_START( node ); |
---|
| 3170 | |
---|
| 3171 | indexerScopedMutate( node->env, *this ); |
---|
| 3172 | indexerScopedMutate( node->result, *this ); |
---|
| 3173 | maybeMutate_impl( node->expr, *this ); |
---|
| 3174 | |
---|
| 3175 | MUTATE_END( Expression, node ); |
---|
| 3176 | } |
---|
| 3177 | |
---|
[d807ca28] | 3178 | //-------------------------------------------------------------------------- |
---|
| 3179 | // GenericExpr |
---|
| 3180 | template< typename pass_type > |
---|
| 3181 | void PassVisitor< pass_type >::visit( GenericExpr * node ) { |
---|
| 3182 | VISIT_START( node ); |
---|
| 3183 | |
---|
| 3184 | indexerScopedAccept( node->result, *this ); |
---|
| 3185 | maybeAccept_impl( node->control, *this ); |
---|
| 3186 | for ( GenericExpr::Association & assoc : node->associations ) { |
---|
| 3187 | indexerScopedAccept( assoc.type, *this ); |
---|
| 3188 | maybeAccept_impl( assoc.expr, *this ); |
---|
| 3189 | } |
---|
| 3190 | |
---|
| 3191 | VISIT_END( node ); |
---|
| 3192 | } |
---|
| 3193 | |
---|
[7870799] | 3194 | template< typename pass_type > |
---|
| 3195 | void PassVisitor< pass_type >::visit( const GenericExpr * node ) { |
---|
| 3196 | VISIT_START( node ); |
---|
| 3197 | |
---|
[e3d7f9f] | 3198 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 3199 | maybeAccept_impl( node->control, *this ); |
---|
| 3200 | for ( const GenericExpr::Association & assoc : node->associations ) { |
---|
[e3d7f9f] | 3201 | indexerScopedAccept( assoc.type, *this ); |
---|
[7870799] | 3202 | maybeAccept_impl( assoc.expr, *this ); |
---|
| 3203 | } |
---|
| 3204 | |
---|
| 3205 | VISIT_END( node ); |
---|
| 3206 | } |
---|
| 3207 | |
---|
[d807ca28] | 3208 | template< typename pass_type > |
---|
| 3209 | Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) { |
---|
| 3210 | MUTATE_START( node ); |
---|
| 3211 | |
---|
| 3212 | indexerScopedMutate( node->env, *this ); |
---|
| 3213 | indexerScopedMutate( node->result, *this ); |
---|
| 3214 | maybeMutate_impl( node->control, *this ); |
---|
| 3215 | for ( GenericExpr::Association & assoc : node->associations ) { |
---|
| 3216 | indexerScopedMutate( assoc.type, *this ); |
---|
| 3217 | maybeMutate_impl( assoc.expr, *this ); |
---|
| 3218 | } |
---|
| 3219 | |
---|
| 3220 | MUTATE_END( Expression, node ); |
---|
| 3221 | } |
---|
| 3222 | |
---|
[17fc7a5] | 3223 | //-------------------------------------------------------------------------- |
---|
| 3224 | // VoidType |
---|
[13932f14] | 3225 | template< typename pass_type > |
---|
[ab904dc] | 3226 | void PassVisitor< pass_type >::visit( VoidType * node ) { |
---|
[599fbb6] | 3227 | VISIT_START( node ); |
---|
| 3228 | |
---|
| 3229 | maybeAccept_impl( node->forall, *this ); |
---|
| 3230 | |
---|
| 3231 | VISIT_END( node ); |
---|
| 3232 | } |
---|
| 3233 | |
---|
[7870799] | 3234 | template< typename pass_type > |
---|
| 3235 | void PassVisitor< pass_type >::visit( const VoidType * node ) { |
---|
| 3236 | VISIT_START( node ); |
---|
| 3237 | |
---|
| 3238 | maybeAccept_impl( node->forall, *this ); |
---|
| 3239 | |
---|
| 3240 | VISIT_END( node ); |
---|
| 3241 | } |
---|
| 3242 | |
---|
[599fbb6] | 3243 | template< typename pass_type > |
---|
| 3244 | Type * PassVisitor< pass_type >::mutate( VoidType * node ) { |
---|
| 3245 | MUTATE_START( node ); |
---|
| 3246 | |
---|
| 3247 | maybeMutate_impl( node->forall, *this ); |
---|
| 3248 | |
---|
| 3249 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3250 | } |
---|
| 3251 | |
---|
[17fc7a5] | 3252 | //-------------------------------------------------------------------------- |
---|
| 3253 | // BasicType |
---|
[13932f14] | 3254 | template< typename pass_type > |
---|
[ab904dc] | 3255 | void PassVisitor< pass_type >::visit( BasicType * node ) { |
---|
[17fc7a5] | 3256 | VISIT_START( node ); |
---|
| 3257 | |
---|
| 3258 | maybeAccept_impl( node->forall, *this ); |
---|
| 3259 | |
---|
| 3260 | VISIT_END( node ); |
---|
| 3261 | } |
---|
| 3262 | |
---|
[7870799] | 3263 | template< typename pass_type > |
---|
| 3264 | void PassVisitor< pass_type >::visit( const BasicType * node ) { |
---|
| 3265 | VISIT_START( node ); |
---|
| 3266 | |
---|
| 3267 | maybeAccept_impl( node->forall, *this ); |
---|
| 3268 | |
---|
| 3269 | VISIT_END( node ); |
---|
| 3270 | } |
---|
| 3271 | |
---|
[17fc7a5] | 3272 | template< typename pass_type > |
---|
| 3273 | Type * PassVisitor< pass_type >::mutate( BasicType * node ) { |
---|
| 3274 | MUTATE_START( node ); |
---|
| 3275 | |
---|
| 3276 | maybeMutate_impl( node->forall, *this ); |
---|
| 3277 | |
---|
| 3278 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3279 | } |
---|
| 3280 | |
---|
[17fc7a5] | 3281 | //-------------------------------------------------------------------------- |
---|
| 3282 | // PointerType |
---|
[13932f14] | 3283 | template< typename pass_type > |
---|
[ab904dc] | 3284 | void PassVisitor< pass_type >::visit( PointerType * node ) { |
---|
[17fc7a5] | 3285 | VISIT_START( node ); |
---|
| 3286 | |
---|
| 3287 | maybeAccept_impl( node->forall, *this ); |
---|
[6e50a6b] | 3288 | maybeAccept_impl( node->dimension, *this ); |
---|
[17fc7a5] | 3289 | maybeAccept_impl( node->base, *this ); |
---|
| 3290 | |
---|
| 3291 | VISIT_END( node ); |
---|
[13932f14] | 3292 | } |
---|
| 3293 | |
---|
[7870799] | 3294 | template< typename pass_type > |
---|
| 3295 | void PassVisitor< pass_type >::visit( const PointerType * node ) { |
---|
| 3296 | VISIT_START( node ); |
---|
| 3297 | |
---|
| 3298 | maybeAccept_impl( node->forall, *this ); |
---|
[6e50a6b] | 3299 | maybeAccept_impl( node->dimension, *this ); |
---|
[7870799] | 3300 | maybeAccept_impl( node->base, *this ); |
---|
| 3301 | |
---|
| 3302 | VISIT_END( node ); |
---|
| 3303 | } |
---|
| 3304 | |
---|
[17fc7a5] | 3305 | template< typename pass_type > |
---|
| 3306 | Type * PassVisitor< pass_type >::mutate( PointerType * node ) { |
---|
| 3307 | MUTATE_START( node ); |
---|
| 3308 | |
---|
| 3309 | maybeMutate_impl( node->forall, *this ); |
---|
[6e50a6b] | 3310 | maybeMutate_impl( node->dimension, *this ); |
---|
[17fc7a5] | 3311 | maybeMutate_impl( node->base, *this ); |
---|
| 3312 | |
---|
| 3313 | MUTATE_END( Type, node ); |
---|
| 3314 | } |
---|
| 3315 | |
---|
| 3316 | //-------------------------------------------------------------------------- |
---|
| 3317 | // ArrayType |
---|
[13932f14] | 3318 | template< typename pass_type > |
---|
[ab904dc] | 3319 | void PassVisitor< pass_type >::visit( ArrayType * node ) { |
---|
[17fc7a5] | 3320 | VISIT_START( node ); |
---|
| 3321 | |
---|
| 3322 | maybeAccept_impl( node->forall, *this ); |
---|
| 3323 | maybeAccept_impl( node->dimension, *this ); |
---|
| 3324 | maybeAccept_impl( node->base, *this ); |
---|
| 3325 | |
---|
| 3326 | VISIT_END( node ); |
---|
[13932f14] | 3327 | } |
---|
| 3328 | |
---|
[7870799] | 3329 | template< typename pass_type > |
---|
| 3330 | void PassVisitor< pass_type >::visit( const ArrayType * node ) { |
---|
| 3331 | VISIT_START( node ); |
---|
| 3332 | |
---|
| 3333 | maybeAccept_impl( node->forall, *this ); |
---|
| 3334 | maybeAccept_impl( node->dimension, *this ); |
---|
| 3335 | maybeAccept_impl( node->base, *this ); |
---|
| 3336 | |
---|
| 3337 | VISIT_END( node ); |
---|
| 3338 | } |
---|
| 3339 | |
---|
[17fc7a5] | 3340 | template< typename pass_type > |
---|
| 3341 | Type * PassVisitor< pass_type >::mutate( ArrayType * node ) { |
---|
| 3342 | MUTATE_START( node ); |
---|
| 3343 | |
---|
| 3344 | maybeMutate_impl( node->forall, *this ); |
---|
| 3345 | maybeMutate_impl( node->dimension, *this ); |
---|
| 3346 | maybeMutate_impl( node->base, *this ); |
---|
| 3347 | |
---|
| 3348 | MUTATE_END( Type, node ); |
---|
| 3349 | } |
---|
| 3350 | |
---|
| 3351 | //-------------------------------------------------------------------------- |
---|
| 3352 | // ReferenceType |
---|
[6b9b047] | 3353 | template< typename pass_type > |
---|
| 3354 | void PassVisitor< pass_type >::visit( ReferenceType * node ) { |
---|
[17fc7a5] | 3355 | VISIT_START( node ); |
---|
| 3356 | |
---|
| 3357 | maybeAccept_impl( node->forall, *this ); |
---|
| 3358 | maybeAccept_impl( node->base, *this ); |
---|
| 3359 | |
---|
| 3360 | VISIT_END( node ); |
---|
| 3361 | } |
---|
| 3362 | |
---|
[7870799] | 3363 | template< typename pass_type > |
---|
| 3364 | void PassVisitor< pass_type >::visit( const ReferenceType * node ) { |
---|
| 3365 | VISIT_START( node ); |
---|
| 3366 | |
---|
| 3367 | maybeAccept_impl( node->forall, *this ); |
---|
| 3368 | maybeAccept_impl( node->base, *this ); |
---|
| 3369 | |
---|
| 3370 | VISIT_END( node ); |
---|
| 3371 | } |
---|
| 3372 | |
---|
[17fc7a5] | 3373 | template< typename pass_type > |
---|
| 3374 | Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) { |
---|
| 3375 | MUTATE_START( node ); |
---|
| 3376 | |
---|
| 3377 | maybeMutate_impl( node->forall, *this ); |
---|
| 3378 | maybeMutate_impl( node->base, *this ); |
---|
| 3379 | |
---|
| 3380 | MUTATE_END( Type, node ); |
---|
[6b9b047] | 3381 | } |
---|
| 3382 | |
---|
[c5d7701] | 3383 | //-------------------------------------------------------------------------- |
---|
| 3384 | // QualifiedType |
---|
| 3385 | template< typename pass_type > |
---|
| 3386 | void PassVisitor< pass_type >::visit( QualifiedType * node ) { |
---|
| 3387 | VISIT_START( node ); |
---|
| 3388 | |
---|
| 3389 | maybeAccept_impl( node->forall, *this ); |
---|
[c194661] | 3390 | maybeAccept_impl( node->parent, *this ); |
---|
| 3391 | maybeAccept_impl( node->child, *this ); |
---|
[c5d7701] | 3392 | |
---|
| 3393 | VISIT_END( node ); |
---|
| 3394 | } |
---|
| 3395 | |
---|
[7870799] | 3396 | template< typename pass_type > |
---|
| 3397 | void PassVisitor< pass_type >::visit( const QualifiedType * node ) { |
---|
| 3398 | VISIT_START( node ); |
---|
| 3399 | |
---|
| 3400 | maybeAccept_impl( node->forall, *this ); |
---|
| 3401 | maybeAccept_impl( node->parent, *this ); |
---|
| 3402 | maybeAccept_impl( node->child, *this ); |
---|
| 3403 | |
---|
| 3404 | VISIT_END( node ); |
---|
| 3405 | } |
---|
| 3406 | |
---|
[c5d7701] | 3407 | template< typename pass_type > |
---|
| 3408 | Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) { |
---|
| 3409 | MUTATE_START( node ); |
---|
| 3410 | |
---|
| 3411 | maybeMutate_impl( node->forall, *this ); |
---|
[c194661] | 3412 | maybeMutate_impl( node->parent, *this ); |
---|
| 3413 | maybeMutate_impl( node->child, *this ); |
---|
[c5d7701] | 3414 | |
---|
| 3415 | MUTATE_END( Type, node ); |
---|
| 3416 | } |
---|
| 3417 | |
---|
[17fc7a5] | 3418 | //-------------------------------------------------------------------------- |
---|
| 3419 | // FunctionType |
---|
[13932f14] | 3420 | template< typename pass_type > |
---|
[ab904dc] | 3421 | void PassVisitor< pass_type >::visit( FunctionType * node ) { |
---|
[17fc7a5] | 3422 | VISIT_START( node ); |
---|
| 3423 | |
---|
| 3424 | maybeAccept_impl( node->forall, *this ); |
---|
| 3425 | maybeAccept_impl( node->returnVals, *this ); |
---|
| 3426 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3427 | |
---|
| 3428 | VISIT_END( node ); |
---|
| 3429 | } |
---|
| 3430 | |
---|
[7870799] | 3431 | template< typename pass_type > |
---|
| 3432 | void PassVisitor< pass_type >::visit( const FunctionType * node ) { |
---|
| 3433 | VISIT_START( node ); |
---|
| 3434 | |
---|
| 3435 | maybeAccept_impl( node->forall, *this ); |
---|
| 3436 | maybeAccept_impl( node->returnVals, *this ); |
---|
| 3437 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3438 | |
---|
| 3439 | VISIT_END( node ); |
---|
| 3440 | } |
---|
| 3441 | |
---|
[17fc7a5] | 3442 | template< typename pass_type > |
---|
| 3443 | Type * PassVisitor< pass_type >::mutate( FunctionType * node ) { |
---|
| 3444 | MUTATE_START( node ); |
---|
| 3445 | |
---|
| 3446 | maybeMutate_impl( node->forall, *this ); |
---|
| 3447 | maybeMutate_impl( node->returnVals, *this ); |
---|
| 3448 | maybeMutate_impl( node->parameters, *this ); |
---|
| 3449 | |
---|
| 3450 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3451 | } |
---|
| 3452 | |
---|
[e0886db] | 3453 | //-------------------------------------------------------------------------- |
---|
| 3454 | // StructInstType |
---|
[13932f14] | 3455 | template< typename pass_type > |
---|
[ab904dc] | 3456 | void PassVisitor< pass_type >::visit( StructInstType * node ) { |
---|
[e0886db] | 3457 | VISIT_START( node ); |
---|
| 3458 | |
---|
| 3459 | indexerAddStruct( node->name ); |
---|
| 3460 | |
---|
| 3461 | { |
---|
| 3462 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3463 | maybeAccept_impl( node->forall , *this ); |
---|
| 3464 | maybeAccept_impl( node->parameters, *this ); |
---|
[e0886db] | 3465 | } |
---|
| 3466 | |
---|
| 3467 | VISIT_END( node ); |
---|
| 3468 | } |
---|
| 3469 | |
---|
[7870799] | 3470 | template< typename pass_type > |
---|
| 3471 | void PassVisitor< pass_type >::visit( const StructInstType * node ) { |
---|
| 3472 | VISIT_START( node ); |
---|
| 3473 | |
---|
[e3d7f9f] | 3474 | indexerAddStruct( node->name ); |
---|
| 3475 | |
---|
| 3476 | { |
---|
| 3477 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 3478 | maybeAccept_impl( node->forall , *this ); |
---|
| 3479 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3480 | } |
---|
[7870799] | 3481 | |
---|
| 3482 | VISIT_END( node ); |
---|
| 3483 | } |
---|
| 3484 | |
---|
[e0886db] | 3485 | template< typename pass_type > |
---|
| 3486 | Type * PassVisitor< pass_type >::mutate( StructInstType * node ) { |
---|
| 3487 | MUTATE_START( node ); |
---|
| 3488 | |
---|
| 3489 | indexerAddStruct( node->name ); |
---|
| 3490 | |
---|
| 3491 | { |
---|
| 3492 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3493 | maybeMutate_impl( node->forall , *this ); |
---|
| 3494 | maybeMutate_impl( node->parameters, *this ); |
---|
[e0886db] | 3495 | } |
---|
| 3496 | |
---|
| 3497 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3498 | } |
---|
| 3499 | |
---|
[e0886db] | 3500 | //-------------------------------------------------------------------------- |
---|
| 3501 | // UnionInstType |
---|
[13932f14] | 3502 | template< typename pass_type > |
---|
[ab904dc] | 3503 | void PassVisitor< pass_type >::visit( UnionInstType * node ) { |
---|
[e0886db] | 3504 | VISIT_START( node ); |
---|
| 3505 | |
---|
[74e3263] | 3506 | indexerAddUnion( node->name ); |
---|
[e0886db] | 3507 | |
---|
| 3508 | { |
---|
| 3509 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3510 | maybeAccept_impl( node->forall , *this ); |
---|
| 3511 | maybeAccept_impl( node->parameters, *this ); |
---|
[e0886db] | 3512 | } |
---|
| 3513 | |
---|
| 3514 | VISIT_END( node ); |
---|
| 3515 | } |
---|
| 3516 | |
---|
[7870799] | 3517 | template< typename pass_type > |
---|
| 3518 | void PassVisitor< pass_type >::visit( const UnionInstType * node ) { |
---|
| 3519 | VISIT_START( node ); |
---|
| 3520 | |
---|
[74e3263] | 3521 | indexerAddUnion( node->name ); |
---|
[e3d7f9f] | 3522 | |
---|
| 3523 | { |
---|
| 3524 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 3525 | maybeAccept_impl( node->forall , *this ); |
---|
| 3526 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3527 | } |
---|
[7870799] | 3528 | |
---|
| 3529 | VISIT_END( node ); |
---|
| 3530 | } |
---|
| 3531 | |
---|
[e0886db] | 3532 | template< typename pass_type > |
---|
| 3533 | Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) { |
---|
| 3534 | MUTATE_START( node ); |
---|
| 3535 | |
---|
[74e3263] | 3536 | indexerAddUnion( node->name ); |
---|
[e0886db] | 3537 | |
---|
| 3538 | { |
---|
| 3539 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3540 | maybeMutate_impl( node->forall , *this ); |
---|
| 3541 | maybeMutate_impl( node->parameters, *this ); |
---|
[e0886db] | 3542 | } |
---|
| 3543 | |
---|
| 3544 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3545 | } |
---|
| 3546 | |
---|
[e0886db] | 3547 | //-------------------------------------------------------------------------- |
---|
| 3548 | // EnumInstType |
---|
[13932f14] | 3549 | template< typename pass_type > |
---|
[ab904dc] | 3550 | void PassVisitor< pass_type >::visit( EnumInstType * node ) { |
---|
[86e84e4] | 3551 | VISIT_START( node ); |
---|
| 3552 | |
---|
| 3553 | maybeAccept_impl( node->forall, *this ); |
---|
| 3554 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3555 | |
---|
| 3556 | VISIT_END( node ); |
---|
[13932f14] | 3557 | } |
---|
| 3558 | |
---|
[7870799] | 3559 | template< typename pass_type > |
---|
| 3560 | void PassVisitor< pass_type >::visit( const EnumInstType * node ) { |
---|
| 3561 | VISIT_START( node ); |
---|
| 3562 | |
---|
| 3563 | maybeAccept_impl( node->forall, *this ); |
---|
| 3564 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3565 | |
---|
| 3566 | VISIT_END( node ); |
---|
| 3567 | } |
---|
| 3568 | |
---|
[e0886db] | 3569 | template< typename pass_type > |
---|
| 3570 | Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) { |
---|
[86e84e4] | 3571 | MUTATE_START( node ); |
---|
| 3572 | |
---|
| 3573 | maybeMutate_impl( node->forall, *this ); |
---|
| 3574 | maybeMutate_impl( node->parameters, *this ); |
---|
| 3575 | |
---|
| 3576 | MUTATE_END( Type, node ); |
---|
[e0886db] | 3577 | } |
---|
| 3578 | |
---|
| 3579 | //-------------------------------------------------------------------------- |
---|
| 3580 | // TraitInstType |
---|
[13932f14] | 3581 | template< typename pass_type > |
---|
[ab904dc] | 3582 | void PassVisitor< pass_type >::visit( TraitInstType * node ) { |
---|
[e0886db] | 3583 | VISIT_START( node ); |
---|
| 3584 | |
---|
[3c398b6] | 3585 | maybeAccept_impl( node->forall , *this ); |
---|
| 3586 | maybeAccept_impl( node->parameters, *this ); |
---|
[e0886db] | 3587 | |
---|
| 3588 | VISIT_END( node ); |
---|
| 3589 | } |
---|
| 3590 | |
---|
[7870799] | 3591 | template< typename pass_type > |
---|
| 3592 | void PassVisitor< pass_type >::visit( const TraitInstType * node ) { |
---|
| 3593 | VISIT_START( node ); |
---|
| 3594 | |
---|
| 3595 | maybeAccept_impl( node->forall , *this ); |
---|
| 3596 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3597 | |
---|
| 3598 | VISIT_END( node ); |
---|
| 3599 | } |
---|
| 3600 | |
---|
[e0886db] | 3601 | template< typename pass_type > |
---|
| 3602 | Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) { |
---|
| 3603 | MUTATE_START( node ); |
---|
| 3604 | |
---|
[3c398b6] | 3605 | maybeMutate_impl( node->forall , *this ); |
---|
| 3606 | maybeMutate_impl( node->parameters, *this ); |
---|
[e0886db] | 3607 | |
---|
| 3608 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3609 | } |
---|
| 3610 | |
---|
[e0886db] | 3611 | //-------------------------------------------------------------------------- |
---|
| 3612 | // TypeInstType |
---|
[13932f14] | 3613 | template< typename pass_type > |
---|
[ab904dc] | 3614 | void PassVisitor< pass_type >::visit( TypeInstType * node ) { |
---|
[86e84e4] | 3615 | VISIT_START( node ); |
---|
| 3616 | |
---|
| 3617 | maybeAccept_impl( node->forall , *this ); |
---|
| 3618 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3619 | |
---|
| 3620 | VISIT_END( node ); |
---|
| 3621 | } |
---|
| 3622 | |
---|
[7870799] | 3623 | template< typename pass_type > |
---|
| 3624 | void PassVisitor< pass_type >::visit( const TypeInstType * node ) { |
---|
| 3625 | VISIT_START( node ); |
---|
| 3626 | |
---|
| 3627 | maybeAccept_impl( node->forall , *this ); |
---|
| 3628 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3629 | |
---|
| 3630 | VISIT_END( node ); |
---|
| 3631 | } |
---|
| 3632 | |
---|
[86e84e4] | 3633 | template< typename pass_type > |
---|
| 3634 | Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) { |
---|
| 3635 | MUTATE_START( node ); |
---|
| 3636 | |
---|
| 3637 | maybeMutate_impl( node->forall , *this ); |
---|
| 3638 | maybeMutate_impl( node->parameters, *this ); |
---|
| 3639 | |
---|
| 3640 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3641 | } |
---|
| 3642 | |
---|
[a8a2b0a] | 3643 | //-------------------------------------------------------------------------- |
---|
| 3644 | // TupleType |
---|
[13932f14] | 3645 | template< typename pass_type > |
---|
[ab904dc] | 3646 | void PassVisitor< pass_type >::visit( TupleType * node ) { |
---|
[a8a2b0a] | 3647 | VISIT_START( node ); |
---|
| 3648 | |
---|
| 3649 | maybeAccept_impl( node->forall, *this ); |
---|
| 3650 | maybeAccept_impl( node->types, *this ); |
---|
| 3651 | maybeAccept_impl( node->members, *this ); |
---|
| 3652 | |
---|
| 3653 | VISIT_END( node ); |
---|
[13932f14] | 3654 | } |
---|
| 3655 | |
---|
[7870799] | 3656 | template< typename pass_type > |
---|
| 3657 | void PassVisitor< pass_type >::visit( const TupleType * node ) { |
---|
| 3658 | VISIT_START( node ); |
---|
| 3659 | |
---|
| 3660 | maybeAccept_impl( node->forall, *this ); |
---|
| 3661 | maybeAccept_impl( node->types, *this ); |
---|
| 3662 | maybeAccept_impl( node->members, *this ); |
---|
| 3663 | |
---|
| 3664 | VISIT_END( node ); |
---|
| 3665 | } |
---|
| 3666 | |
---|
[a8a2b0a] | 3667 | template< typename pass_type > |
---|
| 3668 | Type * PassVisitor< pass_type >::mutate( TupleType * node ) { |
---|
| 3669 | MUTATE_START( node ); |
---|
| 3670 | |
---|
| 3671 | maybeMutate_impl( node->forall, *this ); |
---|
| 3672 | maybeMutate_impl( node->types, *this ); |
---|
| 3673 | maybeMutate_impl( node->members, *this ); |
---|
| 3674 | |
---|
| 3675 | MUTATE_END( Type, node ); |
---|
| 3676 | } |
---|
| 3677 | |
---|
| 3678 | //-------------------------------------------------------------------------- |
---|
| 3679 | // TypeofType |
---|
[13932f14] | 3680 | template< typename pass_type > |
---|
[ab904dc] | 3681 | void PassVisitor< pass_type >::visit( TypeofType * node ) { |
---|
[a8a2b0a] | 3682 | VISIT_START( node ); |
---|
| 3683 | |
---|
| 3684 | assert( node->expr ); |
---|
| 3685 | maybeAccept_impl( node->expr, *this ); |
---|
| 3686 | |
---|
| 3687 | VISIT_END( node ); |
---|
[13932f14] | 3688 | } |
---|
| 3689 | |
---|
[7870799] | 3690 | template< typename pass_type > |
---|
| 3691 | void PassVisitor< pass_type >::visit( const TypeofType * node ) { |
---|
| 3692 | VISIT_START( node ); |
---|
| 3693 | |
---|
| 3694 | assert( node->expr ); |
---|
| 3695 | maybeAccept_impl( node->expr, *this ); |
---|
| 3696 | |
---|
| 3697 | VISIT_END( node ); |
---|
| 3698 | } |
---|
| 3699 | |
---|
[a8a2b0a] | 3700 | template< typename pass_type > |
---|
| 3701 | Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { |
---|
| 3702 | MUTATE_START( node ); |
---|
| 3703 | |
---|
| 3704 | assert( node->expr ); |
---|
| 3705 | maybeMutate_impl( node->expr, *this ); |
---|
| 3706 | |
---|
| 3707 | MUTATE_END( Type, node ); |
---|
| 3708 | } |
---|
| 3709 | |
---|
[7ff35e0e] | 3710 | //-------------------------------------------------------------------------- |
---|
| 3711 | // VTableType |
---|
| 3712 | template< typename pass_type > |
---|
| 3713 | void PassVisitor< pass_type >::visit( VTableType * node ) { |
---|
| 3714 | VISIT_START( node ); |
---|
| 3715 | |
---|
| 3716 | // Forall qualifiers should be on base type, not here |
---|
| 3717 | // maybeAccept_impl( node->forall, *this ); |
---|
| 3718 | maybeAccept_impl( node->base, *this ); |
---|
| 3719 | |
---|
| 3720 | VISIT_END( node ); |
---|
| 3721 | } |
---|
| 3722 | |
---|
| 3723 | template< typename pass_type > |
---|
| 3724 | void PassVisitor< pass_type >::visit( const VTableType * node ) { |
---|
| 3725 | VISIT_START( node ); |
---|
| 3726 | |
---|
| 3727 | // Forall qualifiers should be on base type, not here |
---|
| 3728 | // maybeAccept_impl( node->forall, *this ); |
---|
| 3729 | maybeAccept_impl( node->base, *this ); |
---|
| 3730 | |
---|
| 3731 | VISIT_END( node ); |
---|
| 3732 | } |
---|
| 3733 | |
---|
| 3734 | template< typename pass_type > |
---|
| 3735 | Type * PassVisitor< pass_type >::mutate( VTableType * node ) { |
---|
| 3736 | MUTATE_START( node ); |
---|
| 3737 | |
---|
| 3738 | // Forall qualifiers should be on base type, not here |
---|
| 3739 | // maybeMutate_impl( node->forall, *this ); |
---|
| 3740 | maybeMutate_impl( node->base, *this ); |
---|
| 3741 | |
---|
| 3742 | MUTATE_END( Type, node ); |
---|
| 3743 | } |
---|
| 3744 | |
---|
[a8a2b0a] | 3745 | //-------------------------------------------------------------------------- |
---|
| 3746 | // AttrType |
---|
[13932f14] | 3747 | template< typename pass_type > |
---|
[ab904dc] | 3748 | void PassVisitor< pass_type >::visit( AttrType * node ) { |
---|
[a8a2b0a] | 3749 | VISIT_START( node ); |
---|
| 3750 | |
---|
| 3751 | if ( node->isType ) { |
---|
| 3752 | assert( node->type ); |
---|
| 3753 | maybeAccept_impl( node->type, *this ); |
---|
| 3754 | } else { |
---|
| 3755 | assert( node->expr ); |
---|
| 3756 | maybeAccept_impl( node->expr, *this ); |
---|
| 3757 | } // if |
---|
| 3758 | |
---|
| 3759 | VISIT_END( node ); |
---|
[13932f14] | 3760 | } |
---|
| 3761 | |
---|
[7870799] | 3762 | template< typename pass_type > |
---|
| 3763 | void PassVisitor< pass_type >::visit( const AttrType * node ) { |
---|
| 3764 | VISIT_START( node ); |
---|
| 3765 | |
---|
| 3766 | if ( node->isType ) { |
---|
| 3767 | assert( node->type ); |
---|
| 3768 | maybeAccept_impl( node->type, *this ); |
---|
| 3769 | } else { |
---|
| 3770 | assert( node->expr ); |
---|
| 3771 | maybeAccept_impl( node->expr, *this ); |
---|
| 3772 | } // if |
---|
| 3773 | |
---|
| 3774 | VISIT_END( node ); |
---|
| 3775 | } |
---|
| 3776 | |
---|
[a8a2b0a] | 3777 | template< typename pass_type > |
---|
| 3778 | Type * PassVisitor< pass_type >::mutate( AttrType * node ) { |
---|
| 3779 | MUTATE_START( node ); |
---|
| 3780 | |
---|
| 3781 | if ( node->isType ) { |
---|
| 3782 | assert( node->type ); |
---|
| 3783 | maybeMutate_impl( node->type, *this ); |
---|
| 3784 | } else { |
---|
| 3785 | assert( node->expr ); |
---|
| 3786 | maybeMutate_impl( node->expr, *this ); |
---|
| 3787 | } // if |
---|
| 3788 | |
---|
| 3789 | MUTATE_END( Type, node ); |
---|
| 3790 | } |
---|
| 3791 | |
---|
| 3792 | //-------------------------------------------------------------------------- |
---|
| 3793 | // VarArgsType |
---|
[13932f14] | 3794 | template< typename pass_type > |
---|
[ab904dc] | 3795 | void PassVisitor< pass_type >::visit( VarArgsType * node ) { |
---|
[a8a2b0a] | 3796 | VISIT_START( node ); |
---|
| 3797 | |
---|
| 3798 | maybeAccept_impl( node->forall, *this ); |
---|
| 3799 | |
---|
| 3800 | VISIT_END( node ); |
---|
[13932f14] | 3801 | } |
---|
| 3802 | |
---|
[7870799] | 3803 | template< typename pass_type > |
---|
| 3804 | void PassVisitor< pass_type >::visit( const VarArgsType * node ) { |
---|
| 3805 | VISIT_START( node ); |
---|
| 3806 | |
---|
| 3807 | maybeAccept_impl( node->forall, *this ); |
---|
| 3808 | |
---|
| 3809 | VISIT_END( node ); |
---|
| 3810 | } |
---|
| 3811 | |
---|
[a8a2b0a] | 3812 | template< typename pass_type > |
---|
| 3813 | Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { |
---|
| 3814 | MUTATE_START( node ); |
---|
| 3815 | |
---|
| 3816 | maybeMutate_impl( node->forall, *this ); |
---|
| 3817 | |
---|
| 3818 | MUTATE_END( Type, node ); |
---|
| 3819 | } |
---|
| 3820 | |
---|
| 3821 | //-------------------------------------------------------------------------- |
---|
| 3822 | // ZeroType |
---|
[13932f14] | 3823 | template< typename pass_type > |
---|
[ab904dc] | 3824 | void PassVisitor< pass_type >::visit( ZeroType * node ) { |
---|
[a8a2b0a] | 3825 | VISIT_START( node ); |
---|
| 3826 | |
---|
| 3827 | maybeAccept_impl( node->forall, *this ); |
---|
| 3828 | |
---|
| 3829 | VISIT_END( node ); |
---|
[13932f14] | 3830 | } |
---|
| 3831 | |
---|
[7870799] | 3832 | template< typename pass_type > |
---|
| 3833 | void PassVisitor< pass_type >::visit( const ZeroType * node ) { |
---|
| 3834 | VISIT_START( node ); |
---|
| 3835 | |
---|
| 3836 | maybeAccept_impl( node->forall, *this ); |
---|
| 3837 | |
---|
| 3838 | VISIT_END( node ); |
---|
| 3839 | } |
---|
| 3840 | |
---|
[a8a2b0a] | 3841 | template< typename pass_type > |
---|
| 3842 | Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { |
---|
| 3843 | MUTATE_START( node ); |
---|
| 3844 | |
---|
| 3845 | maybeMutate_impl( node->forall, *this ); |
---|
| 3846 | |
---|
| 3847 | MUTATE_END( Type, node ); |
---|
| 3848 | } |
---|
| 3849 | |
---|
| 3850 | //-------------------------------------------------------------------------- |
---|
| 3851 | // OneType |
---|
[13932f14] | 3852 | template< typename pass_type > |
---|
[ab904dc] | 3853 | void PassVisitor< pass_type >::visit( OneType * node ) { |
---|
[a8a2b0a] | 3854 | VISIT_START( node ); |
---|
| 3855 | |
---|
| 3856 | maybeAccept_impl( node->forall, *this ); |
---|
| 3857 | |
---|
| 3858 | VISIT_END( node ); |
---|
[13932f14] | 3859 | } |
---|
| 3860 | |
---|
[7870799] | 3861 | template< typename pass_type > |
---|
| 3862 | void PassVisitor< pass_type >::visit( const OneType * node ) { |
---|
| 3863 | VISIT_START( node ); |
---|
| 3864 | |
---|
| 3865 | maybeAccept_impl( node->forall, *this ); |
---|
| 3866 | |
---|
| 3867 | VISIT_END( node ); |
---|
| 3868 | } |
---|
| 3869 | |
---|
[a8a2b0a] | 3870 | template< typename pass_type > |
---|
| 3871 | Type * PassVisitor< pass_type >::mutate( OneType * node ) { |
---|
| 3872 | MUTATE_START( node ); |
---|
| 3873 | |
---|
| 3874 | maybeMutate_impl( node->forall, *this ); |
---|
| 3875 | |
---|
| 3876 | MUTATE_END( Type, node ); |
---|
| 3877 | } |
---|
| 3878 | |
---|
[47498bd] | 3879 | //-------------------------------------------------------------------------- |
---|
| 3880 | // GlobalScopeType |
---|
| 3881 | template< typename pass_type > |
---|
| 3882 | void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { |
---|
| 3883 | VISIT_START( node ); |
---|
| 3884 | |
---|
| 3885 | maybeAccept_impl( node->forall, *this ); |
---|
| 3886 | |
---|
| 3887 | VISIT_END( node ); |
---|
| 3888 | } |
---|
| 3889 | |
---|
[7870799] | 3890 | template< typename pass_type > |
---|
| 3891 | void PassVisitor< pass_type >::visit( const GlobalScopeType * node ) { |
---|
| 3892 | VISIT_START( node ); |
---|
| 3893 | |
---|
| 3894 | maybeAccept_impl( node->forall, *this ); |
---|
| 3895 | |
---|
| 3896 | VISIT_END( node ); |
---|
| 3897 | } |
---|
| 3898 | |
---|
[47498bd] | 3899 | template< typename pass_type > |
---|
| 3900 | Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { |
---|
| 3901 | MUTATE_START( node ); |
---|
| 3902 | |
---|
| 3903 | maybeMutate_impl( node->forall, *this ); |
---|
| 3904 | |
---|
| 3905 | MUTATE_END( Type, node ); |
---|
| 3906 | } |
---|
| 3907 | |
---|
[a8a2b0a] | 3908 | //-------------------------------------------------------------------------- |
---|
| 3909 | // Designation |
---|
[b11d8e2] | 3910 | template< typename pass_type > |
---|
| 3911 | void PassVisitor< pass_type >::visit( Designation * node ) { |
---|
| 3912 | VISIT_START( node ); |
---|
| 3913 | |
---|
[a8a2b0a] | 3914 | maybeAccept_impl( node->designators, *this ); |
---|
[b11d8e2] | 3915 | |
---|
| 3916 | VISIT_END( node ); |
---|
| 3917 | } |
---|
| 3918 | |
---|
[7870799] | 3919 | template< typename pass_type > |
---|
| 3920 | void PassVisitor< pass_type >::visit( const Designation * node ) { |
---|
| 3921 | VISIT_START( node ); |
---|
| 3922 | |
---|
| 3923 | maybeAccept_impl( node->designators, *this ); |
---|
| 3924 | |
---|
| 3925 | VISIT_END( node ); |
---|
| 3926 | } |
---|
| 3927 | |
---|
[b11d8e2] | 3928 | template< typename pass_type > |
---|
| 3929 | Designation * PassVisitor< pass_type >::mutate( Designation * node ) { |
---|
| 3930 | MUTATE_START( node ); |
---|
| 3931 | |
---|
[a8a2b0a] | 3932 | maybeMutate_impl( node->designators, *this ); |
---|
[b11d8e2] | 3933 | |
---|
| 3934 | MUTATE_END( Designation, node ); |
---|
| 3935 | } |
---|
| 3936 | |
---|
[9c1600c] | 3937 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 3938 | // SingleInit |
---|
[13932f14] | 3939 | template< typename pass_type > |
---|
[ab904dc] | 3940 | void PassVisitor< pass_type >::visit( SingleInit * node ) { |
---|
[9c1600c] | 3941 | VISIT_START( node ); |
---|
| 3942 | |
---|
[a8a2b0a] | 3943 | visitExpression( node->value ); |
---|
[9c1600c] | 3944 | |
---|
| 3945 | VISIT_END( node ); |
---|
[13932f14] | 3946 | } |
---|
| 3947 | |
---|
[7870799] | 3948 | template< typename pass_type > |
---|
| 3949 | void PassVisitor< pass_type >::visit( const SingleInit * node ) { |
---|
| 3950 | VISIT_START( node ); |
---|
| 3951 | |
---|
| 3952 | visitExpression( node->value ); |
---|
| 3953 | |
---|
| 3954 | VISIT_END( node ); |
---|
| 3955 | } |
---|
| 3956 | |
---|
[296b2be] | 3957 | template< typename pass_type > |
---|
| 3958 | Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) { |
---|
| 3959 | MUTATE_START( node ); |
---|
| 3960 | |
---|
[a8a2b0a] | 3961 | node->value = mutateExpression( node->value ); |
---|
[296b2be] | 3962 | |
---|
| 3963 | MUTATE_END( Initializer, node ); |
---|
| 3964 | } |
---|
| 3965 | |
---|
[a8a2b0a] | 3966 | //-------------------------------------------------------------------------- |
---|
| 3967 | // ListInit |
---|
[13932f14] | 3968 | template< typename pass_type > |
---|
[ab904dc] | 3969 | void PassVisitor< pass_type >::visit( ListInit * node ) { |
---|
[a8a2b0a] | 3970 | VISIT_START( node ); |
---|
[13932f14] | 3971 | |
---|
[a8a2b0a] | 3972 | maybeAccept_impl( node->designations, *this ); |
---|
| 3973 | maybeAccept_impl( node->initializers, *this ); |
---|
[13932f14] | 3974 | |
---|
[a8a2b0a] | 3975 | VISIT_END( node ); |
---|
[13932f14] | 3976 | } |
---|
| 3977 | |
---|
[7870799] | 3978 | template< typename pass_type > |
---|
| 3979 | void PassVisitor< pass_type >::visit( const ListInit * node ) { |
---|
| 3980 | VISIT_START( node ); |
---|
| 3981 | |
---|
| 3982 | maybeAccept_impl( node->designations, *this ); |
---|
| 3983 | maybeAccept_impl( node->initializers, *this ); |
---|
| 3984 | |
---|
| 3985 | VISIT_END( node ); |
---|
| 3986 | } |
---|
| 3987 | |
---|
[13932f14] | 3988 | template< typename pass_type > |
---|
[a8a2b0a] | 3989 | Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { |
---|
| 3990 | MUTATE_START( node ); |
---|
| 3991 | |
---|
| 3992 | maybeMutate_impl( node->designations, *this ); |
---|
| 3993 | maybeMutate_impl( node->initializers, *this ); |
---|
| 3994 | |
---|
| 3995 | MUTATE_END( Initializer, node ); |
---|
[13932f14] | 3996 | } |
---|
[ab904dc] | 3997 | |
---|
[a8a2b0a] | 3998 | //-------------------------------------------------------------------------- |
---|
| 3999 | // ConstructorInit |
---|
[5ea7a22] | 4000 | template< typename pass_type > |
---|
[a8a2b0a] | 4001 | void PassVisitor< pass_type >::visit( ConstructorInit * node ) { |
---|
| 4002 | VISIT_START( node ); |
---|
[5ea7a22] | 4003 | |
---|
[a8a2b0a] | 4004 | maybeAccept_impl( node->ctor, *this ); |
---|
| 4005 | maybeAccept_impl( node->dtor, *this ); |
---|
| 4006 | maybeAccept_impl( node->init, *this ); |
---|
[ab904dc] | 4007 | |
---|
[a8a2b0a] | 4008 | VISIT_END( node ); |
---|
[ab904dc] | 4009 | } |
---|
| 4010 | |
---|
[7870799] | 4011 | template< typename pass_type > |
---|
| 4012 | void PassVisitor< pass_type >::visit( const ConstructorInit * node ) { |
---|
| 4013 | VISIT_START( node ); |
---|
| 4014 | |
---|
| 4015 | maybeAccept_impl( node->ctor, *this ); |
---|
| 4016 | maybeAccept_impl( node->dtor, *this ); |
---|
| 4017 | maybeAccept_impl( node->init, *this ); |
---|
| 4018 | |
---|
| 4019 | VISIT_END( node ); |
---|
| 4020 | } |
---|
| 4021 | |
---|
[ab904dc] | 4022 | template< typename pass_type > |
---|
[a8a2b0a] | 4023 | Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { |
---|
| 4024 | MUTATE_START( node ); |
---|
[ab904dc] | 4025 | |
---|
[a8a2b0a] | 4026 | maybeMutate_impl( node->ctor, *this ); |
---|
| 4027 | maybeMutate_impl( node->dtor, *this ); |
---|
| 4028 | maybeMutate_impl( node->init, *this ); |
---|
[ab904dc] | 4029 | |
---|
[a8a2b0a] | 4030 | MUTATE_END( Initializer, node ); |
---|
[ab904dc] | 4031 | } |
---|
| 4032 | |
---|
[a8a2b0a] | 4033 | //-------------------------------------------------------------------------- |
---|
[798a8b3] | 4034 | // Constant |
---|
[ab904dc] | 4035 | template< typename pass_type > |
---|
[a8a2b0a] | 4036 | void PassVisitor< pass_type >::visit( Constant * node ) { |
---|
| 4037 | VISIT_START( node ); |
---|
| 4038 | |
---|
| 4039 | VISIT_END( node ); |
---|
[ab904dc] | 4040 | } |
---|
| 4041 | |
---|
[7870799] | 4042 | template< typename pass_type > |
---|
| 4043 | void PassVisitor< pass_type >::visit( const Constant * node ) { |
---|
| 4044 | VISIT_START( node ); |
---|
| 4045 | |
---|
| 4046 | VISIT_END( node ); |
---|
| 4047 | } |
---|
| 4048 | |
---|
[ab904dc] | 4049 | template< typename pass_type > |
---|
[a8a2b0a] | 4050 | Constant * PassVisitor< pass_type >::mutate( Constant * node ) { |
---|
| 4051 | MUTATE_START( node ); |
---|
| 4052 | |
---|
| 4053 | MUTATE_END( Constant, node ); |
---|
[ab904dc] | 4054 | } |
---|
| 4055 | |
---|
[a8a2b0a] | 4056 | //-------------------------------------------------------------------------- |
---|
| 4057 | // Attribute |
---|
[ab904dc] | 4058 | template< typename pass_type > |
---|
[a8a2b0a] | 4059 | void PassVisitor< pass_type >::visit( Attribute * node ) { |
---|
| 4060 | VISIT_START( node ); |
---|
| 4061 | |
---|
| 4062 | maybeAccept_impl( node->parameters, *this ); |
---|
| 4063 | |
---|
| 4064 | VISIT_END( node ); |
---|
[4551a6e] | 4065 | } |
---|
[5ea7a22] | 4066 | |
---|
[7870799] | 4067 | template< typename pass_type > |
---|
| 4068 | void PassVisitor< pass_type >::visit( const Attribute * node ) { |
---|
| 4069 | VISIT_START( node ); |
---|
| 4070 | |
---|
| 4071 | maybeAccept_impl( node->parameters, *this ); |
---|
| 4072 | |
---|
| 4073 | VISIT_END( node ); |
---|
| 4074 | } |
---|
| 4075 | |
---|
[5ea7a22] | 4076 | template< typename pass_type > |
---|
| 4077 | Attribute * PassVisitor< pass_type >::mutate( Attribute * node ) { |
---|
[a8a2b0a] | 4078 | MUTATE_START( node ); |
---|
| 4079 | |
---|
| 4080 | maybeMutate_impl( node->parameters, *this ); |
---|
| 4081 | |
---|
| 4082 | MUTATE_END( Attribute, node ); |
---|
[5ea7a22] | 4083 | } |
---|
[447c356] | 4084 | |
---|
[a8a2b0a] | 4085 | //-------------------------------------------------------------------------- |
---|
| 4086 | // TypeSubstitution |
---|
[447c356] | 4087 | template< typename pass_type > |
---|
| 4088 | TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) { |
---|
| 4089 | MUTATE_START( node ); |
---|
| 4090 | |
---|
| 4091 | for ( auto & p : node->typeEnv ) { |
---|
| 4092 | indexerScopedMutate( p.second, *this ); |
---|
| 4093 | } |
---|
| 4094 | for ( auto & p : node->varEnv ) { |
---|
| 4095 | indexerScopedMutate( p.second, *this ); |
---|
| 4096 | } |
---|
| 4097 | |
---|
| 4098 | MUTATE_END( TypeSubstitution, node ); |
---|
| 4099 | } |
---|
[342146e1] | 4100 | |
---|
| 4101 | #undef VISIT_START |
---|
| 4102 | #undef VISIT_END |
---|
| 4103 | |
---|
| 4104 | #undef MUTATE_START |
---|
[033ff37] | 4105 | #undef MUTATE_END |
---|