[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 |
---|
[28f8f15] | 756 | maybeAccept_impl( node->data_constructors, *this ); |
---|
| 757 | maybeAccept_impl( node->data_union, *this ); |
---|
| 758 | maybeAccept_impl( node->tags, *this ); |
---|
[3c398b6] | 759 | maybeAccept_impl( node->parameters, *this ); |
---|
| 760 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 761 | maybeAccept_impl( node->attributes, *this ); |
---|
[e0886db] | 762 | |
---|
| 763 | VISIT_END( node ); |
---|
[13932f14] | 764 | } |
---|
| 765 | |
---|
[7870799] | 766 | template< typename pass_type > |
---|
| 767 | void PassVisitor< pass_type >::visit( const EnumDecl * node ) { |
---|
| 768 | VISIT_START( node ); |
---|
| 769 | |
---|
[e3d7f9f] | 770 | indexerAddEnum( node ); |
---|
| 771 | |
---|
[7870799] | 772 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
| 773 | maybeAccept_impl( node->parameters, *this ); |
---|
| 774 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 775 | maybeAccept_impl( node->attributes, *this ); |
---|
[7870799] | 776 | |
---|
| 777 | VISIT_END( node ); |
---|
| 778 | } |
---|
| 779 | |
---|
[e0886db] | 780 | template< typename pass_type > |
---|
| 781 | Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) { |
---|
| 782 | MUTATE_START( node ); |
---|
| 783 | |
---|
| 784 | indexerAddEnum( node ); |
---|
| 785 | |
---|
[522363e] | 786 | // unlike structs, traits, and unions, enums inject their members into the global scope |
---|
[3c398b6] | 787 | maybeMutate_impl( node->parameters, *this ); |
---|
| 788 | maybeMutate_impl( node->members , *this ); |
---|
[798a8b3] | 789 | maybeMutate_impl( node->attributes, *this ); |
---|
[e0886db] | 790 | |
---|
| 791 | MUTATE_END( Declaration, node ); |
---|
| 792 | } |
---|
| 793 | |
---|
| 794 | //-------------------------------------------------------------------------- |
---|
| 795 | // TraitDecl |
---|
[13932f14] | 796 | template< typename pass_type > |
---|
[ab904dc] | 797 | void PassVisitor< pass_type >::visit( TraitDecl * node ) { |
---|
[e0886db] | 798 | VISIT_START( node ); |
---|
| 799 | |
---|
| 800 | { |
---|
| 801 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 802 | maybeAccept_impl( node->parameters, *this ); |
---|
| 803 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 804 | maybeAccept_impl( node->attributes, *this ); |
---|
[e0886db] | 805 | } |
---|
| 806 | |
---|
| 807 | indexerAddTrait( node ); |
---|
| 808 | |
---|
| 809 | VISIT_END( node ); |
---|
[13932f14] | 810 | } |
---|
| 811 | |
---|
[7870799] | 812 | template< typename pass_type > |
---|
| 813 | void PassVisitor< pass_type >::visit( const TraitDecl * node ) { |
---|
| 814 | VISIT_START( node ); |
---|
| 815 | |
---|
[e3d7f9f] | 816 | { |
---|
| 817 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 818 | maybeAccept_impl( node->parameters, *this ); |
---|
| 819 | maybeAccept_impl( node->members , *this ); |
---|
[798a8b3] | 820 | maybeAccept_impl( node->attributes, *this ); |
---|
[e3d7f9f] | 821 | } |
---|
| 822 | |
---|
| 823 | indexerAddTrait( node ); |
---|
[7870799] | 824 | |
---|
| 825 | VISIT_END( node ); |
---|
| 826 | } |
---|
| 827 | |
---|
[e0886db] | 828 | template< typename pass_type > |
---|
| 829 | Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) { |
---|
| 830 | MUTATE_START( node ); |
---|
| 831 | |
---|
| 832 | { |
---|
| 833 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 834 | maybeMutate_impl( node->parameters, *this ); |
---|
| 835 | maybeMutate_impl( node->members , *this ); |
---|
[798a8b3] | 836 | maybeMutate_impl( node->attributes, *this ); |
---|
[e0886db] | 837 | } |
---|
| 838 | |
---|
| 839 | indexerAddTrait( node ); |
---|
| 840 | |
---|
| 841 | MUTATE_END( Declaration, node ); |
---|
| 842 | } |
---|
| 843 | |
---|
| 844 | //-------------------------------------------------------------------------- |
---|
| 845 | // TypeDecl |
---|
[13932f14] | 846 | template< typename pass_type > |
---|
[ab904dc] | 847 | void PassVisitor< pass_type >::visit( TypeDecl * node ) { |
---|
[e0886db] | 848 | VISIT_START( node ); |
---|
| 849 | |
---|
| 850 | { |
---|
| 851 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 852 | maybeAccept_impl( node->base , *this ); |
---|
[e0886db] | 853 | } |
---|
| 854 | |
---|
[33a25f9] | 855 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
| 856 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
| 857 | // and may depend on the type itself |
---|
[e0886db] | 858 | indexerAddType( node ); |
---|
| 859 | |
---|
[3c398b6] | 860 | maybeAccept_impl( node->assertions, *this ); |
---|
[e0886db] | 861 | |
---|
| 862 | indexerScopedAccept( node->init, *this ); |
---|
| 863 | |
---|
| 864 | VISIT_END( node ); |
---|
| 865 | } |
---|
| 866 | |
---|
[7870799] | 867 | |
---|
| 868 | template< typename pass_type > |
---|
| 869 | void PassVisitor< pass_type >::visit( const TypeDecl * node ) { |
---|
| 870 | VISIT_START( node ); |
---|
| 871 | |
---|
[e3d7f9f] | 872 | { |
---|
| 873 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 874 | maybeAccept_impl( node->base , *this ); |
---|
| 875 | } |
---|
| 876 | |
---|
| 877 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
| 878 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
| 879 | // and may depend on the type itself |
---|
| 880 | indexerAddType( node ); |
---|
| 881 | |
---|
[7870799] | 882 | maybeAccept_impl( node->assertions, *this ); |
---|
| 883 | |
---|
[e3d7f9f] | 884 | indexerScopedAccept( node->init, *this ); |
---|
| 885 | |
---|
[7870799] | 886 | VISIT_END( node ); |
---|
| 887 | } |
---|
| 888 | |
---|
[e0886db] | 889 | template< typename pass_type > |
---|
[982832e] | 890 | Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) { |
---|
[e0886db] | 891 | MUTATE_START( node ); |
---|
| 892 | |
---|
| 893 | { |
---|
| 894 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 895 | maybeMutate_impl( node->base , *this ); |
---|
[e0886db] | 896 | } |
---|
| 897 | |
---|
[33a25f9] | 898 | // see A NOTE ON THE ORDER OF TRAVERSAL, above |
---|
| 899 | // note that assertions come after the type is added to the symtab, since they are not part of the type proper |
---|
| 900 | // and may depend on the type itself |
---|
[e0886db] | 901 | indexerAddType( node ); |
---|
| 902 | |
---|
[3c398b6] | 903 | maybeMutate_impl( node->assertions, *this ); |
---|
[e0886db] | 904 | |
---|
| 905 | indexerScopedMutate( node->init, *this ); |
---|
| 906 | |
---|
[982832e] | 907 | MUTATE_END( Declaration, node ); |
---|
[13932f14] | 908 | } |
---|
| 909 | |
---|
[e0886db] | 910 | //-------------------------------------------------------------------------- |
---|
| 911 | // TypedefDecl |
---|
[13932f14] | 912 | template< typename pass_type > |
---|
[ab904dc] | 913 | void PassVisitor< pass_type >::visit( TypedefDecl * node ) { |
---|
[e0886db] | 914 | VISIT_START( node ); |
---|
| 915 | |
---|
| 916 | { |
---|
| 917 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 918 | maybeAccept_impl( node->base , *this ); |
---|
[e0886db] | 919 | } |
---|
| 920 | |
---|
| 921 | indexerAddType( node ); |
---|
| 922 | |
---|
[3c398b6] | 923 | maybeAccept_impl( node->assertions, *this ); |
---|
[e0886db] | 924 | |
---|
| 925 | VISIT_END( node ); |
---|
[13932f14] | 926 | } |
---|
| 927 | |
---|
[7870799] | 928 | template< typename pass_type > |
---|
| 929 | void PassVisitor< pass_type >::visit( const TypedefDecl * node ) { |
---|
| 930 | VISIT_START( node ); |
---|
| 931 | |
---|
[e3d7f9f] | 932 | { |
---|
| 933 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 934 | maybeAccept_impl( node->base , *this ); |
---|
| 935 | } |
---|
| 936 | |
---|
| 937 | indexerAddType( node ); |
---|
| 938 | |
---|
[7870799] | 939 | maybeAccept_impl( node->assertions, *this ); |
---|
| 940 | |
---|
| 941 | VISIT_END( node ); |
---|
| 942 | } |
---|
| 943 | |
---|
[13932f14] | 944 | template< typename pass_type > |
---|
[e0886db] | 945 | Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) { |
---|
| 946 | MUTATE_START( node ); |
---|
| 947 | |
---|
| 948 | { |
---|
| 949 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 950 | maybeMutate_impl( node->base , *this ); |
---|
[e0886db] | 951 | } |
---|
| 952 | |
---|
| 953 | indexerAddType( node ); |
---|
| 954 | |
---|
[3c398b6] | 955 | maybeMutate_impl( node->assertions, *this ); |
---|
[e0886db] | 956 | |
---|
| 957 | MUTATE_END( Declaration, node ); |
---|
[13932f14] | 958 | } |
---|
| 959 | |
---|
[9c1600c] | 960 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 961 | // AsmDecl |
---|
[13932f14] | 962 | template< typename pass_type > |
---|
[e0886db] | 963 | void PassVisitor< pass_type >::visit( AsmDecl * node ) { |
---|
[9c1600c] | 964 | VISIT_START( node ); |
---|
| 965 | |
---|
[3c398b6] | 966 | maybeAccept_impl( node->stmt, *this ); |
---|
[9c1600c] | 967 | |
---|
| 968 | VISIT_END( node ); |
---|
[13932f14] | 969 | } |
---|
| 970 | |
---|
[7870799] | 971 | template< typename pass_type > |
---|
| 972 | void PassVisitor< pass_type >::visit( const AsmDecl * node ) { |
---|
| 973 | VISIT_START( node ); |
---|
| 974 | |
---|
| 975 | maybeAccept_impl( node->stmt, *this ); |
---|
| 976 | |
---|
| 977 | VISIT_END( node ); |
---|
| 978 | } |
---|
| 979 | |
---|
[296b2be] | 980 | template< typename pass_type > |
---|
[e0886db] | 981 | AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) { |
---|
[296b2be] | 982 | MUTATE_START( node ); |
---|
| 983 | |
---|
[3c398b6] | 984 | maybeMutate_impl( node->stmt, *this ); |
---|
[e0886db] | 985 | |
---|
| 986 | MUTATE_END( AsmDecl, node ); |
---|
| 987 | } |
---|
| 988 | |
---|
[2d019af] | 989 | //-------------------------------------------------------------------------- |
---|
| 990 | // DirectiveDecl |
---|
| 991 | template< typename pass_type > |
---|
| 992 | void PassVisitor< pass_type >::visit( DirectiveDecl * node ) { |
---|
| 993 | VISIT_START( node ); |
---|
| 994 | |
---|
| 995 | maybeAccept_impl( node->stmt, *this ); |
---|
| 996 | |
---|
| 997 | VISIT_END( node ); |
---|
| 998 | } |
---|
| 999 | |
---|
| 1000 | template< typename pass_type > |
---|
| 1001 | void PassVisitor< pass_type >::visit( const DirectiveDecl * node ) { |
---|
| 1002 | VISIT_START( node ); |
---|
| 1003 | |
---|
| 1004 | maybeAccept_impl( node->stmt, *this ); |
---|
| 1005 | |
---|
| 1006 | VISIT_END( node ); |
---|
| 1007 | } |
---|
| 1008 | |
---|
| 1009 | template< typename pass_type > |
---|
| 1010 | DirectiveDecl * PassVisitor< pass_type >::mutate( DirectiveDecl * node ) { |
---|
| 1011 | MUTATE_START( node ); |
---|
| 1012 | |
---|
| 1013 | maybeMutate_impl( node->stmt, *this ); |
---|
| 1014 | |
---|
| 1015 | MUTATE_END( DirectiveDecl, node ); |
---|
| 1016 | } |
---|
| 1017 | |
---|
[f6e3e34] | 1018 | //-------------------------------------------------------------------------- |
---|
| 1019 | // StaticAssertDecl |
---|
| 1020 | template< typename pass_type > |
---|
| 1021 | void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) { |
---|
| 1022 | VISIT_START( node ); |
---|
| 1023 | |
---|
[842c3d3] | 1024 | node->condition = visitExpression( node->condition ); |
---|
| 1025 | maybeAccept_impl( node->message, *this ); |
---|
[f6e3e34] | 1026 | |
---|
| 1027 | VISIT_END( node ); |
---|
| 1028 | } |
---|
| 1029 | |
---|
[7870799] | 1030 | template< typename pass_type > |
---|
| 1031 | void PassVisitor< pass_type >::visit( const StaticAssertDecl * node ) { |
---|
| 1032 | VISIT_START( node ); |
---|
| 1033 | |
---|
| 1034 | visitExpression( node->condition ); |
---|
| 1035 | maybeAccept_impl( node->message, *this ); |
---|
| 1036 | |
---|
| 1037 | VISIT_END( node ); |
---|
| 1038 | } |
---|
| 1039 | |
---|
[f6e3e34] | 1040 | template< typename pass_type > |
---|
| 1041 | StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) { |
---|
| 1042 | MUTATE_START( node ); |
---|
| 1043 | |
---|
[842c3d3] | 1044 | node->condition = mutateExpression( node->condition ); |
---|
| 1045 | maybeMutate_impl( node->message, *this ); |
---|
[f6e3e34] | 1046 | |
---|
| 1047 | MUTATE_END( StaticAssertDecl, node ); |
---|
| 1048 | } |
---|
| 1049 | |
---|
[e874605] | 1050 | //-------------------------------------------------------------------------- |
---|
[71806e0] | 1051 | // InlineMemberDecl |
---|
[e874605] | 1052 | template< typename pass_type > |
---|
[71806e0] | 1053 | void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) { |
---|
[e874605] | 1054 | VISIT_START( node ); |
---|
| 1055 | |
---|
| 1056 | maybeAccept_impl( node->type, *this ); |
---|
| 1057 | |
---|
| 1058 | VISIT_END( node ); |
---|
| 1059 | } |
---|
| 1060 | |
---|
| 1061 | template< typename pass_type > |
---|
[71806e0] | 1062 | void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) { |
---|
[e874605] | 1063 | VISIT_START( node ); |
---|
| 1064 | |
---|
| 1065 | maybeAccept_impl( node->type, *this ); |
---|
| 1066 | |
---|
| 1067 | VISIT_END( node ); |
---|
| 1068 | } |
---|
| 1069 | |
---|
| 1070 | template< typename pass_type > |
---|
[71806e0] | 1071 | DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) { |
---|
[e874605] | 1072 | MUTATE_START( node ); |
---|
| 1073 | |
---|
| 1074 | maybeMutate_impl( node->type, *this ); |
---|
| 1075 | |
---|
| 1076 | MUTATE_END( DeclarationWithType, node ); |
---|
| 1077 | } |
---|
| 1078 | |
---|
[e0886db] | 1079 | //-------------------------------------------------------------------------- |
---|
| 1080 | // CompoundStmt |
---|
| 1081 | template< typename pass_type > |
---|
| 1082 | void PassVisitor< pass_type >::visit( CompoundStmt * node ) { |
---|
| 1083 | VISIT_START( node ); |
---|
| 1084 | { |
---|
[c6c682cf] | 1085 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
| 1086 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 1087 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
[e0886db] | 1088 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
[c6c682cf] | 1089 | atFunctionTop = false; |
---|
[e0886db] | 1090 | visitStatementList( node->kids ); |
---|
| 1091 | } |
---|
| 1092 | VISIT_END( node ); |
---|
| 1093 | } |
---|
[296b2be] | 1094 | |
---|
[7870799] | 1095 | template< typename pass_type > |
---|
| 1096 | void PassVisitor< pass_type >::visit( const CompoundStmt * node ) { |
---|
| 1097 | VISIT_START( node ); |
---|
| 1098 | { |
---|
[c6c682cf] | 1099 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
| 1100 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 1101 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
[7870799] | 1102 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
[c6c682cf] | 1103 | atFunctionTop = false; |
---|
[7870799] | 1104 | visitStatementList( node->kids ); |
---|
| 1105 | } |
---|
| 1106 | VISIT_END( node ); |
---|
| 1107 | } |
---|
| 1108 | |
---|
[e0886db] | 1109 | template< typename pass_type > |
---|
| 1110 | CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) { |
---|
| 1111 | MUTATE_START( node ); |
---|
| 1112 | { |
---|
[c6c682cf] | 1113 | // Do not enter a new scope if atFunctionTop is true, don't leave one either. |
---|
| 1114 | ValueGuard< bool > oldAtFunctionTop( atFunctionTop ); |
---|
| 1115 | auto guard1 = makeFuncGuard( [this, go = !atFunctionTop]() { if ( go ) indexerScopeEnter(); }, [this, go = !atFunctionTop]() { if ( go ) indexerScopeLeave(); } ); |
---|
[e0886db] | 1116 | auto guard2 = makeFuncGuard( [this]() { call_beginScope(); }, [this]() { call_endScope(); } ); |
---|
[c6c682cf] | 1117 | atFunctionTop = false; |
---|
[e0886db] | 1118 | mutateStatementList( node->kids ); |
---|
| 1119 | } |
---|
[296b2be] | 1120 | MUTATE_END( CompoundStmt, node ); |
---|
| 1121 | } |
---|
| 1122 | |
---|
[9c1600c] | 1123 | //-------------------------------------------------------------------------- |
---|
| 1124 | // ExprStmt |
---|
[13932f14] | 1125 | template< typename pass_type > |
---|
[ab904dc] | 1126 | void PassVisitor< pass_type >::visit( ExprStmt * node ) { |
---|
[9c1600c] | 1127 | VISIT_START( node ); |
---|
| 1128 | |
---|
[e0886db] | 1129 | visitExpression( node->expr ); |
---|
[9c1600c] | 1130 | |
---|
| 1131 | VISIT_END( node ); |
---|
[13932f14] | 1132 | } |
---|
| 1133 | |
---|
[7870799] | 1134 | template< typename pass_type > |
---|
| 1135 | void PassVisitor< pass_type >::visit( const ExprStmt * node ) { |
---|
| 1136 | VISIT_START( node ); |
---|
| 1137 | |
---|
| 1138 | visitExpression( node->expr ); |
---|
| 1139 | |
---|
| 1140 | VISIT_END( node ); |
---|
| 1141 | } |
---|
| 1142 | |
---|
[296b2be] | 1143 | template< typename pass_type > |
---|
| 1144 | Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) { |
---|
| 1145 | MUTATE_START( node ); |
---|
| 1146 | |
---|
[e0886db] | 1147 | node->expr = mutateExpression( node->expr ); |
---|
[296b2be] | 1148 | |
---|
| 1149 | MUTATE_END( Statement, node ); |
---|
| 1150 | } |
---|
| 1151 | |
---|
[6ca154b] | 1152 | //-------------------------------------------------------------------------- |
---|
| 1153 | // AsmStmt |
---|
[13932f14] | 1154 | template< typename pass_type > |
---|
[ab904dc] | 1155 | void PassVisitor< pass_type >::visit( AsmStmt * node ) { |
---|
[bc6f918] | 1156 | VISIT_START( node ) |
---|
| 1157 | |
---|
| 1158 | maybeAccept_impl( node->instruction, *this ); |
---|
| 1159 | maybeAccept_impl( node->output, *this ); |
---|
| 1160 | maybeAccept_impl( node->input, *this ); |
---|
| 1161 | maybeAccept_impl( node->clobber, *this ); |
---|
| 1162 | |
---|
| 1163 | VISIT_END( node ); |
---|
[13932f14] | 1164 | } |
---|
| 1165 | |
---|
[7870799] | 1166 | template< typename pass_type > |
---|
| 1167 | void PassVisitor< pass_type >::visit( const AsmStmt * node ) { |
---|
| 1168 | VISIT_START( node ) |
---|
| 1169 | |
---|
| 1170 | maybeAccept_impl( node->instruction, *this ); |
---|
| 1171 | maybeAccept_impl( node->output, *this ); |
---|
| 1172 | maybeAccept_impl( node->input, *this ); |
---|
| 1173 | maybeAccept_impl( node->clobber, *this ); |
---|
| 1174 | |
---|
| 1175 | VISIT_END( node ); |
---|
| 1176 | } |
---|
| 1177 | |
---|
[6ca154b] | 1178 | template< typename pass_type > |
---|
| 1179 | Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) { |
---|
[bc6f918] | 1180 | MUTATE_START( node ); |
---|
| 1181 | |
---|
| 1182 | maybeMutate_impl( node->instruction, *this ); |
---|
| 1183 | maybeMutate_impl( node->output, *this ); |
---|
| 1184 | maybeMutate_impl( node->input, *this ); |
---|
| 1185 | maybeMutate_impl( node->clobber, *this ); |
---|
| 1186 | |
---|
| 1187 | MUTATE_END( Statement, node ); |
---|
[6ca154b] | 1188 | } |
---|
| 1189 | |
---|
[cc32d83] | 1190 | //-------------------------------------------------------------------------- |
---|
| 1191 | // AsmStmt |
---|
| 1192 | template< typename pass_type > |
---|
| 1193 | void PassVisitor< pass_type >::visit( DirectiveStmt * node ) { |
---|
| 1194 | VISIT_START( node ) |
---|
| 1195 | |
---|
| 1196 | VISIT_END( node ); |
---|
| 1197 | } |
---|
| 1198 | |
---|
[7870799] | 1199 | template< typename pass_type > |
---|
| 1200 | void PassVisitor< pass_type >::visit( const DirectiveStmt * node ) { |
---|
| 1201 | VISIT_START( node ) |
---|
| 1202 | |
---|
| 1203 | VISIT_END( node ); |
---|
| 1204 | } |
---|
| 1205 | |
---|
[cc32d83] | 1206 | template< typename pass_type > |
---|
| 1207 | Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) { |
---|
| 1208 | MUTATE_START( node ); |
---|
| 1209 | |
---|
| 1210 | MUTATE_END( Statement, node ); |
---|
| 1211 | } |
---|
| 1212 | |
---|
[9c1600c] | 1213 | //-------------------------------------------------------------------------- |
---|
| 1214 | // IfStmt |
---|
[13932f14] | 1215 | template< typename pass_type > |
---|
[ab904dc] | 1216 | void PassVisitor< pass_type >::visit( IfStmt * node ) { |
---|
[4551a6e] | 1217 | VISIT_START( node ); |
---|
[33a25f9] | 1218 | { |
---|
| 1219 | // if statements introduce a level of scope (for the initialization) |
---|
| 1220 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[7870799] | 1221 | maybeAccept_impl( node->initialization, *this ); |
---|
[3c398b6] | 1222 | visitExpression ( node->condition ); |
---|
[3b0bc16] | 1223 | node->then = visitStatement( node->then ); |
---|
| 1224 | node->else_ = visitStatement( node->else_ ); |
---|
[33a25f9] | 1225 | } |
---|
[9c1600c] | 1226 | VISIT_END( node ); |
---|
[13932f14] | 1227 | } |
---|
| 1228 | |
---|
[7870799] | 1229 | template< typename pass_type > |
---|
| 1230 | void PassVisitor< pass_type >::visit( const IfStmt * node ) { |
---|
| 1231 | VISIT_START( node ); |
---|
[e3d7f9f] | 1232 | { |
---|
| 1233 | // if statements introduce a level of scope (for the initialization) |
---|
| 1234 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1235 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1236 | visitExpression ( node->condition ); |
---|
[3b0bc16] | 1237 | visitStatement ( node->then ); |
---|
| 1238 | visitStatement ( node->else_ ); |
---|
[e3d7f9f] | 1239 | } |
---|
[7870799] | 1240 | VISIT_END( node ); |
---|
| 1241 | } |
---|
| 1242 | |
---|
[296b2be] | 1243 | template< typename pass_type > |
---|
| 1244 | Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) { |
---|
[4551a6e] | 1245 | MUTATE_START( node ); |
---|
[e0886db] | 1246 | { |
---|
[33a25f9] | 1247 | // if statements introduce a level of scope (for the initialization) |
---|
[e0886db] | 1248 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[7870799] | 1249 | maybeMutate_impl( node->initialization, *this ); |
---|
[e0886db] | 1250 | node->condition = mutateExpression( node->condition ); |
---|
[3b0bc16] | 1251 | node->then = mutateStatement ( node->then ); |
---|
| 1252 | node->else_ = mutateStatement ( node->else_ ); |
---|
[e0886db] | 1253 | } |
---|
[296b2be] | 1254 | MUTATE_END( Statement, node ); |
---|
| 1255 | } |
---|
| 1256 | |
---|
[9c1600c] | 1257 | //-------------------------------------------------------------------------- |
---|
[3b0bc16] | 1258 | // WhileDoStmt |
---|
[13932f14] | 1259 | template< typename pass_type > |
---|
[3b0bc16] | 1260 | void PassVisitor< pass_type >::visit( WhileDoStmt * node ) { |
---|
[4551a6e] | 1261 | VISIT_START( node ); |
---|
[9c1600c] | 1262 | |
---|
[ee3c93d] | 1263 | { |
---|
| 1264 | // while statements introduce a level of scope (for the initialization) |
---|
| 1265 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1266 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1267 | visitExpression ( node->condition ); |
---|
| 1268 | node->body = visitStatement( node->body ); |
---|
| 1269 | } |
---|
[9c1600c] | 1270 | |
---|
| 1271 | VISIT_END( node ); |
---|
[13932f14] | 1272 | } |
---|
| 1273 | |
---|
[7870799] | 1274 | template< typename pass_type > |
---|
[3b0bc16] | 1275 | void PassVisitor< pass_type >::visit( const WhileDoStmt * node ) { |
---|
[7870799] | 1276 | VISIT_START( node ); |
---|
| 1277 | |
---|
[e3d7f9f] | 1278 | { |
---|
| 1279 | // while statements introduce a level of scope (for the initialization) |
---|
| 1280 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1281 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1282 | visitExpression ( node->condition ); |
---|
| 1283 | visitStatement ( node->body ); |
---|
| 1284 | } |
---|
[7870799] | 1285 | |
---|
| 1286 | VISIT_END( node ); |
---|
| 1287 | } |
---|
| 1288 | |
---|
[296b2be] | 1289 | template< typename pass_type > |
---|
[3b0bc16] | 1290 | Statement * PassVisitor< pass_type >::mutate( WhileDoStmt * node ) { |
---|
[4551a6e] | 1291 | MUTATE_START( node ); |
---|
[296b2be] | 1292 | |
---|
[ee3c93d] | 1293 | { |
---|
| 1294 | // while statements introduce a level of scope (for the initialization) |
---|
| 1295 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1296 | maybeMutate_impl( node->initialization, *this ); |
---|
| 1297 | node->condition = mutateExpression( node->condition ); |
---|
| 1298 | node->body = mutateStatement ( node->body ); |
---|
| 1299 | } |
---|
| 1300 | |
---|
[296b2be] | 1301 | |
---|
| 1302 | MUTATE_END( Statement, node ); |
---|
| 1303 | } |
---|
| 1304 | |
---|
[9c1600c] | 1305 | //-------------------------------------------------------------------------- |
---|
[6ca154b] | 1306 | // ForStmt |
---|
[13932f14] | 1307 | template< typename pass_type > |
---|
[ab904dc] | 1308 | void PassVisitor< pass_type >::visit( ForStmt * node ) { |
---|
[4551a6e] | 1309 | VISIT_START( node ); |
---|
[e0886db] | 1310 | { |
---|
[33a25f9] | 1311 | // for statements introduce a level of scope (for the initialization) |
---|
[e0886db] | 1312 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1313 | maybeAccept_impl( node->initialization, *this ); |
---|
[e0886db] | 1314 | visitExpression( node->condition ); |
---|
| 1315 | visitExpression( node->increment ); |
---|
| 1316 | node->body = visitStatement( node->body ); |
---|
| 1317 | } |
---|
[9c1600c] | 1318 | VISIT_END( node ); |
---|
[13932f14] | 1319 | } |
---|
| 1320 | |
---|
[7870799] | 1321 | template< typename pass_type > |
---|
| 1322 | void PassVisitor< pass_type >::visit( const ForStmt * node ) { |
---|
| 1323 | VISIT_START( node ); |
---|
[e3d7f9f] | 1324 | { |
---|
| 1325 | // for statements introduce a level of scope (for the initialization) |
---|
| 1326 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1327 | maybeAccept_impl( node->initialization, *this ); |
---|
| 1328 | visitExpression( node->condition ); |
---|
| 1329 | visitExpression( node->increment ); |
---|
| 1330 | visitStatement ( node->body ); |
---|
| 1331 | } |
---|
[7870799] | 1332 | VISIT_END( node ); |
---|
| 1333 | } |
---|
| 1334 | |
---|
[296b2be] | 1335 | template< typename pass_type > |
---|
| 1336 | Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) { |
---|
[4551a6e] | 1337 | MUTATE_START( node ); |
---|
[e0886db] | 1338 | { |
---|
[33a25f9] | 1339 | // for statements introduce a level of scope (for the initialization) |
---|
[e0886db] | 1340 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1341 | maybeMutate_impl( node->initialization, *this ); |
---|
[e0886db] | 1342 | node->condition = mutateExpression( node->condition ); |
---|
| 1343 | node->increment = mutateExpression( node->increment ); |
---|
| 1344 | node->body = mutateStatement ( node->body ); |
---|
| 1345 | } |
---|
[296b2be] | 1346 | MUTATE_END( Statement, node ); |
---|
| 1347 | } |
---|
| 1348 | |
---|
[9c1600c] | 1349 | //-------------------------------------------------------------------------- |
---|
| 1350 | // SwitchStmt |
---|
[13932f14] | 1351 | template< typename pass_type > |
---|
[ab904dc] | 1352 | void PassVisitor< pass_type >::visit( SwitchStmt * node ) { |
---|
[4551a6e] | 1353 | VISIT_START( node ); |
---|
[9c1600c] | 1354 | |
---|
[e0886db] | 1355 | visitExpression ( node->condition ); |
---|
| 1356 | visitStatementList( node->statements ); |
---|
[9c1600c] | 1357 | |
---|
| 1358 | VISIT_END( node ); |
---|
[13932f14] | 1359 | } |
---|
| 1360 | |
---|
[7870799] | 1361 | template< typename pass_type > |
---|
| 1362 | void PassVisitor< pass_type >::visit( const SwitchStmt * node ) { |
---|
| 1363 | VISIT_START( node ); |
---|
| 1364 | |
---|
| 1365 | visitExpression ( node->condition ); |
---|
| 1366 | visitStatementList( node->statements ); |
---|
| 1367 | |
---|
| 1368 | VISIT_END( node ); |
---|
| 1369 | } |
---|
| 1370 | |
---|
[296b2be] | 1371 | template< typename pass_type > |
---|
| 1372 | Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) { |
---|
[4551a6e] | 1373 | MUTATE_START( node ); |
---|
| 1374 | |
---|
[e0886db] | 1375 | node->condition = mutateExpression( node->condition ); |
---|
| 1376 | mutateStatementList( node->statements ); |
---|
[4551a6e] | 1377 | |
---|
[296b2be] | 1378 | MUTATE_END( Statement, node ); |
---|
| 1379 | } |
---|
| 1380 | |
---|
[9c1600c] | 1381 | //-------------------------------------------------------------------------- |
---|
[35df560] | 1382 | // CaseStmt |
---|
[13932f14] | 1383 | template< typename pass_type > |
---|
[ab904dc] | 1384 | void PassVisitor< pass_type >::visit( CaseStmt * node ) { |
---|
[4551a6e] | 1385 | VISIT_START( node ); |
---|
| 1386 | |
---|
[e0886db] | 1387 | visitExpression ( node->condition ); |
---|
| 1388 | visitStatementList( node->stmts ); |
---|
[4551a6e] | 1389 | |
---|
[9c1600c] | 1390 | VISIT_END( node ); |
---|
[13932f14] | 1391 | } |
---|
| 1392 | |
---|
[7870799] | 1393 | template< typename pass_type > |
---|
| 1394 | void PassVisitor< pass_type >::visit( const CaseStmt * node ) { |
---|
| 1395 | VISIT_START( node ); |
---|
| 1396 | |
---|
| 1397 | visitExpression ( node->condition ); |
---|
| 1398 | visitStatementList( node->stmts ); |
---|
| 1399 | |
---|
| 1400 | VISIT_END( node ); |
---|
| 1401 | } |
---|
| 1402 | |
---|
[296b2be] | 1403 | template< typename pass_type > |
---|
| 1404 | Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) { |
---|
[4551a6e] | 1405 | MUTATE_START( node ); |
---|
| 1406 | |
---|
[e0886db] | 1407 | node->condition = mutateExpression( node->condition ); |
---|
| 1408 | mutateStatementList( node->stmts ); |
---|
[4551a6e] | 1409 | |
---|
[296b2be] | 1410 | MUTATE_END( Statement, node ); |
---|
| 1411 | } |
---|
| 1412 | |
---|
[6ca154b] | 1413 | //-------------------------------------------------------------------------- |
---|
| 1414 | // BranchStmt |
---|
[13932f14] | 1415 | template< typename pass_type > |
---|
[ab904dc] | 1416 | void PassVisitor< pass_type >::visit( BranchStmt * node ) { |
---|
[33c0ce8] | 1417 | VISIT_START( node ); |
---|
| 1418 | VISIT_END( node ); |
---|
[13932f14] | 1419 | } |
---|
| 1420 | |
---|
[7870799] | 1421 | template< typename pass_type > |
---|
| 1422 | void PassVisitor< pass_type >::visit( const BranchStmt * node ) { |
---|
| 1423 | VISIT_START( node ); |
---|
| 1424 | VISIT_END( node ); |
---|
| 1425 | } |
---|
| 1426 | |
---|
[6ca154b] | 1427 | template< typename pass_type > |
---|
| 1428 | Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) { |
---|
[33c0ce8] | 1429 | MUTATE_START( node ); |
---|
| 1430 | MUTATE_END( Statement, node ); |
---|
[6ca154b] | 1431 | } |
---|
| 1432 | |
---|
[9c1600c] | 1433 | //-------------------------------------------------------------------------- |
---|
| 1434 | // ReturnStmt |
---|
[13932f14] | 1435 | template< typename pass_type > |
---|
[ab904dc] | 1436 | void PassVisitor< pass_type >::visit( ReturnStmt * node ) { |
---|
[9c1600c] | 1437 | VISIT_START( node ); |
---|
| 1438 | |
---|
[e0886db] | 1439 | visitExpression( node->expr ); |
---|
[9c1600c] | 1440 | |
---|
| 1441 | VISIT_END( node ); |
---|
[13932f14] | 1442 | } |
---|
| 1443 | |
---|
[7870799] | 1444 | template< typename pass_type > |
---|
| 1445 | void PassVisitor< pass_type >::visit( const ReturnStmt * node ) { |
---|
| 1446 | VISIT_START( node ); |
---|
| 1447 | |
---|
| 1448 | visitExpression( node->expr ); |
---|
| 1449 | |
---|
| 1450 | VISIT_END( node ); |
---|
| 1451 | } |
---|
| 1452 | |
---|
[296b2be] | 1453 | template< typename pass_type > |
---|
| 1454 | Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) { |
---|
| 1455 | MUTATE_START( node ); |
---|
| 1456 | |
---|
[e0886db] | 1457 | node->expr = mutateExpression( node->expr ); |
---|
[296b2be] | 1458 | |
---|
| 1459 | MUTATE_END( Statement, node ); |
---|
| 1460 | } |
---|
| 1461 | |
---|
[6e09f211] | 1462 | //-------------------------------------------------------------------------- |
---|
| 1463 | // ThrowStmt |
---|
| 1464 | template< typename pass_type > |
---|
| 1465 | void PassVisitor< pass_type >::visit( ThrowStmt * node ) { |
---|
[33c0ce8] | 1466 | VISIT_START( node ); |
---|
| 1467 | |
---|
| 1468 | maybeAccept_impl( node->expr, *this ); |
---|
| 1469 | maybeAccept_impl( node->target, *this ); |
---|
| 1470 | |
---|
| 1471 | VISIT_END( node ); |
---|
[6e09f211] | 1472 | } |
---|
| 1473 | |
---|
[7870799] | 1474 | template< typename pass_type > |
---|
| 1475 | void PassVisitor< pass_type >::visit( const ThrowStmt * node ) { |
---|
| 1476 | VISIT_START( node ); |
---|
| 1477 | |
---|
| 1478 | maybeAccept_impl( node->expr, *this ); |
---|
| 1479 | maybeAccept_impl( node->target, *this ); |
---|
| 1480 | |
---|
| 1481 | VISIT_END( node ); |
---|
| 1482 | } |
---|
| 1483 | |
---|
[6e09f211] | 1484 | template< typename pass_type > |
---|
| 1485 | Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) { |
---|
[33c0ce8] | 1486 | MUTATE_START( node ); |
---|
| 1487 | |
---|
| 1488 | maybeMutate_impl( node->expr, *this ); |
---|
| 1489 | maybeMutate_impl( node->target, *this ); |
---|
| 1490 | |
---|
| 1491 | MUTATE_END( Statement, node ); |
---|
[6e09f211] | 1492 | } |
---|
| 1493 | |
---|
[9c1600c] | 1494 | //-------------------------------------------------------------------------- |
---|
| 1495 | // TryStmt |
---|
[13932f14] | 1496 | template< typename pass_type > |
---|
[ab904dc] | 1497 | void PassVisitor< pass_type >::visit( TryStmt * node ) { |
---|
[9c1600c] | 1498 | VISIT_START( node ); |
---|
| 1499 | |
---|
[3c398b6] | 1500 | maybeAccept_impl( node->block , *this ); |
---|
| 1501 | maybeAccept_impl( node->handlers , *this ); |
---|
| 1502 | maybeAccept_impl( node->finallyBlock, *this ); |
---|
[9c1600c] | 1503 | |
---|
| 1504 | VISIT_END( node ); |
---|
[13932f14] | 1505 | } |
---|
| 1506 | |
---|
[7870799] | 1507 | template< typename pass_type > |
---|
| 1508 | void PassVisitor< pass_type >::visit( const TryStmt * node ) { |
---|
| 1509 | VISIT_START( node ); |
---|
| 1510 | |
---|
| 1511 | maybeAccept_impl( node->block , *this ); |
---|
| 1512 | maybeAccept_impl( node->handlers , *this ); |
---|
| 1513 | maybeAccept_impl( node->finallyBlock, *this ); |
---|
| 1514 | |
---|
| 1515 | VISIT_END( node ); |
---|
| 1516 | } |
---|
| 1517 | |
---|
[296b2be] | 1518 | template< typename pass_type > |
---|
| 1519 | Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) { |
---|
| 1520 | MUTATE_START( node ); |
---|
| 1521 | |
---|
[3c398b6] | 1522 | maybeMutate_impl( node->block , *this ); |
---|
| 1523 | maybeMutate_impl( node->handlers , *this ); |
---|
| 1524 | maybeMutate_impl( node->finallyBlock, *this ); |
---|
[4551a6e] | 1525 | |
---|
[296b2be] | 1526 | MUTATE_END( Statement, node ); |
---|
| 1527 | } |
---|
| 1528 | |
---|
[9c1600c] | 1529 | //-------------------------------------------------------------------------- |
---|
| 1530 | // CatchStmt |
---|
[13932f14] | 1531 | template< typename pass_type > |
---|
[ab904dc] | 1532 | void PassVisitor< pass_type >::visit( CatchStmt * node ) { |
---|
[9c1600c] | 1533 | VISIT_START( node ); |
---|
[e0886db] | 1534 | { |
---|
[33a25f9] | 1535 | // catch statements introduce a level of scope (for the caught exception) |
---|
[e0886db] | 1536 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1537 | maybeAccept_impl( node->decl, *this ); |
---|
[e0886db] | 1538 | node->cond = visitExpression( node->cond ); |
---|
| 1539 | node->body = visitStatement ( node->body ); |
---|
| 1540 | } |
---|
[9c1600c] | 1541 | VISIT_END( node ); |
---|
[13932f14] | 1542 | } |
---|
| 1543 | |
---|
[7870799] | 1544 | template< typename pass_type > |
---|
| 1545 | void PassVisitor< pass_type >::visit( const CatchStmt * node ) { |
---|
| 1546 | VISIT_START( node ); |
---|
[e3d7f9f] | 1547 | { |
---|
| 1548 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1549 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1550 | maybeAccept_impl( node->decl, *this ); |
---|
| 1551 | visitExpression ( node->cond ); |
---|
| 1552 | visitStatement ( node->body ); |
---|
| 1553 | } |
---|
[7870799] | 1554 | VISIT_END( node ); |
---|
| 1555 | } |
---|
| 1556 | |
---|
[296b2be] | 1557 | template< typename pass_type > |
---|
| 1558 | Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) { |
---|
| 1559 | MUTATE_START( node ); |
---|
[e0886db] | 1560 | { |
---|
[33a25f9] | 1561 | // catch statements introduce a level of scope (for the caught exception) |
---|
[e0886db] | 1562 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 1563 | maybeMutate_impl( node->decl, *this ); |
---|
[e0886db] | 1564 | node->cond = mutateExpression( node->cond ); |
---|
| 1565 | node->body = mutateStatement ( node->body ); |
---|
| 1566 | } |
---|
[296b2be] | 1567 | MUTATE_END( Statement, node ); |
---|
| 1568 | } |
---|
| 1569 | |
---|
[2065609] | 1570 | //-------------------------------------------------------------------------- |
---|
| 1571 | // FinallyStmt |
---|
[13932f14] | 1572 | template< typename pass_type > |
---|
[ab904dc] | 1573 | void PassVisitor< pass_type >::visit( FinallyStmt * node ) { |
---|
[11b7028] | 1574 | VISIT_START( node ); |
---|
| 1575 | |
---|
| 1576 | maybeAccept_impl( node->block, *this ); |
---|
| 1577 | |
---|
| 1578 | VISIT_END( node ); |
---|
[13932f14] | 1579 | } |
---|
| 1580 | |
---|
[7870799] | 1581 | template< typename pass_type > |
---|
| 1582 | void PassVisitor< pass_type >::visit( const FinallyStmt * node ) { |
---|
| 1583 | VISIT_START( node ); |
---|
| 1584 | |
---|
| 1585 | maybeAccept_impl( node->block, *this ); |
---|
| 1586 | |
---|
| 1587 | VISIT_END( node ); |
---|
| 1588 | } |
---|
| 1589 | |
---|
[2065609] | 1590 | template< typename pass_type > |
---|
| 1591 | Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { |
---|
[11b7028] | 1592 | MUTATE_START( node ); |
---|
| 1593 | |
---|
| 1594 | maybeMutate_impl( node->block, *this ); |
---|
| 1595 | |
---|
| 1596 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1597 | } |
---|
| 1598 | |
---|
[37cdd97] | 1599 | //-------------------------------------------------------------------------- |
---|
| 1600 | // SuspendStmt |
---|
| 1601 | template< typename pass_type > |
---|
| 1602 | void PassVisitor< pass_type >::visit( SuspendStmt * node ) { |
---|
| 1603 | VISIT_START( node ); |
---|
| 1604 | |
---|
| 1605 | maybeAccept_impl( node->then , *this ); |
---|
| 1606 | |
---|
| 1607 | VISIT_END( node ); |
---|
| 1608 | } |
---|
| 1609 | |
---|
| 1610 | template< typename pass_type > |
---|
| 1611 | void PassVisitor< pass_type >::visit( const SuspendStmt * node ) { |
---|
| 1612 | VISIT_START( node ); |
---|
| 1613 | |
---|
| 1614 | maybeAccept_impl( node->then , *this ); |
---|
| 1615 | |
---|
| 1616 | VISIT_END( node ); |
---|
| 1617 | } |
---|
| 1618 | |
---|
| 1619 | template< typename pass_type > |
---|
| 1620 | Statement * PassVisitor< pass_type >::mutate( SuspendStmt * node ) { |
---|
| 1621 | MUTATE_START( node ); |
---|
| 1622 | |
---|
| 1623 | maybeMutate_impl( node->then , *this ); |
---|
| 1624 | |
---|
| 1625 | MUTATE_END( Statement, node ); |
---|
| 1626 | } |
---|
| 1627 | |
---|
[2065609] | 1628 | //-------------------------------------------------------------------------- |
---|
| 1629 | // WaitForStmt |
---|
| 1630 | template< typename pass_type > |
---|
| 1631 | void PassVisitor< pass_type >::visit( WaitForStmt * node ) { |
---|
[834b892] | 1632 | VISIT_START( node ); |
---|
| 1633 | |
---|
| 1634 | for( auto & clause : node->clauses ) { |
---|
| 1635 | maybeAccept_impl( clause.target.function, *this ); |
---|
| 1636 | maybeAccept_impl( clause.target.arguments, *this ); |
---|
| 1637 | |
---|
| 1638 | maybeAccept_impl( clause.statement, *this ); |
---|
| 1639 | maybeAccept_impl( clause.condition, *this ); |
---|
| 1640 | } |
---|
| 1641 | |
---|
| 1642 | maybeAccept_impl( node->timeout.time, *this ); |
---|
| 1643 | maybeAccept_impl( node->timeout.statement, *this ); |
---|
| 1644 | maybeAccept_impl( node->timeout.condition, *this ); |
---|
| 1645 | maybeAccept_impl( node->orelse.statement, *this ); |
---|
| 1646 | maybeAccept_impl( node->orelse.condition, *this ); |
---|
| 1647 | |
---|
| 1648 | VISIT_END( node ); |
---|
[2065609] | 1649 | } |
---|
| 1650 | |
---|
[7870799] | 1651 | template< typename pass_type > |
---|
| 1652 | void PassVisitor< pass_type >::visit( const WaitForStmt * node ) { |
---|
| 1653 | VISIT_START( node ); |
---|
| 1654 | |
---|
| 1655 | for( auto & clause : node->clauses ) { |
---|
| 1656 | maybeAccept_impl( clause.target.function, *this ); |
---|
| 1657 | maybeAccept_impl( clause.target.arguments, *this ); |
---|
| 1658 | |
---|
| 1659 | maybeAccept_impl( clause.statement, *this ); |
---|
| 1660 | maybeAccept_impl( clause.condition, *this ); |
---|
| 1661 | } |
---|
| 1662 | |
---|
| 1663 | maybeAccept_impl( node->timeout.time, *this ); |
---|
| 1664 | maybeAccept_impl( node->timeout.statement, *this ); |
---|
| 1665 | maybeAccept_impl( node->timeout.condition, *this ); |
---|
| 1666 | maybeAccept_impl( node->orelse.statement, *this ); |
---|
| 1667 | maybeAccept_impl( node->orelse.condition, *this ); |
---|
| 1668 | |
---|
| 1669 | VISIT_END( node ); |
---|
| 1670 | } |
---|
| 1671 | |
---|
[2065609] | 1672 | template< typename pass_type > |
---|
| 1673 | Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) { |
---|
[834b892] | 1674 | MUTATE_START( node ); |
---|
| 1675 | |
---|
| 1676 | for( auto & clause : node->clauses ) { |
---|
| 1677 | maybeMutate_impl( clause.target.function, *this ); |
---|
| 1678 | maybeMutate_impl( clause.target.arguments, *this ); |
---|
| 1679 | |
---|
| 1680 | maybeMutate_impl( clause.statement, *this ); |
---|
| 1681 | maybeMutate_impl( clause.condition, *this ); |
---|
| 1682 | } |
---|
| 1683 | |
---|
| 1684 | maybeMutate_impl( node->timeout.time, *this ); |
---|
| 1685 | maybeMutate_impl( node->timeout.statement, *this ); |
---|
| 1686 | maybeMutate_impl( node->timeout.condition, *this ); |
---|
| 1687 | maybeMutate_impl( node->orelse.statement, *this ); |
---|
| 1688 | maybeMutate_impl( node->orelse.condition, *this ); |
---|
| 1689 | |
---|
| 1690 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1691 | } |
---|
| 1692 | |
---|
[d8893ca] | 1693 | |
---|
| 1694 | |
---|
[61255ad] | 1695 | //-------------------------------------------------------------------------- |
---|
[7870799] | 1696 | // WithStmt |
---|
[61255ad] | 1697 | template< typename pass_type > |
---|
| 1698 | void PassVisitor< pass_type >::visit( WithStmt * node ) { |
---|
[d8893ca] | 1699 | VISIT_START( node ); |
---|
| 1700 | maybeAccept_impl( node->exprs, *this ); |
---|
| 1701 | { |
---|
| 1702 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1703 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[0ac366b] | 1704 | indexerAddWith( node->exprs, node ); |
---|
[d8893ca] | 1705 | maybeAccept_impl( node->stmt, *this ); |
---|
| 1706 | } |
---|
| 1707 | VISIT_END( node ); |
---|
[61255ad] | 1708 | } |
---|
| 1709 | |
---|
[7870799] | 1710 | template< typename pass_type > |
---|
| 1711 | void PassVisitor< pass_type >::visit( const WithStmt * node ) { |
---|
| 1712 | VISIT_START( node ); |
---|
| 1713 | maybeAccept_impl( node->exprs, *this ); |
---|
[e3d7f9f] | 1714 | { |
---|
| 1715 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1716 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1717 | indexerAddWith( node->exprs, node ); |
---|
| 1718 | maybeAccept_impl( node->stmt, *this ); |
---|
| 1719 | } |
---|
[7870799] | 1720 | VISIT_END( node ); |
---|
| 1721 | } |
---|
| 1722 | |
---|
[61255ad] | 1723 | template< typename pass_type > |
---|
[e67991f] | 1724 | Declaration * PassVisitor< pass_type >::mutate( WithStmt * node ) { |
---|
[d8893ca] | 1725 | MUTATE_START( node ); |
---|
| 1726 | maybeMutate_impl( node->exprs, *this ); |
---|
| 1727 | { |
---|
| 1728 | // catch statements introduce a level of scope (for the caught exception) |
---|
| 1729 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[0ac366b] | 1730 | indexerAddWith( node->exprs, node ); |
---|
[d8893ca] | 1731 | maybeMutate_impl( node->stmt, *this ); |
---|
| 1732 | } |
---|
[e67991f] | 1733 | MUTATE_END( Declaration, node ); |
---|
[61255ad] | 1734 | } |
---|
| 1735 | |
---|
[2065609] | 1736 | //-------------------------------------------------------------------------- |
---|
| 1737 | // NullStmt |
---|
[13932f14] | 1738 | template< typename pass_type > |
---|
[ab904dc] | 1739 | void PassVisitor< pass_type >::visit( NullStmt * node ) { |
---|
[5964127] | 1740 | VISIT_START( node ); |
---|
| 1741 | VISIT_END( node ); |
---|
[13932f14] | 1742 | } |
---|
| 1743 | |
---|
[7870799] | 1744 | template< typename pass_type > |
---|
| 1745 | void PassVisitor< pass_type >::visit( const NullStmt * node ) { |
---|
| 1746 | VISIT_START( node ); |
---|
| 1747 | VISIT_END( node ); |
---|
| 1748 | } |
---|
| 1749 | |
---|
[2065609] | 1750 | template< typename pass_type > |
---|
| 1751 | NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) { |
---|
[5964127] | 1752 | MUTATE_START( node ); |
---|
| 1753 | MUTATE_END( NullStmt, node ); |
---|
[2065609] | 1754 | } |
---|
| 1755 | |
---|
| 1756 | //-------------------------------------------------------------------------- |
---|
| 1757 | // DeclStmt |
---|
[13932f14] | 1758 | template< typename pass_type > |
---|
[ab904dc] | 1759 | void PassVisitor< pass_type >::visit( DeclStmt * node ) { |
---|
[5964127] | 1760 | VISIT_START( node ); |
---|
| 1761 | |
---|
| 1762 | maybeAccept_impl( node->decl, *this ); |
---|
| 1763 | |
---|
| 1764 | VISIT_END( node ); |
---|
[13932f14] | 1765 | } |
---|
| 1766 | |
---|
[7870799] | 1767 | template< typename pass_type > |
---|
| 1768 | void PassVisitor< pass_type >::visit( const DeclStmt * node ) { |
---|
| 1769 | VISIT_START( node ); |
---|
| 1770 | |
---|
| 1771 | maybeAccept_impl( node->decl, *this ); |
---|
| 1772 | |
---|
| 1773 | VISIT_END( node ); |
---|
| 1774 | } |
---|
| 1775 | |
---|
[2065609] | 1776 | template< typename pass_type > |
---|
| 1777 | Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) { |
---|
[5964127] | 1778 | MUTATE_START( node ); |
---|
| 1779 | |
---|
| 1780 | maybeMutate_impl( node->decl, *this ); |
---|
| 1781 | |
---|
| 1782 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1783 | } |
---|
| 1784 | |
---|
| 1785 | //-------------------------------------------------------------------------- |
---|
| 1786 | // ImplicitCtorDtorStmt |
---|
[13932f14] | 1787 | template< typename pass_type > |
---|
[ab904dc] | 1788 | void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { |
---|
[599fbb6] | 1789 | VISIT_START( node ); |
---|
| 1790 | |
---|
| 1791 | maybeAccept_impl( node->callStmt, *this ); |
---|
| 1792 | |
---|
| 1793 | VISIT_END( node ); |
---|
[13932f14] | 1794 | } |
---|
| 1795 | |
---|
[7870799] | 1796 | template< typename pass_type > |
---|
| 1797 | void PassVisitor< pass_type >::visit( const ImplicitCtorDtorStmt * node ) { |
---|
| 1798 | VISIT_START( node ); |
---|
| 1799 | |
---|
| 1800 | maybeAccept_impl( node->callStmt, *this ); |
---|
| 1801 | |
---|
| 1802 | VISIT_END( node ); |
---|
| 1803 | } |
---|
| 1804 | |
---|
[2065609] | 1805 | template< typename pass_type > |
---|
| 1806 | Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) { |
---|
[599fbb6] | 1807 | MUTATE_START( node ); |
---|
| 1808 | |
---|
| 1809 | maybeMutate_impl( node->callStmt, *this ); |
---|
| 1810 | |
---|
| 1811 | MUTATE_END( Statement, node ); |
---|
[2065609] | 1812 | } |
---|
| 1813 | |
---|
[6cebfef] | 1814 | //-------------------------------------------------------------------------- |
---|
| 1815 | // MutexStmt |
---|
| 1816 | template< typename pass_type > |
---|
| 1817 | void PassVisitor< pass_type >::visit( MutexStmt * node ) { |
---|
| 1818 | VISIT_START( node ); |
---|
| 1819 | // mutex statements introduce a level of scope (for the initialization) |
---|
| 1820 | maybeAccept_impl( node->mutexObjs, *this ); |
---|
| 1821 | { |
---|
| 1822 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1823 | node->stmt = visitStatement( node->stmt ); |
---|
| 1824 | } |
---|
| 1825 | VISIT_END( node ); |
---|
| 1826 | } |
---|
| 1827 | |
---|
| 1828 | template< typename pass_type > |
---|
| 1829 | void PassVisitor< pass_type >::visit( const MutexStmt * node ) { |
---|
| 1830 | VISIT_START( node ); |
---|
| 1831 | maybeAccept_impl( node->mutexObjs, *this ); |
---|
| 1832 | { |
---|
| 1833 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1834 | visitStatement( node->stmt ); |
---|
| 1835 | } |
---|
| 1836 | VISIT_END( node ); |
---|
| 1837 | } |
---|
| 1838 | |
---|
| 1839 | template< typename pass_type > |
---|
| 1840 | Statement * PassVisitor< pass_type >::mutate( MutexStmt * node ) { |
---|
| 1841 | MUTATE_START( node ); |
---|
| 1842 | maybeMutate_impl( node->mutexObjs, *this ); |
---|
| 1843 | { |
---|
| 1844 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 1845 | node->stmt = mutateStatement( node->stmt ); |
---|
| 1846 | } |
---|
| 1847 | MUTATE_END( Statement, node ); |
---|
| 1848 | } |
---|
| 1849 | |
---|
[2065609] | 1850 | //-------------------------------------------------------------------------- |
---|
| 1851 | // ApplicationExpr |
---|
[13932f14] | 1852 | template< typename pass_type > |
---|
[ab904dc] | 1853 | void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { |
---|
[e0886db] | 1854 | VISIT_START( node ); |
---|
| 1855 | |
---|
| 1856 | indexerScopedAccept( node->result , *this ); |
---|
[e3d7f9f] | 1857 | maybeAccept_impl ( node->function, *this ); |
---|
| 1858 | maybeAccept_impl ( node->args , *this ); |
---|
[e0886db] | 1859 | |
---|
| 1860 | VISIT_END( node ); |
---|
[13932f14] | 1861 | } |
---|
| 1862 | |
---|
[7870799] | 1863 | template< typename pass_type > |
---|
| 1864 | void PassVisitor< pass_type >::visit( const ApplicationExpr * node ) { |
---|
| 1865 | VISIT_START( node ); |
---|
| 1866 | |
---|
[e3d7f9f] | 1867 | indexerScopedAccept( node->result , *this ); |
---|
| 1868 | maybeAccept_impl ( node->function, *this ); |
---|
| 1869 | maybeAccept_impl ( node->args , *this ); |
---|
[7870799] | 1870 | |
---|
| 1871 | VISIT_END( node ); |
---|
| 1872 | } |
---|
| 1873 | |
---|
[2065609] | 1874 | template< typename pass_type > |
---|
| 1875 | Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) { |
---|
[e0886db] | 1876 | MUTATE_START( node ); |
---|
| 1877 | |
---|
| 1878 | indexerScopedMutate( node->env , *this ); |
---|
| 1879 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 1880 | maybeMutate_impl ( node->function, *this ); |
---|
| 1881 | maybeMutate_impl ( node->args , *this ); |
---|
[e0886db] | 1882 | |
---|
| 1883 | MUTATE_END( Expression, node ); |
---|
[2065609] | 1884 | } |
---|
| 1885 | |
---|
[9c1600c] | 1886 | //-------------------------------------------------------------------------- |
---|
| 1887 | // UntypedExpr |
---|
[13932f14] | 1888 | template< typename pass_type > |
---|
[ab904dc] | 1889 | void PassVisitor< pass_type >::visit( UntypedExpr * node ) { |
---|
[9c1600c] | 1890 | VISIT_START( node ); |
---|
| 1891 | |
---|
[3c398b6] | 1892 | // maybeAccept_impl( node->get_env(), *this ); |
---|
[e0886db] | 1893 | indexerScopedAccept( node->result, *this ); |
---|
[2a7b3ca] | 1894 | |
---|
[e0886db] | 1895 | for ( auto expr : node->args ) { |
---|
[9c1600c] | 1896 | visitExpression( expr ); |
---|
| 1897 | } |
---|
| 1898 | |
---|
| 1899 | VISIT_END( node ); |
---|
[13932f14] | 1900 | } |
---|
| 1901 | |
---|
[7870799] | 1902 | template< typename pass_type > |
---|
| 1903 | void PassVisitor< pass_type >::visit( const UntypedExpr * node ) { |
---|
| 1904 | VISIT_START( node ); |
---|
| 1905 | |
---|
[e3d7f9f] | 1906 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 1907 | |
---|
| 1908 | for ( auto expr : node->args ) { |
---|
| 1909 | visitExpression( expr ); |
---|
| 1910 | } |
---|
| 1911 | |
---|
| 1912 | VISIT_END( node ); |
---|
| 1913 | } |
---|
| 1914 | |
---|
[296b2be] | 1915 | template< typename pass_type > |
---|
| 1916 | Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) { |
---|
| 1917 | MUTATE_START( node ); |
---|
| 1918 | |
---|
[e0886db] | 1919 | indexerScopedMutate( node->env , *this ); |
---|
| 1920 | indexerScopedMutate( node->result, *this ); |
---|
[2a7b3ca] | 1921 | |
---|
[e0886db] | 1922 | for ( auto& expr : node->args ) { |
---|
[296b2be] | 1923 | expr = mutateExpression( expr ); |
---|
| 1924 | } |
---|
| 1925 | |
---|
| 1926 | MUTATE_END( Expression, node ); |
---|
| 1927 | } |
---|
| 1928 | |
---|
[e0886db] | 1929 | //-------------------------------------------------------------------------- |
---|
| 1930 | // NameExpr |
---|
[13932f14] | 1931 | template< typename pass_type > |
---|
[ab904dc] | 1932 | void PassVisitor< pass_type >::visit( NameExpr * node ) { |
---|
[e0886db] | 1933 | VISIT_START( node ); |
---|
| 1934 | |
---|
| 1935 | indexerScopedAccept( node->result, *this ); |
---|
| 1936 | |
---|
| 1937 | VISIT_END( node ); |
---|
[13932f14] | 1938 | } |
---|
| 1939 | |
---|
[7870799] | 1940 | template< typename pass_type > |
---|
| 1941 | void PassVisitor< pass_type >::visit( const NameExpr * node ) { |
---|
| 1942 | VISIT_START( node ); |
---|
| 1943 | |
---|
[e3d7f9f] | 1944 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 1945 | |
---|
| 1946 | VISIT_END( node ); |
---|
| 1947 | } |
---|
| 1948 | |
---|
[13932f14] | 1949 | template< typename pass_type > |
---|
[e0886db] | 1950 | Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) { |
---|
| 1951 | MUTATE_START( node ); |
---|
| 1952 | |
---|
| 1953 | indexerScopedMutate( node->env , *this ); |
---|
| 1954 | indexerScopedMutate( node->result, *this ); |
---|
| 1955 | |
---|
[b0d9ff7] | 1956 | MUTATE_END( Expression, node ); |
---|
| 1957 | } |
---|
| 1958 | |
---|
| 1959 | //-------------------------------------------------------------------------- |
---|
| 1960 | // QualifiedNameExpr |
---|
| 1961 | template< typename pass_type > |
---|
| 1962 | void PassVisitor< pass_type >::visit( QualifiedNameExpr * node ) { |
---|
| 1963 | VISIT_START( node ); |
---|
| 1964 | |
---|
| 1965 | indexerScopedAccept( node->result, *this ); |
---|
| 1966 | maybeAccept_impl( node->type_decl, *this ); |
---|
| 1967 | |
---|
| 1968 | VISIT_END( node ); |
---|
| 1969 | } |
---|
| 1970 | |
---|
| 1971 | template< typename pass_type > |
---|
| 1972 | void PassVisitor< pass_type >::visit( const QualifiedNameExpr * node ) { |
---|
| 1973 | VISIT_START( node ); |
---|
| 1974 | |
---|
| 1975 | indexerScopedAccept( node->result, *this ); |
---|
| 1976 | maybeAccept_impl( node->type_decl, *this ); |
---|
| 1977 | |
---|
| 1978 | VISIT_END( node ); |
---|
| 1979 | } |
---|
| 1980 | |
---|
| 1981 | template< typename pass_type > |
---|
| 1982 | Expression * PassVisitor< pass_type >::mutate( QualifiedNameExpr * node ) { |
---|
| 1983 | MUTATE_START( node ); |
---|
| 1984 | |
---|
| 1985 | indexerScopedMutate( node->env , *this ); |
---|
| 1986 | indexerScopedMutate( node->result, *this ); |
---|
| 1987 | maybeMutate_impl( node->type_decl, *this ); |
---|
| 1988 | |
---|
[e0886db] | 1989 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 1990 | } |
---|
| 1991 | |
---|
[e0886db] | 1992 | //-------------------------------------------------------------------------- |
---|
| 1993 | // CastExpr |
---|
[a5f0529] | 1994 | template< typename pass_type > |
---|
[e0886db] | 1995 | void PassVisitor< pass_type >::visit( CastExpr * node ) { |
---|
| 1996 | VISIT_START( node ); |
---|
| 1997 | |
---|
| 1998 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 1999 | maybeAccept_impl ( node->arg , *this ); |
---|
[e0886db] | 2000 | |
---|
| 2001 | VISIT_END( node ); |
---|
[a5f0529] | 2002 | } |
---|
| 2003 | |
---|
[7870799] | 2004 | template< typename pass_type > |
---|
| 2005 | void PassVisitor< pass_type >::visit( const CastExpr * node ) { |
---|
| 2006 | VISIT_START( node ); |
---|
| 2007 | |
---|
[e3d7f9f] | 2008 | indexerScopedAccept( node->result, *this ); |
---|
| 2009 | maybeAccept_impl ( node->arg , *this ); |
---|
[7870799] | 2010 | |
---|
| 2011 | VISIT_END( node ); |
---|
| 2012 | } |
---|
| 2013 | |
---|
[13932f14] | 2014 | template< typename pass_type > |
---|
[e0886db] | 2015 | Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) { |
---|
| 2016 | MUTATE_START( node ); |
---|
| 2017 | |
---|
| 2018 | indexerScopedMutate( node->env , *this ); |
---|
| 2019 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2020 | maybeMutate_impl ( node->arg , *this ); |
---|
[e0886db] | 2021 | |
---|
| 2022 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2023 | } |
---|
| 2024 | |
---|
[e0886db] | 2025 | //-------------------------------------------------------------------------- |
---|
[9a705dc8] | 2026 | // KeywordCastExpr |
---|
| 2027 | template< typename pass_type > |
---|
| 2028 | void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) { |
---|
| 2029 | VISIT_START( node ); |
---|
| 2030 | |
---|
| 2031 | indexerScopedAccept( node->result, *this ); |
---|
| 2032 | maybeAccept_impl ( node->arg , *this ); |
---|
| 2033 | |
---|
| 2034 | VISIT_END( node ); |
---|
| 2035 | } |
---|
| 2036 | |
---|
[7870799] | 2037 | template< typename pass_type > |
---|
| 2038 | void PassVisitor< pass_type >::visit( const KeywordCastExpr * node ) { |
---|
| 2039 | VISIT_START( node ); |
---|
| 2040 | |
---|
[e3d7f9f] | 2041 | indexerScopedAccept( node->result, *this ); |
---|
| 2042 | maybeAccept_impl ( node->arg , *this ); |
---|
[7870799] | 2043 | |
---|
| 2044 | VISIT_END( node ); |
---|
| 2045 | } |
---|
| 2046 | |
---|
[9a705dc8] | 2047 | template< typename pass_type > |
---|
| 2048 | Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) { |
---|
| 2049 | MUTATE_START( node ); |
---|
| 2050 | |
---|
| 2051 | indexerScopedMutate( node->env , *this ); |
---|
| 2052 | indexerScopedMutate( node->result, *this ); |
---|
| 2053 | maybeMutate_impl ( node->arg , *this ); |
---|
| 2054 | |
---|
| 2055 | MUTATE_END( Expression, node ); |
---|
| 2056 | } |
---|
| 2057 | |
---|
| 2058 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 2059 | // VirtualCastExpr |
---|
[13932f14] | 2060 | template< typename pass_type > |
---|
[e0886db] | 2061 | void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) { |
---|
| 2062 | VISIT_START( node ); |
---|
| 2063 | |
---|
| 2064 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 2065 | maybeAccept_impl ( node->arg, *this ); |
---|
[e0886db] | 2066 | |
---|
| 2067 | VISIT_END( node ); |
---|
[13932f14] | 2068 | } |
---|
| 2069 | |
---|
[7870799] | 2070 | template< typename pass_type > |
---|
| 2071 | void PassVisitor< pass_type >::visit( const VirtualCastExpr * node ) { |
---|
| 2072 | VISIT_START( node ); |
---|
| 2073 | |
---|
[e3d7f9f] | 2074 | indexerScopedAccept( node->result, *this ); |
---|
| 2075 | maybeAccept_impl ( node->arg, *this ); |
---|
[7870799] | 2076 | |
---|
| 2077 | VISIT_END( node ); |
---|
| 2078 | } |
---|
| 2079 | |
---|
[13932f14] | 2080 | template< typename pass_type > |
---|
[e0886db] | 2081 | Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) { |
---|
| 2082 | MUTATE_START( node ); |
---|
| 2083 | |
---|
| 2084 | indexerScopedMutate( node->env , *this ); |
---|
| 2085 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2086 | maybeMutate_impl ( node->arg , *this ); |
---|
[e0886db] | 2087 | |
---|
| 2088 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2089 | } |
---|
| 2090 | |
---|
[e0886db] | 2091 | //-------------------------------------------------------------------------- |
---|
| 2092 | // AddressExpr |
---|
[13932f14] | 2093 | template< typename pass_type > |
---|
[e0886db] | 2094 | void PassVisitor< pass_type >::visit( AddressExpr * node ) { |
---|
| 2095 | VISIT_START( node ); |
---|
| 2096 | |
---|
| 2097 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2098 | maybeAccept_impl ( node->arg , *this ); |
---|
[e0886db] | 2099 | |
---|
| 2100 | VISIT_END( node ); |
---|
[13932f14] | 2101 | } |
---|
| 2102 | |
---|
[7870799] | 2103 | template< typename pass_type > |
---|
| 2104 | void PassVisitor< pass_type >::visit( const AddressExpr * node ) { |
---|
| 2105 | VISIT_START( node ); |
---|
| 2106 | |
---|
[e3d7f9f] | 2107 | indexerScopedAccept( node->result, *this ); |
---|
| 2108 | maybeAccept_impl ( node->arg , *this ); |
---|
[7870799] | 2109 | |
---|
| 2110 | VISIT_END( node ); |
---|
| 2111 | } |
---|
| 2112 | |
---|
[13932f14] | 2113 | template< typename pass_type > |
---|
[e0886db] | 2114 | Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) { |
---|
| 2115 | MUTATE_START( node ); |
---|
| 2116 | |
---|
| 2117 | indexerScopedMutate( node->env , *this ); |
---|
| 2118 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2119 | maybeMutate_impl ( node->arg , *this ); |
---|
[e0886db] | 2120 | |
---|
| 2121 | MUTATE_END( Expression, node ); |
---|
| 2122 | } |
---|
| 2123 | |
---|
| 2124 | //-------------------------------------------------------------------------- |
---|
| 2125 | // LabelAddressExpr |
---|
| 2126 | template< typename pass_type > |
---|
| 2127 | void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) { |
---|
| 2128 | VISIT_START( node ); |
---|
| 2129 | |
---|
| 2130 | indexerScopedAccept( node->result, *this ); |
---|
| 2131 | |
---|
| 2132 | VISIT_END( node ); |
---|
| 2133 | } |
---|
| 2134 | |
---|
[7870799] | 2135 | template< typename pass_type > |
---|
| 2136 | void PassVisitor< pass_type >::visit( const LabelAddressExpr * node ) { |
---|
| 2137 | VISIT_START( node ); |
---|
| 2138 | |
---|
[e3d7f9f] | 2139 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2140 | |
---|
| 2141 | VISIT_END( node ); |
---|
| 2142 | } |
---|
| 2143 | |
---|
[e0886db] | 2144 | template< typename pass_type > |
---|
| 2145 | Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) { |
---|
| 2146 | MUTATE_START( node ); |
---|
| 2147 | |
---|
| 2148 | indexerScopedMutate( node->env , *this ); |
---|
| 2149 | indexerScopedMutate( node->result, *this ); |
---|
| 2150 | |
---|
| 2151 | MUTATE_END( Expression, node ); |
---|
| 2152 | } |
---|
| 2153 | |
---|
| 2154 | //-------------------------------------------------------------------------- |
---|
| 2155 | // UntypedMemberExpr |
---|
| 2156 | template< typename pass_type > |
---|
| 2157 | void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) { |
---|
| 2158 | VISIT_START( node ); |
---|
| 2159 | |
---|
| 2160 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2161 | maybeAccept_impl ( node->aggregate, *this ); |
---|
| 2162 | maybeAccept_impl ( node->member , *this ); |
---|
[e0886db] | 2163 | |
---|
| 2164 | VISIT_END( node ); |
---|
[13932f14] | 2165 | } |
---|
| 2166 | |
---|
[7870799] | 2167 | template< typename pass_type > |
---|
| 2168 | void PassVisitor< pass_type >::visit( const UntypedMemberExpr * node ) { |
---|
| 2169 | VISIT_START( node ); |
---|
| 2170 | |
---|
[e3d7f9f] | 2171 | indexerScopedAccept( node->result , *this ); |
---|
| 2172 | maybeAccept_impl ( node->aggregate, *this ); |
---|
| 2173 | maybeAccept_impl ( node->member , *this ); |
---|
[7870799] | 2174 | |
---|
| 2175 | VISIT_END( node ); |
---|
| 2176 | } |
---|
| 2177 | |
---|
[e0886db] | 2178 | template< typename pass_type > |
---|
| 2179 | Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) { |
---|
| 2180 | MUTATE_START( node ); |
---|
| 2181 | |
---|
| 2182 | indexerScopedMutate( node->env , *this ); |
---|
| 2183 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2184 | maybeMutate_impl ( node->aggregate, *this ); |
---|
| 2185 | maybeMutate_impl ( node->member , *this ); |
---|
[e0886db] | 2186 | |
---|
| 2187 | MUTATE_END( Expression, node ); |
---|
| 2188 | } |
---|
| 2189 | |
---|
| 2190 | //-------------------------------------------------------------------------- |
---|
| 2191 | // MemberExpr |
---|
| 2192 | template< typename pass_type > |
---|
| 2193 | void PassVisitor< pass_type >::visit( MemberExpr * node ) { |
---|
| 2194 | VISIT_START( node ); |
---|
| 2195 | |
---|
| 2196 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2197 | maybeAccept_impl ( node->aggregate, *this ); |
---|
[e0886db] | 2198 | |
---|
| 2199 | VISIT_END( node ); |
---|
| 2200 | } |
---|
| 2201 | |
---|
[7870799] | 2202 | template< typename pass_type > |
---|
| 2203 | void PassVisitor< pass_type >::visit( const MemberExpr * node ) { |
---|
| 2204 | VISIT_START( node ); |
---|
| 2205 | |
---|
[e3d7f9f] | 2206 | indexerScopedAccept( node->result , *this ); |
---|
| 2207 | maybeAccept_impl ( node->aggregate, *this ); |
---|
[7870799] | 2208 | |
---|
| 2209 | VISIT_END( node ); |
---|
| 2210 | } |
---|
| 2211 | |
---|
[e0886db] | 2212 | template< typename pass_type > |
---|
| 2213 | Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) { |
---|
| 2214 | MUTATE_START( node ); |
---|
| 2215 | |
---|
| 2216 | indexerScopedMutate( node->env , *this ); |
---|
| 2217 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2218 | maybeMutate_impl ( node->aggregate, *this ); |
---|
[e0886db] | 2219 | |
---|
| 2220 | MUTATE_END( Expression, node ); |
---|
| 2221 | } |
---|
| 2222 | |
---|
| 2223 | //-------------------------------------------------------------------------- |
---|
| 2224 | // VariableExpr |
---|
| 2225 | template< typename pass_type > |
---|
| 2226 | void PassVisitor< pass_type >::visit( VariableExpr * node ) { |
---|
| 2227 | VISIT_START( node ); |
---|
| 2228 | |
---|
| 2229 | indexerScopedAccept( node->result, *this ); |
---|
| 2230 | |
---|
| 2231 | VISIT_END( node ); |
---|
| 2232 | } |
---|
| 2233 | |
---|
[7870799] | 2234 | template< typename pass_type > |
---|
| 2235 | void PassVisitor< pass_type >::visit( const VariableExpr * node ) { |
---|
| 2236 | VISIT_START( node ); |
---|
| 2237 | |
---|
[e3d7f9f] | 2238 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2239 | |
---|
| 2240 | VISIT_END( node ); |
---|
| 2241 | } |
---|
| 2242 | |
---|
[e0886db] | 2243 | template< typename pass_type > |
---|
| 2244 | Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) { |
---|
| 2245 | MUTATE_START( node ); |
---|
| 2246 | |
---|
| 2247 | indexerScopedMutate( node->env , *this ); |
---|
| 2248 | indexerScopedMutate( node->result, *this ); |
---|
| 2249 | |
---|
| 2250 | MUTATE_END( Expression, node ); |
---|
| 2251 | } |
---|
| 2252 | |
---|
| 2253 | //-------------------------------------------------------------------------- |
---|
| 2254 | // ConstantExpr |
---|
[13932f14] | 2255 | template< typename pass_type > |
---|
[ab904dc] | 2256 | void PassVisitor< pass_type >::visit( ConstantExpr * node ) { |
---|
[e0886db] | 2257 | VISIT_START( node ); |
---|
| 2258 | |
---|
| 2259 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2260 | maybeAccept_impl ( &node->constant, *this ); |
---|
[e0886db] | 2261 | |
---|
| 2262 | VISIT_END( node ); |
---|
[13932f14] | 2263 | } |
---|
| 2264 | |
---|
[7870799] | 2265 | template< typename pass_type > |
---|
| 2266 | void PassVisitor< pass_type >::visit( const ConstantExpr * node ) { |
---|
| 2267 | VISIT_START( node ); |
---|
| 2268 | |
---|
[e3d7f9f] | 2269 | indexerScopedAccept( node->result , *this ); |
---|
| 2270 | maybeAccept_impl ( &node->constant, *this ); |
---|
[7870799] | 2271 | |
---|
| 2272 | VISIT_END( node ); |
---|
| 2273 | } |
---|
| 2274 | |
---|
[e0886db] | 2275 | template< typename pass_type > |
---|
| 2276 | Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) { |
---|
| 2277 | MUTATE_START( node ); |
---|
| 2278 | |
---|
| 2279 | indexerScopedMutate( node->env , *this ); |
---|
| 2280 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2281 | Constant * ptr = &node->constant; |
---|
| 2282 | maybeMutate_impl( ptr, *this ); |
---|
| 2283 | node->constant = *ptr; |
---|
[e0886db] | 2284 | |
---|
| 2285 | MUTATE_END( Expression, node ); |
---|
| 2286 | } |
---|
| 2287 | |
---|
| 2288 | //-------------------------------------------------------------------------- |
---|
| 2289 | // SizeofExpr |
---|
[13932f14] | 2290 | template< typename pass_type > |
---|
[ab904dc] | 2291 | void PassVisitor< pass_type >::visit( SizeofExpr * node ) { |
---|
[e0886db] | 2292 | VISIT_START( node ); |
---|
| 2293 | |
---|
| 2294 | indexerScopedAccept( node->result, *this ); |
---|
| 2295 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2296 | maybeAccept_impl( node->type, *this ); |
---|
[e0886db] | 2297 | } else { |
---|
[3c398b6] | 2298 | maybeAccept_impl( node->expr, *this ); |
---|
[e0886db] | 2299 | } |
---|
| 2300 | |
---|
| 2301 | VISIT_END( node ); |
---|
[13932f14] | 2302 | } |
---|
| 2303 | |
---|
[7870799] | 2304 | template< typename pass_type > |
---|
| 2305 | void PassVisitor< pass_type >::visit( const SizeofExpr * node ) { |
---|
| 2306 | VISIT_START( node ); |
---|
| 2307 | |
---|
[e3d7f9f] | 2308 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2309 | if ( node->get_isType() ) { |
---|
| 2310 | maybeAccept_impl( node->type, *this ); |
---|
| 2311 | } else { |
---|
| 2312 | maybeAccept_impl( node->expr, *this ); |
---|
| 2313 | } |
---|
| 2314 | |
---|
| 2315 | VISIT_END( node ); |
---|
| 2316 | } |
---|
| 2317 | |
---|
[e0886db] | 2318 | template< typename pass_type > |
---|
| 2319 | Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) { |
---|
| 2320 | MUTATE_START( node ); |
---|
| 2321 | |
---|
| 2322 | indexerScopedMutate( node->env , *this ); |
---|
| 2323 | indexerScopedMutate( node->result, *this ); |
---|
| 2324 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2325 | maybeMutate_impl( node->type, *this ); |
---|
[e0886db] | 2326 | } else { |
---|
[3c398b6] | 2327 | maybeMutate_impl( node->expr, *this ); |
---|
[e0886db] | 2328 | } |
---|
| 2329 | |
---|
| 2330 | MUTATE_END( Expression, node ); |
---|
| 2331 | } |
---|
| 2332 | |
---|
| 2333 | //-------------------------------------------------------------------------- |
---|
| 2334 | // AlignofExpr |
---|
[13932f14] | 2335 | template< typename pass_type > |
---|
[ab904dc] | 2336 | void PassVisitor< pass_type >::visit( AlignofExpr * node ) { |
---|
[e0886db] | 2337 | VISIT_START( node ); |
---|
| 2338 | |
---|
| 2339 | indexerScopedAccept( node->result, *this ); |
---|
| 2340 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2341 | maybeAccept_impl( node->type, *this ); |
---|
[e0886db] | 2342 | } else { |
---|
[3c398b6] | 2343 | maybeAccept_impl( node->expr, *this ); |
---|
[e0886db] | 2344 | } |
---|
| 2345 | |
---|
| 2346 | VISIT_END( node ); |
---|
[13932f14] | 2347 | } |
---|
| 2348 | |
---|
[7870799] | 2349 | template< typename pass_type > |
---|
| 2350 | void PassVisitor< pass_type >::visit( const AlignofExpr * node ) { |
---|
| 2351 | VISIT_START( node ); |
---|
| 2352 | |
---|
[e3d7f9f] | 2353 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 2354 | if ( node->get_isType() ) { |
---|
| 2355 | maybeAccept_impl( node->type, *this ); |
---|
| 2356 | } else { |
---|
| 2357 | maybeAccept_impl( node->expr, *this ); |
---|
| 2358 | } |
---|
| 2359 | |
---|
| 2360 | VISIT_END( node ); |
---|
| 2361 | } |
---|
| 2362 | |
---|
[e0886db] | 2363 | template< typename pass_type > |
---|
| 2364 | Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) { |
---|
| 2365 | MUTATE_START( node ); |
---|
| 2366 | |
---|
| 2367 | indexerScopedMutate( node->env , *this ); |
---|
| 2368 | indexerScopedMutate( node->result, *this ); |
---|
| 2369 | if ( node->get_isType() ) { |
---|
[3c398b6] | 2370 | maybeMutate_impl( node->type, *this ); |
---|
[e0886db] | 2371 | } else { |
---|
[3c398b6] | 2372 | maybeMutate_impl( node->expr, *this ); |
---|
[e0886db] | 2373 | } |
---|
| 2374 | |
---|
| 2375 | MUTATE_END( Expression, node ); |
---|
| 2376 | } |
---|
| 2377 | |
---|
| 2378 | //-------------------------------------------------------------------------- |
---|
| 2379 | // UntypedOffsetofExpr |
---|
[13932f14] | 2380 | template< typename pass_type > |
---|
[ab904dc] | 2381 | void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) { |
---|
[e0886db] | 2382 | VISIT_START( node ); |
---|
| 2383 | |
---|
| 2384 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2385 | maybeAccept_impl ( node->type , *this ); |
---|
[e0886db] | 2386 | |
---|
| 2387 | VISIT_END( node ); |
---|
[13932f14] | 2388 | } |
---|
| 2389 | |
---|
[7870799] | 2390 | template< typename pass_type > |
---|
| 2391 | void PassVisitor< pass_type >::visit( const UntypedOffsetofExpr * node ) { |
---|
| 2392 | VISIT_START( node ); |
---|
| 2393 | |
---|
[e3d7f9f] | 2394 | indexerScopedAccept( node->result, *this ); |
---|
| 2395 | maybeAccept_impl ( node->type , *this ); |
---|
[7870799] | 2396 | |
---|
| 2397 | VISIT_END( node ); |
---|
| 2398 | } |
---|
| 2399 | |
---|
[e0886db] | 2400 | template< typename pass_type > |
---|
| 2401 | Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) { |
---|
| 2402 | MUTATE_START( node ); |
---|
| 2403 | |
---|
| 2404 | indexerScopedMutate( node->env , *this ); |
---|
| 2405 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2406 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2407 | |
---|
| 2408 | MUTATE_END( Expression, node ); |
---|
| 2409 | } |
---|
| 2410 | |
---|
| 2411 | //-------------------------------------------------------------------------- |
---|
| 2412 | // OffsetofExpr |
---|
[13932f14] | 2413 | template< typename pass_type > |
---|
[ab904dc] | 2414 | void PassVisitor< pass_type >::visit( OffsetofExpr * node ) { |
---|
[e0886db] | 2415 | VISIT_START( node ); |
---|
| 2416 | |
---|
| 2417 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2418 | maybeAccept_impl ( node->type , *this ); |
---|
[e0886db] | 2419 | |
---|
| 2420 | VISIT_END( node ); |
---|
[13932f14] | 2421 | } |
---|
| 2422 | |
---|
[7870799] | 2423 | template< typename pass_type > |
---|
| 2424 | void PassVisitor< pass_type >::visit( const OffsetofExpr * node ) { |
---|
| 2425 | VISIT_START( node ); |
---|
| 2426 | |
---|
[e3d7f9f] | 2427 | indexerScopedAccept( node->result, *this ); |
---|
| 2428 | maybeAccept_impl ( node->type , *this ); |
---|
[7870799] | 2429 | |
---|
| 2430 | VISIT_END( node ); |
---|
| 2431 | } |
---|
| 2432 | |
---|
[e0886db] | 2433 | template< typename pass_type > |
---|
| 2434 | Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) { |
---|
| 2435 | MUTATE_START( node ); |
---|
| 2436 | |
---|
| 2437 | indexerScopedMutate( node->env , *this ); |
---|
| 2438 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2439 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2440 | |
---|
| 2441 | MUTATE_END( Expression, node ); |
---|
| 2442 | } |
---|
| 2443 | |
---|
| 2444 | //-------------------------------------------------------------------------- |
---|
| 2445 | // OffsetPackExpr |
---|
[13932f14] | 2446 | template< typename pass_type > |
---|
[ab904dc] | 2447 | void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) { |
---|
[e0886db] | 2448 | VISIT_START( node ); |
---|
| 2449 | |
---|
| 2450 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2451 | maybeAccept_impl ( node->type , *this ); |
---|
[e0886db] | 2452 | |
---|
| 2453 | VISIT_END( node ); |
---|
[13932f14] | 2454 | } |
---|
| 2455 | |
---|
[7870799] | 2456 | template< typename pass_type > |
---|
| 2457 | void PassVisitor< pass_type >::visit( const OffsetPackExpr * node ) { |
---|
| 2458 | VISIT_START( node ); |
---|
| 2459 | |
---|
[e3d7f9f] | 2460 | indexerScopedAccept( node->result, *this ); |
---|
| 2461 | maybeAccept_impl ( node->type , *this ); |
---|
[7870799] | 2462 | |
---|
| 2463 | VISIT_END( node ); |
---|
| 2464 | } |
---|
| 2465 | |
---|
[e0886db] | 2466 | template< typename pass_type > |
---|
| 2467 | Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) { |
---|
| 2468 | MUTATE_START( node ); |
---|
| 2469 | |
---|
| 2470 | indexerScopedMutate( node->env , *this ); |
---|
| 2471 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2472 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2473 | |
---|
| 2474 | MUTATE_END( Expression, node ); |
---|
| 2475 | } |
---|
| 2476 | |
---|
| 2477 | //-------------------------------------------------------------------------- |
---|
| 2478 | // LogicalExpr |
---|
[13932f14] | 2479 | template< typename pass_type > |
---|
[ab904dc] | 2480 | void PassVisitor< pass_type >::visit( LogicalExpr * node ) { |
---|
[e0886db] | 2481 | VISIT_START( node ); |
---|
| 2482 | |
---|
| 2483 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2484 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2485 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2486 | |
---|
| 2487 | VISIT_END( node ); |
---|
| 2488 | } |
---|
| 2489 | |
---|
[7870799] | 2490 | template< typename pass_type > |
---|
| 2491 | void PassVisitor< pass_type >::visit( const LogicalExpr * node ) { |
---|
| 2492 | VISIT_START( node ); |
---|
| 2493 | |
---|
[e3d7f9f] | 2494 | indexerScopedAccept( node->result, *this ); |
---|
| 2495 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2496 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[7870799] | 2497 | |
---|
| 2498 | VISIT_END( node ); |
---|
| 2499 | } |
---|
| 2500 | |
---|
[e0886db] | 2501 | template< typename pass_type > |
---|
| 2502 | Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) { |
---|
| 2503 | MUTATE_START( node ); |
---|
| 2504 | |
---|
| 2505 | indexerScopedMutate( node->env , *this ); |
---|
| 2506 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2507 | maybeMutate_impl ( node->arg1 , *this ); |
---|
| 2508 | maybeMutate_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2509 | |
---|
| 2510 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2511 | } |
---|
| 2512 | |
---|
[e0886db] | 2513 | //-------------------------------------------------------------------------- |
---|
| 2514 | // ConditionalExpr |
---|
[13932f14] | 2515 | template< typename pass_type > |
---|
[ab904dc] | 2516 | void PassVisitor< pass_type >::visit( ConditionalExpr * node ) { |
---|
[e0886db] | 2517 | VISIT_START( node ); |
---|
| 2518 | |
---|
| 2519 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2520 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2521 | maybeAccept_impl ( node->arg2 , *this ); |
---|
| 2522 | maybeAccept_impl ( node->arg3 , *this ); |
---|
[e0886db] | 2523 | |
---|
| 2524 | VISIT_END( node ); |
---|
[13932f14] | 2525 | } |
---|
| 2526 | |
---|
[e0886db] | 2527 | template< typename pass_type > |
---|
[7870799] | 2528 | void PassVisitor< pass_type >::visit( const ConditionalExpr * node ) { |
---|
| 2529 | VISIT_START( node ); |
---|
| 2530 | |
---|
[e3d7f9f] | 2531 | indexerScopedAccept( node->result, *this ); |
---|
| 2532 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2533 | maybeAccept_impl ( node->arg2 , *this ); |
---|
| 2534 | maybeAccept_impl ( node->arg3 , *this ); |
---|
[7870799] | 2535 | |
---|
| 2536 | VISIT_END( node ); |
---|
| 2537 | } |
---|
| 2538 | |
---|
| 2539 | template< typename pass_type > |
---|
| 2540 | Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) { |
---|
| 2541 | MUTATE_START( node ); |
---|
[e0886db] | 2542 | |
---|
| 2543 | indexerScopedMutate( node->env , *this ); |
---|
| 2544 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2545 | maybeMutate_impl ( node->arg1 , *this ); |
---|
| 2546 | maybeMutate_impl ( node->arg2 , *this ); |
---|
| 2547 | maybeMutate_impl ( node->arg3 , *this ); |
---|
[e0886db] | 2548 | |
---|
| 2549 | MUTATE_END( Expression, node ); |
---|
| 2550 | } |
---|
| 2551 | |
---|
| 2552 | //-------------------------------------------------------------------------- |
---|
| 2553 | // CommaExpr |
---|
[13932f14] | 2554 | template< typename pass_type > |
---|
[ab904dc] | 2555 | void PassVisitor< pass_type >::visit( CommaExpr * node ) { |
---|
[e0886db] | 2556 | VISIT_START( node ); |
---|
| 2557 | |
---|
| 2558 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2559 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2560 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2561 | |
---|
| 2562 | VISIT_END( node ); |
---|
| 2563 | } |
---|
| 2564 | |
---|
[7870799] | 2565 | template< typename pass_type > |
---|
| 2566 | void PassVisitor< pass_type >::visit( const CommaExpr * node ) { |
---|
| 2567 | VISIT_START( node ); |
---|
| 2568 | |
---|
[e3d7f9f] | 2569 | indexerScopedAccept( node->result, *this ); |
---|
| 2570 | maybeAccept_impl ( node->arg1 , *this ); |
---|
| 2571 | maybeAccept_impl ( node->arg2 , *this ); |
---|
[7870799] | 2572 | |
---|
| 2573 | VISIT_END( node ); |
---|
| 2574 | } |
---|
| 2575 | |
---|
[e0886db] | 2576 | template< typename pass_type > |
---|
| 2577 | Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) { |
---|
| 2578 | MUTATE_START( node ); |
---|
| 2579 | |
---|
| 2580 | indexerScopedMutate( node->env , *this ); |
---|
| 2581 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2582 | maybeMutate_impl ( node->arg1 , *this ); |
---|
| 2583 | maybeMutate_impl ( node->arg2 , *this ); |
---|
[e0886db] | 2584 | |
---|
| 2585 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2586 | } |
---|
| 2587 | |
---|
[e0886db] | 2588 | //-------------------------------------------------------------------------- |
---|
| 2589 | // TypeExpr |
---|
[13932f14] | 2590 | template< typename pass_type > |
---|
[ab904dc] | 2591 | void PassVisitor< pass_type >::visit( TypeExpr * node ) { |
---|
[e0886db] | 2592 | VISIT_START( node ); |
---|
| 2593 | |
---|
| 2594 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2595 | maybeAccept_impl ( node->type, *this ); |
---|
[e0886db] | 2596 | |
---|
| 2597 | VISIT_END( node ); |
---|
[13932f14] | 2598 | } |
---|
| 2599 | |
---|
[7870799] | 2600 | template< typename pass_type > |
---|
| 2601 | void PassVisitor< pass_type >::visit( const TypeExpr * node ) { |
---|
| 2602 | VISIT_START( node ); |
---|
| 2603 | |
---|
[e3d7f9f] | 2604 | indexerScopedAccept( node->result, *this ); |
---|
| 2605 | maybeAccept_impl ( node->type, *this ); |
---|
[7870799] | 2606 | |
---|
| 2607 | VISIT_END( node ); |
---|
| 2608 | } |
---|
| 2609 | |
---|
[e0886db] | 2610 | template< typename pass_type > |
---|
| 2611 | Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) { |
---|
| 2612 | MUTATE_START( node ); |
---|
| 2613 | |
---|
| 2614 | indexerScopedMutate( node->env , *this ); |
---|
| 2615 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2616 | maybeMutate_impl ( node->type , *this ); |
---|
[e0886db] | 2617 | |
---|
| 2618 | MUTATE_END( Expression, node ); |
---|
| 2619 | } |
---|
| 2620 | |
---|
[6e50a6b] | 2621 | //-------------------------------------------------------------------------- |
---|
| 2622 | // DimensionExpr |
---|
| 2623 | template< typename pass_type > |
---|
| 2624 | void PassVisitor< pass_type >::visit( DimensionExpr * node ) { |
---|
| 2625 | VISIT_START( node ); |
---|
| 2626 | |
---|
| 2627 | indexerScopedAccept( node->result, *this ); |
---|
| 2628 | |
---|
| 2629 | VISIT_END( node ); |
---|
| 2630 | } |
---|
| 2631 | |
---|
| 2632 | template< typename pass_type > |
---|
| 2633 | void PassVisitor< pass_type >::visit( const DimensionExpr * node ) { |
---|
| 2634 | VISIT_START( node ); |
---|
| 2635 | |
---|
| 2636 | indexerScopedAccept( node->result, *this ); |
---|
| 2637 | |
---|
| 2638 | VISIT_END( node ); |
---|
| 2639 | } |
---|
| 2640 | |
---|
| 2641 | template< typename pass_type > |
---|
| 2642 | Expression * PassVisitor< pass_type >::mutate( DimensionExpr * node ) { |
---|
| 2643 | MUTATE_START( node ); |
---|
| 2644 | |
---|
| 2645 | indexerScopedMutate( node->env , *this ); |
---|
| 2646 | indexerScopedMutate( node->result, *this ); |
---|
| 2647 | |
---|
| 2648 | MUTATE_END( Expression, node ); |
---|
| 2649 | } |
---|
| 2650 | |
---|
[e0886db] | 2651 | //-------------------------------------------------------------------------- |
---|
| 2652 | // AsmExpr |
---|
[13932f14] | 2653 | template< typename pass_type > |
---|
[ab904dc] | 2654 | void PassVisitor< pass_type >::visit( AsmExpr * node ) { |
---|
[e0886db] | 2655 | VISIT_START( node ); |
---|
| 2656 | |
---|
| 2657 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2658 | maybeAccept_impl ( node->constraint, *this ); |
---|
| 2659 | maybeAccept_impl ( node->operand , *this ); |
---|
[e0886db] | 2660 | |
---|
| 2661 | VISIT_END( node ); |
---|
[13932f14] | 2662 | } |
---|
| 2663 | |
---|
[7870799] | 2664 | template< typename pass_type > |
---|
| 2665 | void PassVisitor< pass_type >::visit( const AsmExpr * node ) { |
---|
| 2666 | VISIT_START( node ); |
---|
| 2667 | |
---|
[e3d7f9f] | 2668 | indexerScopedAccept( node->result , *this ); |
---|
| 2669 | maybeAccept_impl ( node->constraint, *this ); |
---|
| 2670 | maybeAccept_impl ( node->operand , *this ); |
---|
[7870799] | 2671 | |
---|
| 2672 | VISIT_END( node ); |
---|
| 2673 | } |
---|
| 2674 | |
---|
[e0886db] | 2675 | template< typename pass_type > |
---|
| 2676 | Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) { |
---|
| 2677 | MUTATE_START( node ); |
---|
| 2678 | |
---|
| 2679 | indexerScopedMutate( node->env , *this ); |
---|
| 2680 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2681 | maybeMutate_impl ( node->constraint, *this ); |
---|
| 2682 | maybeMutate_impl ( node->operand , *this ); |
---|
[e0886db] | 2683 | |
---|
| 2684 | MUTATE_END( Expression, node ); |
---|
| 2685 | } |
---|
| 2686 | |
---|
| 2687 | //-------------------------------------------------------------------------- |
---|
| 2688 | // ImplicitCopyCtorExpr |
---|
[13932f14] | 2689 | template< typename pass_type > |
---|
[ab904dc] | 2690 | void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) { |
---|
[e0886db] | 2691 | VISIT_START( node ); |
---|
| 2692 | |
---|
[2f86ddf] | 2693 | indexerScopedAccept( node->result , *this ); |
---|
| 2694 | maybeAccept_impl ( node->callExpr , *this ); |
---|
[e0886db] | 2695 | |
---|
| 2696 | VISIT_END( node ); |
---|
| 2697 | } |
---|
| 2698 | |
---|
[7870799] | 2699 | template< typename pass_type > |
---|
| 2700 | void PassVisitor< pass_type >::visit( const ImplicitCopyCtorExpr * node ) { |
---|
| 2701 | VISIT_START( node ); |
---|
| 2702 | |
---|
[e3d7f9f] | 2703 | indexerScopedAccept( node->result , *this ); |
---|
| 2704 | maybeAccept_impl ( node->callExpr , *this ); |
---|
[7870799] | 2705 | |
---|
| 2706 | VISIT_END( node ); |
---|
| 2707 | } |
---|
| 2708 | |
---|
[e0886db] | 2709 | template< typename pass_type > |
---|
| 2710 | Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) { |
---|
| 2711 | MUTATE_START( node ); |
---|
| 2712 | |
---|
[2f86ddf] | 2713 | indexerScopedMutate( node->env , *this ); |
---|
| 2714 | indexerScopedMutate( node->result , *this ); |
---|
| 2715 | maybeMutate_impl ( node->callExpr , *this ); |
---|
[e0886db] | 2716 | |
---|
| 2717 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2718 | } |
---|
| 2719 | |
---|
[e0886db] | 2720 | //-------------------------------------------------------------------------- |
---|
| 2721 | // ConstructorExpr |
---|
[13932f14] | 2722 | template< typename pass_type > |
---|
[ab904dc] | 2723 | void PassVisitor< pass_type >::visit( ConstructorExpr * node ) { |
---|
[e0886db] | 2724 | VISIT_START( node ); |
---|
| 2725 | |
---|
| 2726 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2727 | maybeAccept_impl ( node->callExpr, *this ); |
---|
[e0886db] | 2728 | |
---|
| 2729 | VISIT_END( node ); |
---|
| 2730 | } |
---|
| 2731 | |
---|
[7870799] | 2732 | template< typename pass_type > |
---|
| 2733 | void PassVisitor< pass_type >::visit( const ConstructorExpr * node ) { |
---|
| 2734 | VISIT_START( node ); |
---|
| 2735 | |
---|
[e3d7f9f] | 2736 | indexerScopedAccept( node->result , *this ); |
---|
| 2737 | maybeAccept_impl ( node->callExpr, *this ); |
---|
[7870799] | 2738 | |
---|
| 2739 | VISIT_END( node ); |
---|
| 2740 | } |
---|
| 2741 | |
---|
[e0886db] | 2742 | template< typename pass_type > |
---|
| 2743 | Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) { |
---|
| 2744 | MUTATE_START( node ); |
---|
| 2745 | |
---|
| 2746 | indexerScopedMutate( node->env , *this ); |
---|
| 2747 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2748 | maybeMutate_impl ( node->callExpr, *this ); |
---|
[e0886db] | 2749 | |
---|
| 2750 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2751 | } |
---|
| 2752 | |
---|
[e0886db] | 2753 | //-------------------------------------------------------------------------- |
---|
| 2754 | // CompoundLiteralExpr |
---|
[13932f14] | 2755 | template< typename pass_type > |
---|
[ab904dc] | 2756 | void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) { |
---|
[e0886db] | 2757 | VISIT_START( node ); |
---|
| 2758 | |
---|
| 2759 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2760 | maybeAccept_impl ( node->initializer, *this ); |
---|
[e0886db] | 2761 | |
---|
| 2762 | VISIT_END( node ); |
---|
[13932f14] | 2763 | } |
---|
| 2764 | |
---|
[7870799] | 2765 | template< typename pass_type > |
---|
| 2766 | void PassVisitor< pass_type >::visit( const CompoundLiteralExpr * node ) { |
---|
| 2767 | VISIT_START( node ); |
---|
| 2768 | |
---|
[e3d7f9f] | 2769 | indexerScopedAccept( node->result , *this ); |
---|
| 2770 | maybeAccept_impl ( node->initializer, *this ); |
---|
[7870799] | 2771 | |
---|
| 2772 | VISIT_END( node ); |
---|
| 2773 | } |
---|
| 2774 | |
---|
[e0886db] | 2775 | template< typename pass_type > |
---|
| 2776 | Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) { |
---|
| 2777 | MUTATE_START( node ); |
---|
| 2778 | |
---|
| 2779 | indexerScopedMutate( node->env , *this ); |
---|
| 2780 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2781 | maybeMutate_impl ( node->initializer, *this ); |
---|
[e0886db] | 2782 | |
---|
| 2783 | MUTATE_END( Expression, node ); |
---|
| 2784 | } |
---|
| 2785 | |
---|
| 2786 | //-------------------------------------------------------------------------- |
---|
| 2787 | // RangeExpr |
---|
[13932f14] | 2788 | template< typename pass_type > |
---|
[ab904dc] | 2789 | void PassVisitor< pass_type >::visit( RangeExpr * node ) { |
---|
[e0886db] | 2790 | VISIT_START( node ); |
---|
| 2791 | |
---|
| 2792 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2793 | maybeAccept_impl ( node->low , *this ); |
---|
| 2794 | maybeAccept_impl ( node->high , *this ); |
---|
[e0886db] | 2795 | |
---|
| 2796 | VISIT_END( node ); |
---|
[13932f14] | 2797 | } |
---|
| 2798 | |
---|
[7870799] | 2799 | template< typename pass_type > |
---|
| 2800 | void PassVisitor< pass_type >::visit( const RangeExpr * node ) { |
---|
| 2801 | VISIT_START( node ); |
---|
| 2802 | |
---|
[e3d7f9f] | 2803 | indexerScopedAccept( node->result, *this ); |
---|
| 2804 | maybeAccept_impl ( node->low , *this ); |
---|
| 2805 | maybeAccept_impl ( node->high , *this ); |
---|
[7870799] | 2806 | |
---|
| 2807 | VISIT_END( node ); |
---|
| 2808 | } |
---|
| 2809 | |
---|
[e0886db] | 2810 | template< typename pass_type > |
---|
| 2811 | Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) { |
---|
| 2812 | MUTATE_START( node ); |
---|
| 2813 | |
---|
| 2814 | indexerScopedMutate( node->env , *this ); |
---|
| 2815 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2816 | maybeMutate_impl ( node->low , *this ); |
---|
| 2817 | maybeMutate_impl ( node->high , *this ); |
---|
[e0886db] | 2818 | |
---|
| 2819 | MUTATE_END( Expression, node ); |
---|
| 2820 | } |
---|
| 2821 | |
---|
| 2822 | //-------------------------------------------------------------------------- |
---|
| 2823 | // UntypedTupleExpr |
---|
[13932f14] | 2824 | template< typename pass_type > |
---|
[ab904dc] | 2825 | void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) { |
---|
[e0886db] | 2826 | VISIT_START( node ); |
---|
| 2827 | |
---|
| 2828 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2829 | maybeAccept_impl ( node->exprs , *this ); |
---|
[e0886db] | 2830 | |
---|
| 2831 | VISIT_END( node ); |
---|
| 2832 | } |
---|
| 2833 | |
---|
[7870799] | 2834 | template< typename pass_type > |
---|
| 2835 | void PassVisitor< pass_type >::visit( const UntypedTupleExpr * node ) { |
---|
| 2836 | VISIT_START( node ); |
---|
| 2837 | |
---|
[e3d7f9f] | 2838 | indexerScopedAccept( node->result, *this ); |
---|
| 2839 | maybeAccept_impl ( node->exprs , *this ); |
---|
[7870799] | 2840 | |
---|
| 2841 | VISIT_END( node ); |
---|
| 2842 | } |
---|
| 2843 | |
---|
[e0886db] | 2844 | template< typename pass_type > |
---|
| 2845 | Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) { |
---|
| 2846 | MUTATE_START( node ); |
---|
| 2847 | |
---|
| 2848 | indexerScopedMutate( node->env , *this ); |
---|
| 2849 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2850 | maybeMutate_impl ( node->exprs , *this ); |
---|
[e0886db] | 2851 | |
---|
| 2852 | MUTATE_END( Expression, node ); |
---|
| 2853 | } |
---|
| 2854 | |
---|
| 2855 | //-------------------------------------------------------------------------- |
---|
| 2856 | // TupleExpr |
---|
| 2857 | template< typename pass_type > |
---|
| 2858 | void PassVisitor< pass_type >::visit( TupleExpr * node ) { |
---|
| 2859 | VISIT_START( node ); |
---|
| 2860 | |
---|
| 2861 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2862 | maybeAccept_impl ( node->exprs , *this ); |
---|
[e0886db] | 2863 | |
---|
| 2864 | VISIT_END( node ); |
---|
| 2865 | } |
---|
| 2866 | |
---|
[7870799] | 2867 | template< typename pass_type > |
---|
| 2868 | void PassVisitor< pass_type >::visit( const TupleExpr * node ) { |
---|
| 2869 | VISIT_START( node ); |
---|
| 2870 | |
---|
[e3d7f9f] | 2871 | indexerScopedAccept( node->result, *this ); |
---|
| 2872 | maybeAccept_impl ( node->exprs , *this ); |
---|
[7870799] | 2873 | |
---|
| 2874 | VISIT_END( node ); |
---|
| 2875 | } |
---|
| 2876 | |
---|
[e0886db] | 2877 | template< typename pass_type > |
---|
| 2878 | Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) { |
---|
| 2879 | MUTATE_START( node ); |
---|
| 2880 | |
---|
| 2881 | indexerScopedMutate( node->env , *this ); |
---|
| 2882 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2883 | maybeMutate_impl ( node->exprs , *this ); |
---|
[e0886db] | 2884 | |
---|
| 2885 | MUTATE_END( Expression, node ); |
---|
| 2886 | } |
---|
| 2887 | |
---|
| 2888 | //-------------------------------------------------------------------------- |
---|
| 2889 | // TupleIndexExpr |
---|
| 2890 | template< typename pass_type > |
---|
| 2891 | void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) { |
---|
| 2892 | VISIT_START( node ); |
---|
| 2893 | |
---|
| 2894 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 2895 | maybeAccept_impl ( node->tuple , *this ); |
---|
[e0886db] | 2896 | |
---|
| 2897 | VISIT_END( node ); |
---|
| 2898 | } |
---|
| 2899 | |
---|
[7870799] | 2900 | template< typename pass_type > |
---|
| 2901 | void PassVisitor< pass_type >::visit( const TupleIndexExpr * node ) { |
---|
| 2902 | VISIT_START( node ); |
---|
| 2903 | |
---|
[e3d7f9f] | 2904 | indexerScopedAccept( node->result, *this ); |
---|
| 2905 | maybeAccept_impl ( node->tuple , *this ); |
---|
[7870799] | 2906 | |
---|
| 2907 | VISIT_END( node ); |
---|
| 2908 | } |
---|
| 2909 | |
---|
[e0886db] | 2910 | template< typename pass_type > |
---|
| 2911 | Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) { |
---|
| 2912 | MUTATE_START( node ); |
---|
| 2913 | |
---|
| 2914 | indexerScopedMutate( node->env , *this ); |
---|
| 2915 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 2916 | maybeMutate_impl ( node->tuple , *this ); |
---|
[e0886db] | 2917 | |
---|
| 2918 | MUTATE_END( Expression, node ); |
---|
| 2919 | } |
---|
| 2920 | |
---|
| 2921 | //-------------------------------------------------------------------------- |
---|
| 2922 | // TupleAssignExpr |
---|
| 2923 | template< typename pass_type > |
---|
| 2924 | void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) { |
---|
| 2925 | VISIT_START( node ); |
---|
| 2926 | |
---|
| 2927 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2928 | maybeAccept_impl ( node->stmtExpr, *this ); |
---|
[e0886db] | 2929 | |
---|
| 2930 | VISIT_END( node ); |
---|
[13932f14] | 2931 | } |
---|
| 2932 | |
---|
[7870799] | 2933 | template< typename pass_type > |
---|
| 2934 | void PassVisitor< pass_type >::visit( const TupleAssignExpr * node ) { |
---|
| 2935 | VISIT_START( node ); |
---|
| 2936 | |
---|
[e3d7f9f] | 2937 | indexerScopedAccept( node->result , *this ); |
---|
[7870799] | 2938 | maybeAccept_impl( node->stmtExpr, *this ); |
---|
| 2939 | |
---|
| 2940 | VISIT_END( node ); |
---|
| 2941 | } |
---|
| 2942 | |
---|
[13932f14] | 2943 | template< typename pass_type > |
---|
[e0886db] | 2944 | Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) { |
---|
| 2945 | MUTATE_START( node ); |
---|
[13932f14] | 2946 | |
---|
[e0886db] | 2947 | indexerScopedMutate( node->env , *this ); |
---|
| 2948 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 2949 | maybeMutate_impl ( node->stmtExpr, *this ); |
---|
[13932f14] | 2950 | |
---|
[e0886db] | 2951 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 2952 | } |
---|
| 2953 | |
---|
[9c1600c] | 2954 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 2955 | // StmtExpr |
---|
[13932f14] | 2956 | template< typename pass_type > |
---|
[ab904dc] | 2957 | void PassVisitor< pass_type >::visit( StmtExpr * node ) { |
---|
[9c1600c] | 2958 | VISIT_START( node ); |
---|
| 2959 | |
---|
| 2960 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
[02fdb8e] | 2961 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
[9c1600c] | 2962 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
| 2963 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
| 2964 | |
---|
[e0886db] | 2965 | indexerScopedAccept( node->result , *this ); |
---|
[3c398b6] | 2966 | maybeAccept_impl ( node->statements , *this ); |
---|
| 2967 | maybeAccept_impl ( node->returnDecls, *this ); |
---|
| 2968 | maybeAccept_impl ( node->dtors , *this ); |
---|
[9c1600c] | 2969 | |
---|
| 2970 | VISIT_END( node ); |
---|
[13932f14] | 2971 | } |
---|
| 2972 | |
---|
[7870799] | 2973 | template< typename pass_type > |
---|
| 2974 | void PassVisitor< pass_type >::visit( const StmtExpr * node ) { |
---|
| 2975 | VISIT_START( node ); |
---|
| 2976 | |
---|
[e3d7f9f] | 2977 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
| 2978 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
| 2979 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
| 2980 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
| 2981 | |
---|
| 2982 | indexerScopedAccept( node->result , *this ); |
---|
| 2983 | maybeAccept_impl ( node->statements , *this ); |
---|
| 2984 | maybeAccept_impl ( node->returnDecls, *this ); |
---|
| 2985 | maybeAccept_impl ( node->dtors , *this ); |
---|
[7870799] | 2986 | |
---|
| 2987 | VISIT_END( node ); |
---|
| 2988 | } |
---|
| 2989 | |
---|
[296b2be] | 2990 | template< typename pass_type > |
---|
| 2991 | Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) { |
---|
| 2992 | MUTATE_START( node ); |
---|
[4551a6e] | 2993 | |
---|
[296b2be] | 2994 | // don't want statements from outer CompoundStmts to be added to this StmtExpr |
---|
[02fdb8e] | 2995 | ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() ); |
---|
[134322e] | 2996 | ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); |
---|
| 2997 | ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); |
---|
[296b2be] | 2998 | |
---|
[e0886db] | 2999 | indexerScopedMutate( node->result , *this ); |
---|
[3c398b6] | 3000 | maybeMutate_impl ( node->statements , *this ); |
---|
| 3001 | maybeMutate_impl ( node->returnDecls, *this ); |
---|
| 3002 | maybeMutate_impl ( node->dtors , *this ); |
---|
[296b2be] | 3003 | |
---|
| 3004 | MUTATE_END( Expression, node ); |
---|
| 3005 | } |
---|
| 3006 | |
---|
[e0886db] | 3007 | //-------------------------------------------------------------------------- |
---|
| 3008 | // UniqueExpr |
---|
[13932f14] | 3009 | template< typename pass_type > |
---|
[ab904dc] | 3010 | void PassVisitor< pass_type >::visit( UniqueExpr * node ) { |
---|
[e0886db] | 3011 | VISIT_START( node ); |
---|
| 3012 | |
---|
| 3013 | indexerScopedAccept( node->result, *this ); |
---|
[3c398b6] | 3014 | maybeAccept_impl ( node->expr , *this ); |
---|
[e0886db] | 3015 | |
---|
| 3016 | VISIT_END( node ); |
---|
| 3017 | } |
---|
| 3018 | |
---|
[7870799] | 3019 | template< typename pass_type > |
---|
| 3020 | void PassVisitor< pass_type >::visit( const UniqueExpr * node ) { |
---|
| 3021 | VISIT_START( node ); |
---|
| 3022 | |
---|
[e3d7f9f] | 3023 | indexerScopedAccept( node->result, *this ); |
---|
| 3024 | maybeAccept_impl ( node->expr , *this ); |
---|
[7870799] | 3025 | |
---|
| 3026 | VISIT_END( node ); |
---|
| 3027 | } |
---|
| 3028 | |
---|
[e0886db] | 3029 | template< typename pass_type > |
---|
| 3030 | Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) { |
---|
| 3031 | MUTATE_START( node ); |
---|
| 3032 | |
---|
| 3033 | indexerScopedMutate( node->env , *this ); |
---|
| 3034 | indexerScopedMutate( node->result, *this ); |
---|
[3c398b6] | 3035 | maybeMutate_impl ( node->expr , *this ); |
---|
[e0886db] | 3036 | |
---|
| 3037 | MUTATE_END( Expression, node ); |
---|
[13932f14] | 3038 | } |
---|
| 3039 | |
---|
[73367a8] | 3040 | //-------------------------------------------------------------------------- |
---|
| 3041 | // UntypedInitExpr |
---|
| 3042 | template< typename pass_type > |
---|
| 3043 | void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) { |
---|
| 3044 | VISIT_START( node ); |
---|
| 3045 | |
---|
| 3046 | indexerScopedAccept( node->result, *this ); |
---|
| 3047 | maybeAccept_impl ( node->expr , *this ); |
---|
| 3048 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
| 3049 | |
---|
| 3050 | VISIT_END( node ); |
---|
| 3051 | } |
---|
| 3052 | |
---|
[7870799] | 3053 | template< typename pass_type > |
---|
| 3054 | void PassVisitor< pass_type >::visit( const UntypedInitExpr * node ) { |
---|
| 3055 | VISIT_START( node ); |
---|
| 3056 | |
---|
[e3d7f9f] | 3057 | indexerScopedAccept( node->result, *this ); |
---|
| 3058 | maybeAccept_impl ( node->expr , *this ); |
---|
[7870799] | 3059 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
| 3060 | |
---|
| 3061 | VISIT_END( node ); |
---|
| 3062 | } |
---|
| 3063 | |
---|
[73367a8] | 3064 | template< typename pass_type > |
---|
| 3065 | Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) { |
---|
| 3066 | MUTATE_START( node ); |
---|
| 3067 | |
---|
| 3068 | indexerScopedMutate( node->env , *this ); |
---|
| 3069 | indexerScopedMutate( node->result, *this ); |
---|
| 3070 | maybeMutate_impl ( node->expr , *this ); |
---|
| 3071 | // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. |
---|
| 3072 | |
---|
| 3073 | MUTATE_END( Expression, node ); |
---|
| 3074 | } |
---|
| 3075 | |
---|
| 3076 | //-------------------------------------------------------------------------- |
---|
| 3077 | // InitExpr |
---|
| 3078 | template< typename pass_type > |
---|
| 3079 | void PassVisitor< pass_type >::visit( InitExpr * node ) { |
---|
| 3080 | VISIT_START( node ); |
---|
| 3081 | |
---|
| 3082 | indexerScopedAccept( node->result, *this ); |
---|
| 3083 | maybeAccept_impl ( node->expr , *this ); |
---|
| 3084 | maybeAccept_impl ( node->designation, *this ); |
---|
| 3085 | |
---|
| 3086 | VISIT_END( node ); |
---|
| 3087 | } |
---|
| 3088 | |
---|
[7870799] | 3089 | template< typename pass_type > |
---|
| 3090 | void PassVisitor< pass_type >::visit( const InitExpr * node ) { |
---|
| 3091 | VISIT_START( node ); |
---|
| 3092 | |
---|
[e3d7f9f] | 3093 | indexerScopedAccept( node->result, *this ); |
---|
| 3094 | maybeAccept_impl ( node->expr , *this ); |
---|
| 3095 | maybeAccept_impl ( node->designation, *this ); |
---|
[7870799] | 3096 | |
---|
| 3097 | VISIT_END( node ); |
---|
| 3098 | } |
---|
| 3099 | |
---|
[73367a8] | 3100 | template< typename pass_type > |
---|
| 3101 | Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) { |
---|
| 3102 | MUTATE_START( node ); |
---|
| 3103 | |
---|
| 3104 | indexerScopedMutate( node->env , *this ); |
---|
| 3105 | indexerScopedMutate( node->result, *this ); |
---|
| 3106 | maybeMutate_impl ( node->expr , *this ); |
---|
| 3107 | maybeMutate_impl ( node->designation, *this ); |
---|
| 3108 | |
---|
| 3109 | MUTATE_END( Expression, node ); |
---|
| 3110 | } |
---|
| 3111 | |
---|
[44b4114] | 3112 | //-------------------------------------------------------------------------- |
---|
| 3113 | // DeletedExpr |
---|
| 3114 | template< typename pass_type > |
---|
| 3115 | void PassVisitor< pass_type >::visit( DeletedExpr * node ) { |
---|
| 3116 | VISIT_START( node ); |
---|
| 3117 | |
---|
| 3118 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 3119 | maybeAccept_impl ( node->expr, *this ); |
---|
[44b4114] | 3120 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. |
---|
| 3121 | |
---|
| 3122 | VISIT_END( node ); |
---|
| 3123 | } |
---|
| 3124 | |
---|
[7870799] | 3125 | template< typename pass_type > |
---|
| 3126 | void PassVisitor< pass_type >::visit( const DeletedExpr * node ) { |
---|
| 3127 | VISIT_START( node ); |
---|
| 3128 | |
---|
[e3d7f9f] | 3129 | indexerScopedAccept( node->result, *this ); |
---|
| 3130 | maybeAccept_impl ( node->expr, *this ); |
---|
[7870799] | 3131 | // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. |
---|
| 3132 | |
---|
| 3133 | VISIT_END( node ); |
---|
| 3134 | } |
---|
| 3135 | |
---|
[44b4114] | 3136 | template< typename pass_type > |
---|
| 3137 | Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) { |
---|
| 3138 | MUTATE_START( node ); |
---|
| 3139 | |
---|
| 3140 | indexerScopedMutate( node->env, *this ); |
---|
| 3141 | indexerScopedMutate( node->result, *this ); |
---|
| 3142 | maybeMutate_impl( node->expr, *this ); |
---|
| 3143 | |
---|
| 3144 | MUTATE_END( Expression, node ); |
---|
| 3145 | } |
---|
| 3146 | |
---|
[0f79853] | 3147 | //-------------------------------------------------------------------------- |
---|
| 3148 | // DefaultArgExpr |
---|
| 3149 | template< typename pass_type > |
---|
| 3150 | void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) { |
---|
| 3151 | VISIT_START( node ); |
---|
| 3152 | |
---|
| 3153 | indexerScopedAccept( node->result, *this ); |
---|
[e3d7f9f] | 3154 | maybeAccept_impl ( node->expr, *this ); |
---|
[0f79853] | 3155 | |
---|
| 3156 | VISIT_END( node ); |
---|
| 3157 | } |
---|
| 3158 | |
---|
[7870799] | 3159 | template< typename pass_type > |
---|
| 3160 | void PassVisitor< pass_type >::visit( const DefaultArgExpr * node ) { |
---|
| 3161 | VISIT_START( node ); |
---|
| 3162 | |
---|
[e3d7f9f] | 3163 | indexerScopedAccept( node->result, *this ); |
---|
| 3164 | maybeAccept_impl ( node->expr, *this ); |
---|
[7870799] | 3165 | |
---|
| 3166 | VISIT_END( node ); |
---|
| 3167 | } |
---|
| 3168 | |
---|
[0f79853] | 3169 | template< typename pass_type > |
---|
| 3170 | Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) { |
---|
| 3171 | MUTATE_START( node ); |
---|
| 3172 | |
---|
| 3173 | indexerScopedMutate( node->env, *this ); |
---|
| 3174 | indexerScopedMutate( node->result, *this ); |
---|
| 3175 | maybeMutate_impl( node->expr, *this ); |
---|
| 3176 | |
---|
| 3177 | MUTATE_END( Expression, node ); |
---|
| 3178 | } |
---|
| 3179 | |
---|
[d807ca28] | 3180 | //-------------------------------------------------------------------------- |
---|
| 3181 | // GenericExpr |
---|
| 3182 | template< typename pass_type > |
---|
| 3183 | void PassVisitor< pass_type >::visit( GenericExpr * node ) { |
---|
| 3184 | VISIT_START( node ); |
---|
| 3185 | |
---|
| 3186 | indexerScopedAccept( node->result, *this ); |
---|
| 3187 | maybeAccept_impl( node->control, *this ); |
---|
| 3188 | for ( GenericExpr::Association & assoc : node->associations ) { |
---|
| 3189 | indexerScopedAccept( assoc.type, *this ); |
---|
| 3190 | maybeAccept_impl( assoc.expr, *this ); |
---|
| 3191 | } |
---|
| 3192 | |
---|
| 3193 | VISIT_END( node ); |
---|
| 3194 | } |
---|
| 3195 | |
---|
[7870799] | 3196 | template< typename pass_type > |
---|
| 3197 | void PassVisitor< pass_type >::visit( const GenericExpr * node ) { |
---|
| 3198 | VISIT_START( node ); |
---|
| 3199 | |
---|
[e3d7f9f] | 3200 | indexerScopedAccept( node->result, *this ); |
---|
[7870799] | 3201 | maybeAccept_impl( node->control, *this ); |
---|
| 3202 | for ( const GenericExpr::Association & assoc : node->associations ) { |
---|
[e3d7f9f] | 3203 | indexerScopedAccept( assoc.type, *this ); |
---|
[7870799] | 3204 | maybeAccept_impl( assoc.expr, *this ); |
---|
| 3205 | } |
---|
| 3206 | |
---|
| 3207 | VISIT_END( node ); |
---|
| 3208 | } |
---|
| 3209 | |
---|
[d807ca28] | 3210 | template< typename pass_type > |
---|
| 3211 | Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) { |
---|
| 3212 | MUTATE_START( node ); |
---|
| 3213 | |
---|
| 3214 | indexerScopedMutate( node->env, *this ); |
---|
| 3215 | indexerScopedMutate( node->result, *this ); |
---|
| 3216 | maybeMutate_impl( node->control, *this ); |
---|
| 3217 | for ( GenericExpr::Association & assoc : node->associations ) { |
---|
| 3218 | indexerScopedMutate( assoc.type, *this ); |
---|
| 3219 | maybeMutate_impl( assoc.expr, *this ); |
---|
| 3220 | } |
---|
| 3221 | |
---|
| 3222 | MUTATE_END( Expression, node ); |
---|
| 3223 | } |
---|
| 3224 | |
---|
[17fc7a5] | 3225 | //-------------------------------------------------------------------------- |
---|
| 3226 | // VoidType |
---|
[13932f14] | 3227 | template< typename pass_type > |
---|
[ab904dc] | 3228 | void PassVisitor< pass_type >::visit( VoidType * node ) { |
---|
[599fbb6] | 3229 | VISIT_START( node ); |
---|
| 3230 | |
---|
| 3231 | maybeAccept_impl( node->forall, *this ); |
---|
| 3232 | |
---|
| 3233 | VISIT_END( node ); |
---|
| 3234 | } |
---|
| 3235 | |
---|
[7870799] | 3236 | template< typename pass_type > |
---|
| 3237 | void PassVisitor< pass_type >::visit( const VoidType * node ) { |
---|
| 3238 | VISIT_START( node ); |
---|
| 3239 | |
---|
| 3240 | maybeAccept_impl( node->forall, *this ); |
---|
| 3241 | |
---|
| 3242 | VISIT_END( node ); |
---|
| 3243 | } |
---|
| 3244 | |
---|
[599fbb6] | 3245 | template< typename pass_type > |
---|
| 3246 | Type * PassVisitor< pass_type >::mutate( VoidType * node ) { |
---|
| 3247 | MUTATE_START( node ); |
---|
| 3248 | |
---|
| 3249 | maybeMutate_impl( node->forall, *this ); |
---|
| 3250 | |
---|
| 3251 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3252 | } |
---|
| 3253 | |
---|
[17fc7a5] | 3254 | //-------------------------------------------------------------------------- |
---|
| 3255 | // BasicType |
---|
[13932f14] | 3256 | template< typename pass_type > |
---|
[ab904dc] | 3257 | void PassVisitor< pass_type >::visit( BasicType * node ) { |
---|
[17fc7a5] | 3258 | VISIT_START( node ); |
---|
| 3259 | |
---|
| 3260 | maybeAccept_impl( node->forall, *this ); |
---|
| 3261 | |
---|
| 3262 | VISIT_END( node ); |
---|
| 3263 | } |
---|
| 3264 | |
---|
[7870799] | 3265 | template< typename pass_type > |
---|
| 3266 | void PassVisitor< pass_type >::visit( const BasicType * node ) { |
---|
| 3267 | VISIT_START( node ); |
---|
| 3268 | |
---|
| 3269 | maybeAccept_impl( node->forall, *this ); |
---|
| 3270 | |
---|
| 3271 | VISIT_END( node ); |
---|
| 3272 | } |
---|
| 3273 | |
---|
[17fc7a5] | 3274 | template< typename pass_type > |
---|
| 3275 | Type * PassVisitor< pass_type >::mutate( BasicType * node ) { |
---|
| 3276 | MUTATE_START( node ); |
---|
| 3277 | |
---|
| 3278 | maybeMutate_impl( node->forall, *this ); |
---|
| 3279 | |
---|
| 3280 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3281 | } |
---|
| 3282 | |
---|
[17fc7a5] | 3283 | //-------------------------------------------------------------------------- |
---|
| 3284 | // PointerType |
---|
[13932f14] | 3285 | template< typename pass_type > |
---|
[ab904dc] | 3286 | void PassVisitor< pass_type >::visit( PointerType * node ) { |
---|
[17fc7a5] | 3287 | VISIT_START( node ); |
---|
| 3288 | |
---|
| 3289 | maybeAccept_impl( node->forall, *this ); |
---|
[6e50a6b] | 3290 | maybeAccept_impl( node->dimension, *this ); |
---|
[17fc7a5] | 3291 | maybeAccept_impl( node->base, *this ); |
---|
| 3292 | |
---|
| 3293 | VISIT_END( node ); |
---|
[13932f14] | 3294 | } |
---|
| 3295 | |
---|
[7870799] | 3296 | template< typename pass_type > |
---|
| 3297 | void PassVisitor< pass_type >::visit( const PointerType * node ) { |
---|
| 3298 | VISIT_START( node ); |
---|
| 3299 | |
---|
| 3300 | maybeAccept_impl( node->forall, *this ); |
---|
[6e50a6b] | 3301 | maybeAccept_impl( node->dimension, *this ); |
---|
[7870799] | 3302 | maybeAccept_impl( node->base, *this ); |
---|
| 3303 | |
---|
| 3304 | VISIT_END( node ); |
---|
| 3305 | } |
---|
| 3306 | |
---|
[17fc7a5] | 3307 | template< typename pass_type > |
---|
| 3308 | Type * PassVisitor< pass_type >::mutate( PointerType * node ) { |
---|
| 3309 | MUTATE_START( node ); |
---|
| 3310 | |
---|
| 3311 | maybeMutate_impl( node->forall, *this ); |
---|
[6e50a6b] | 3312 | maybeMutate_impl( node->dimension, *this ); |
---|
[17fc7a5] | 3313 | maybeMutate_impl( node->base, *this ); |
---|
| 3314 | |
---|
| 3315 | MUTATE_END( Type, node ); |
---|
| 3316 | } |
---|
| 3317 | |
---|
| 3318 | //-------------------------------------------------------------------------- |
---|
| 3319 | // ArrayType |
---|
[13932f14] | 3320 | template< typename pass_type > |
---|
[ab904dc] | 3321 | void PassVisitor< pass_type >::visit( ArrayType * node ) { |
---|
[17fc7a5] | 3322 | VISIT_START( node ); |
---|
| 3323 | |
---|
| 3324 | maybeAccept_impl( node->forall, *this ); |
---|
| 3325 | maybeAccept_impl( node->dimension, *this ); |
---|
| 3326 | maybeAccept_impl( node->base, *this ); |
---|
| 3327 | |
---|
| 3328 | VISIT_END( node ); |
---|
[13932f14] | 3329 | } |
---|
| 3330 | |
---|
[7870799] | 3331 | template< typename pass_type > |
---|
| 3332 | void PassVisitor< pass_type >::visit( const ArrayType * node ) { |
---|
| 3333 | VISIT_START( node ); |
---|
| 3334 | |
---|
| 3335 | maybeAccept_impl( node->forall, *this ); |
---|
| 3336 | maybeAccept_impl( node->dimension, *this ); |
---|
| 3337 | maybeAccept_impl( node->base, *this ); |
---|
| 3338 | |
---|
| 3339 | VISIT_END( node ); |
---|
| 3340 | } |
---|
| 3341 | |
---|
[17fc7a5] | 3342 | template< typename pass_type > |
---|
| 3343 | Type * PassVisitor< pass_type >::mutate( ArrayType * node ) { |
---|
| 3344 | MUTATE_START( node ); |
---|
| 3345 | |
---|
| 3346 | maybeMutate_impl( node->forall, *this ); |
---|
| 3347 | maybeMutate_impl( node->dimension, *this ); |
---|
| 3348 | maybeMutate_impl( node->base, *this ); |
---|
| 3349 | |
---|
| 3350 | MUTATE_END( Type, node ); |
---|
| 3351 | } |
---|
| 3352 | |
---|
| 3353 | //-------------------------------------------------------------------------- |
---|
| 3354 | // ReferenceType |
---|
[6b9b047] | 3355 | template< typename pass_type > |
---|
| 3356 | void PassVisitor< pass_type >::visit( ReferenceType * node ) { |
---|
[17fc7a5] | 3357 | VISIT_START( node ); |
---|
| 3358 | |
---|
| 3359 | maybeAccept_impl( node->forall, *this ); |
---|
| 3360 | maybeAccept_impl( node->base, *this ); |
---|
| 3361 | |
---|
| 3362 | VISIT_END( node ); |
---|
| 3363 | } |
---|
| 3364 | |
---|
[7870799] | 3365 | template< typename pass_type > |
---|
| 3366 | void PassVisitor< pass_type >::visit( const ReferenceType * node ) { |
---|
| 3367 | VISIT_START( node ); |
---|
| 3368 | |
---|
| 3369 | maybeAccept_impl( node->forall, *this ); |
---|
| 3370 | maybeAccept_impl( node->base, *this ); |
---|
| 3371 | |
---|
| 3372 | VISIT_END( node ); |
---|
| 3373 | } |
---|
| 3374 | |
---|
[17fc7a5] | 3375 | template< typename pass_type > |
---|
| 3376 | Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) { |
---|
| 3377 | MUTATE_START( node ); |
---|
| 3378 | |
---|
| 3379 | maybeMutate_impl( node->forall, *this ); |
---|
| 3380 | maybeMutate_impl( node->base, *this ); |
---|
| 3381 | |
---|
| 3382 | MUTATE_END( Type, node ); |
---|
[6b9b047] | 3383 | } |
---|
| 3384 | |
---|
[c5d7701] | 3385 | //-------------------------------------------------------------------------- |
---|
| 3386 | // QualifiedType |
---|
| 3387 | template< typename pass_type > |
---|
| 3388 | void PassVisitor< pass_type >::visit( QualifiedType * node ) { |
---|
| 3389 | VISIT_START( node ); |
---|
| 3390 | |
---|
| 3391 | maybeAccept_impl( node->forall, *this ); |
---|
[c194661] | 3392 | maybeAccept_impl( node->parent, *this ); |
---|
| 3393 | maybeAccept_impl( node->child, *this ); |
---|
[c5d7701] | 3394 | |
---|
| 3395 | VISIT_END( node ); |
---|
| 3396 | } |
---|
| 3397 | |
---|
[7870799] | 3398 | template< typename pass_type > |
---|
| 3399 | void PassVisitor< pass_type >::visit( const QualifiedType * node ) { |
---|
| 3400 | VISIT_START( node ); |
---|
| 3401 | |
---|
| 3402 | maybeAccept_impl( node->forall, *this ); |
---|
| 3403 | maybeAccept_impl( node->parent, *this ); |
---|
| 3404 | maybeAccept_impl( node->child, *this ); |
---|
| 3405 | |
---|
| 3406 | VISIT_END( node ); |
---|
| 3407 | } |
---|
| 3408 | |
---|
[c5d7701] | 3409 | template< typename pass_type > |
---|
| 3410 | Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) { |
---|
| 3411 | MUTATE_START( node ); |
---|
| 3412 | |
---|
| 3413 | maybeMutate_impl( node->forall, *this ); |
---|
[c194661] | 3414 | maybeMutate_impl( node->parent, *this ); |
---|
| 3415 | maybeMutate_impl( node->child, *this ); |
---|
[c5d7701] | 3416 | |
---|
| 3417 | MUTATE_END( Type, node ); |
---|
| 3418 | } |
---|
| 3419 | |
---|
[17fc7a5] | 3420 | //-------------------------------------------------------------------------- |
---|
| 3421 | // FunctionType |
---|
[13932f14] | 3422 | template< typename pass_type > |
---|
[ab904dc] | 3423 | void PassVisitor< pass_type >::visit( FunctionType * node ) { |
---|
[17fc7a5] | 3424 | VISIT_START( node ); |
---|
| 3425 | |
---|
| 3426 | maybeAccept_impl( node->forall, *this ); |
---|
| 3427 | maybeAccept_impl( node->returnVals, *this ); |
---|
| 3428 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3429 | |
---|
| 3430 | VISIT_END( node ); |
---|
| 3431 | } |
---|
| 3432 | |
---|
[7870799] | 3433 | template< typename pass_type > |
---|
| 3434 | void PassVisitor< pass_type >::visit( const FunctionType * node ) { |
---|
| 3435 | VISIT_START( node ); |
---|
| 3436 | |
---|
| 3437 | maybeAccept_impl( node->forall, *this ); |
---|
| 3438 | maybeAccept_impl( node->returnVals, *this ); |
---|
| 3439 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3440 | |
---|
| 3441 | VISIT_END( node ); |
---|
| 3442 | } |
---|
| 3443 | |
---|
[17fc7a5] | 3444 | template< typename pass_type > |
---|
| 3445 | Type * PassVisitor< pass_type >::mutate( FunctionType * node ) { |
---|
| 3446 | MUTATE_START( node ); |
---|
| 3447 | |
---|
| 3448 | maybeMutate_impl( node->forall, *this ); |
---|
| 3449 | maybeMutate_impl( node->returnVals, *this ); |
---|
| 3450 | maybeMutate_impl( node->parameters, *this ); |
---|
| 3451 | |
---|
| 3452 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3453 | } |
---|
| 3454 | |
---|
[e0886db] | 3455 | //-------------------------------------------------------------------------- |
---|
| 3456 | // StructInstType |
---|
[13932f14] | 3457 | template< typename pass_type > |
---|
[ab904dc] | 3458 | void PassVisitor< pass_type >::visit( StructInstType * node ) { |
---|
[e0886db] | 3459 | VISIT_START( node ); |
---|
| 3460 | |
---|
| 3461 | indexerAddStruct( node->name ); |
---|
| 3462 | |
---|
| 3463 | { |
---|
| 3464 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3465 | maybeAccept_impl( node->forall , *this ); |
---|
| 3466 | maybeAccept_impl( node->parameters, *this ); |
---|
[e0886db] | 3467 | } |
---|
| 3468 | |
---|
| 3469 | VISIT_END( node ); |
---|
| 3470 | } |
---|
| 3471 | |
---|
[7870799] | 3472 | template< typename pass_type > |
---|
| 3473 | void PassVisitor< pass_type >::visit( const StructInstType * node ) { |
---|
| 3474 | VISIT_START( node ); |
---|
| 3475 | |
---|
[e3d7f9f] | 3476 | indexerAddStruct( node->name ); |
---|
| 3477 | |
---|
| 3478 | { |
---|
| 3479 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 3480 | maybeAccept_impl( node->forall , *this ); |
---|
| 3481 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3482 | } |
---|
[7870799] | 3483 | |
---|
| 3484 | VISIT_END( node ); |
---|
| 3485 | } |
---|
| 3486 | |
---|
[e0886db] | 3487 | template< typename pass_type > |
---|
| 3488 | Type * PassVisitor< pass_type >::mutate( StructInstType * node ) { |
---|
| 3489 | MUTATE_START( node ); |
---|
| 3490 | |
---|
| 3491 | indexerAddStruct( node->name ); |
---|
| 3492 | |
---|
| 3493 | { |
---|
| 3494 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3495 | maybeMutate_impl( node->forall , *this ); |
---|
| 3496 | maybeMutate_impl( node->parameters, *this ); |
---|
[e0886db] | 3497 | } |
---|
| 3498 | |
---|
| 3499 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3500 | } |
---|
| 3501 | |
---|
[e0886db] | 3502 | //-------------------------------------------------------------------------- |
---|
| 3503 | // UnionInstType |
---|
[13932f14] | 3504 | template< typename pass_type > |
---|
[ab904dc] | 3505 | void PassVisitor< pass_type >::visit( UnionInstType * node ) { |
---|
[e0886db] | 3506 | VISIT_START( node ); |
---|
| 3507 | |
---|
[74e3263] | 3508 | indexerAddUnion( node->name ); |
---|
[e0886db] | 3509 | |
---|
| 3510 | { |
---|
| 3511 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3512 | maybeAccept_impl( node->forall , *this ); |
---|
| 3513 | maybeAccept_impl( node->parameters, *this ); |
---|
[e0886db] | 3514 | } |
---|
| 3515 | |
---|
| 3516 | VISIT_END( node ); |
---|
| 3517 | } |
---|
| 3518 | |
---|
[7870799] | 3519 | template< typename pass_type > |
---|
| 3520 | void PassVisitor< pass_type >::visit( const UnionInstType * node ) { |
---|
| 3521 | VISIT_START( node ); |
---|
| 3522 | |
---|
[74e3263] | 3523 | indexerAddUnion( node->name ); |
---|
[e3d7f9f] | 3524 | |
---|
| 3525 | { |
---|
| 3526 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
| 3527 | maybeAccept_impl( node->forall , *this ); |
---|
| 3528 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3529 | } |
---|
[7870799] | 3530 | |
---|
| 3531 | VISIT_END( node ); |
---|
| 3532 | } |
---|
| 3533 | |
---|
[e0886db] | 3534 | template< typename pass_type > |
---|
| 3535 | Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) { |
---|
| 3536 | MUTATE_START( node ); |
---|
| 3537 | |
---|
[74e3263] | 3538 | indexerAddUnion( node->name ); |
---|
[e0886db] | 3539 | |
---|
| 3540 | { |
---|
| 3541 | auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } ); |
---|
[3c398b6] | 3542 | maybeMutate_impl( node->forall , *this ); |
---|
| 3543 | maybeMutate_impl( node->parameters, *this ); |
---|
[e0886db] | 3544 | } |
---|
| 3545 | |
---|
| 3546 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3547 | } |
---|
| 3548 | |
---|
[e0886db] | 3549 | //-------------------------------------------------------------------------- |
---|
| 3550 | // EnumInstType |
---|
[13932f14] | 3551 | template< typename pass_type > |
---|
[ab904dc] | 3552 | void PassVisitor< pass_type >::visit( EnumInstType * node ) { |
---|
[86e84e4] | 3553 | VISIT_START( node ); |
---|
| 3554 | |
---|
| 3555 | maybeAccept_impl( node->forall, *this ); |
---|
| 3556 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3557 | |
---|
| 3558 | VISIT_END( node ); |
---|
[13932f14] | 3559 | } |
---|
| 3560 | |
---|
[7870799] | 3561 | template< typename pass_type > |
---|
| 3562 | void PassVisitor< pass_type >::visit( const EnumInstType * node ) { |
---|
| 3563 | VISIT_START( node ); |
---|
| 3564 | |
---|
| 3565 | maybeAccept_impl( node->forall, *this ); |
---|
| 3566 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3567 | |
---|
| 3568 | VISIT_END( node ); |
---|
| 3569 | } |
---|
| 3570 | |
---|
[e0886db] | 3571 | template< typename pass_type > |
---|
| 3572 | Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) { |
---|
[86e84e4] | 3573 | MUTATE_START( node ); |
---|
| 3574 | |
---|
| 3575 | maybeMutate_impl( node->forall, *this ); |
---|
| 3576 | maybeMutate_impl( node->parameters, *this ); |
---|
| 3577 | |
---|
| 3578 | MUTATE_END( Type, node ); |
---|
[e0886db] | 3579 | } |
---|
| 3580 | |
---|
| 3581 | //-------------------------------------------------------------------------- |
---|
| 3582 | // TraitInstType |
---|
[13932f14] | 3583 | template< typename pass_type > |
---|
[ab904dc] | 3584 | void PassVisitor< pass_type >::visit( TraitInstType * node ) { |
---|
[e0886db] | 3585 | VISIT_START( node ); |
---|
| 3586 | |
---|
[3c398b6] | 3587 | maybeAccept_impl( node->forall , *this ); |
---|
| 3588 | maybeAccept_impl( node->parameters, *this ); |
---|
[e0886db] | 3589 | |
---|
| 3590 | VISIT_END( node ); |
---|
| 3591 | } |
---|
| 3592 | |
---|
[7870799] | 3593 | template< typename pass_type > |
---|
| 3594 | void PassVisitor< pass_type >::visit( const TraitInstType * node ) { |
---|
| 3595 | VISIT_START( node ); |
---|
| 3596 | |
---|
| 3597 | maybeAccept_impl( node->forall , *this ); |
---|
| 3598 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3599 | |
---|
| 3600 | VISIT_END( node ); |
---|
| 3601 | } |
---|
| 3602 | |
---|
[e0886db] | 3603 | template< typename pass_type > |
---|
| 3604 | Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) { |
---|
| 3605 | MUTATE_START( node ); |
---|
| 3606 | |
---|
[3c398b6] | 3607 | maybeMutate_impl( node->forall , *this ); |
---|
| 3608 | maybeMutate_impl( node->parameters, *this ); |
---|
[e0886db] | 3609 | |
---|
| 3610 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3611 | } |
---|
| 3612 | |
---|
[e0886db] | 3613 | //-------------------------------------------------------------------------- |
---|
| 3614 | // TypeInstType |
---|
[13932f14] | 3615 | template< typename pass_type > |
---|
[ab904dc] | 3616 | void PassVisitor< pass_type >::visit( TypeInstType * node ) { |
---|
[86e84e4] | 3617 | VISIT_START( node ); |
---|
| 3618 | |
---|
| 3619 | maybeAccept_impl( node->forall , *this ); |
---|
| 3620 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3621 | |
---|
| 3622 | VISIT_END( node ); |
---|
| 3623 | } |
---|
| 3624 | |
---|
[7870799] | 3625 | template< typename pass_type > |
---|
| 3626 | void PassVisitor< pass_type >::visit( const TypeInstType * node ) { |
---|
| 3627 | VISIT_START( node ); |
---|
| 3628 | |
---|
| 3629 | maybeAccept_impl( node->forall , *this ); |
---|
| 3630 | maybeAccept_impl( node->parameters, *this ); |
---|
| 3631 | |
---|
| 3632 | VISIT_END( node ); |
---|
| 3633 | } |
---|
| 3634 | |
---|
[86e84e4] | 3635 | template< typename pass_type > |
---|
| 3636 | Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) { |
---|
| 3637 | MUTATE_START( node ); |
---|
| 3638 | |
---|
| 3639 | maybeMutate_impl( node->forall , *this ); |
---|
| 3640 | maybeMutate_impl( node->parameters, *this ); |
---|
| 3641 | |
---|
| 3642 | MUTATE_END( Type, node ); |
---|
[13932f14] | 3643 | } |
---|
| 3644 | |
---|
[a8a2b0a] | 3645 | //-------------------------------------------------------------------------- |
---|
| 3646 | // TupleType |
---|
[13932f14] | 3647 | template< typename pass_type > |
---|
[ab904dc] | 3648 | void PassVisitor< pass_type >::visit( TupleType * node ) { |
---|
[a8a2b0a] | 3649 | VISIT_START( node ); |
---|
| 3650 | |
---|
| 3651 | maybeAccept_impl( node->forall, *this ); |
---|
| 3652 | maybeAccept_impl( node->types, *this ); |
---|
| 3653 | maybeAccept_impl( node->members, *this ); |
---|
| 3654 | |
---|
| 3655 | VISIT_END( node ); |
---|
[13932f14] | 3656 | } |
---|
| 3657 | |
---|
[7870799] | 3658 | template< typename pass_type > |
---|
| 3659 | void PassVisitor< pass_type >::visit( const TupleType * node ) { |
---|
| 3660 | VISIT_START( node ); |
---|
| 3661 | |
---|
| 3662 | maybeAccept_impl( node->forall, *this ); |
---|
| 3663 | maybeAccept_impl( node->types, *this ); |
---|
| 3664 | maybeAccept_impl( node->members, *this ); |
---|
| 3665 | |
---|
| 3666 | VISIT_END( node ); |
---|
| 3667 | } |
---|
| 3668 | |
---|
[a8a2b0a] | 3669 | template< typename pass_type > |
---|
| 3670 | Type * PassVisitor< pass_type >::mutate( TupleType * node ) { |
---|
| 3671 | MUTATE_START( node ); |
---|
| 3672 | |
---|
| 3673 | maybeMutate_impl( node->forall, *this ); |
---|
| 3674 | maybeMutate_impl( node->types, *this ); |
---|
| 3675 | maybeMutate_impl( node->members, *this ); |
---|
| 3676 | |
---|
| 3677 | MUTATE_END( Type, node ); |
---|
| 3678 | } |
---|
| 3679 | |
---|
| 3680 | //-------------------------------------------------------------------------- |
---|
| 3681 | // TypeofType |
---|
[13932f14] | 3682 | template< typename pass_type > |
---|
[ab904dc] | 3683 | void PassVisitor< pass_type >::visit( TypeofType * node ) { |
---|
[a8a2b0a] | 3684 | VISIT_START( node ); |
---|
| 3685 | |
---|
| 3686 | assert( node->expr ); |
---|
| 3687 | maybeAccept_impl( node->expr, *this ); |
---|
| 3688 | |
---|
| 3689 | VISIT_END( node ); |
---|
[13932f14] | 3690 | } |
---|
| 3691 | |
---|
[7870799] | 3692 | template< typename pass_type > |
---|
| 3693 | void PassVisitor< pass_type >::visit( const TypeofType * node ) { |
---|
| 3694 | VISIT_START( node ); |
---|
| 3695 | |
---|
| 3696 | assert( node->expr ); |
---|
| 3697 | maybeAccept_impl( node->expr, *this ); |
---|
| 3698 | |
---|
| 3699 | VISIT_END( node ); |
---|
| 3700 | } |
---|
| 3701 | |
---|
[a8a2b0a] | 3702 | template< typename pass_type > |
---|
| 3703 | Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { |
---|
| 3704 | MUTATE_START( node ); |
---|
| 3705 | |
---|
| 3706 | assert( node->expr ); |
---|
| 3707 | maybeMutate_impl( node->expr, *this ); |
---|
| 3708 | |
---|
| 3709 | MUTATE_END( Type, node ); |
---|
| 3710 | } |
---|
| 3711 | |
---|
[7ff35e0e] | 3712 | //-------------------------------------------------------------------------- |
---|
| 3713 | // VTableType |
---|
| 3714 | template< typename pass_type > |
---|
| 3715 | void PassVisitor< pass_type >::visit( VTableType * node ) { |
---|
| 3716 | VISIT_START( node ); |
---|
| 3717 | |
---|
| 3718 | // Forall qualifiers should be on base type, not here |
---|
| 3719 | // maybeAccept_impl( node->forall, *this ); |
---|
| 3720 | maybeAccept_impl( node->base, *this ); |
---|
| 3721 | |
---|
| 3722 | VISIT_END( node ); |
---|
| 3723 | } |
---|
| 3724 | |
---|
| 3725 | template< typename pass_type > |
---|
| 3726 | void PassVisitor< pass_type >::visit( const VTableType * node ) { |
---|
| 3727 | VISIT_START( node ); |
---|
| 3728 | |
---|
| 3729 | // Forall qualifiers should be on base type, not here |
---|
| 3730 | // maybeAccept_impl( node->forall, *this ); |
---|
| 3731 | maybeAccept_impl( node->base, *this ); |
---|
| 3732 | |
---|
| 3733 | VISIT_END( node ); |
---|
| 3734 | } |
---|
| 3735 | |
---|
| 3736 | template< typename pass_type > |
---|
| 3737 | Type * PassVisitor< pass_type >::mutate( VTableType * node ) { |
---|
| 3738 | MUTATE_START( node ); |
---|
| 3739 | |
---|
| 3740 | // Forall qualifiers should be on base type, not here |
---|
| 3741 | // maybeMutate_impl( node->forall, *this ); |
---|
| 3742 | maybeMutate_impl( node->base, *this ); |
---|
| 3743 | |
---|
| 3744 | MUTATE_END( Type, node ); |
---|
| 3745 | } |
---|
| 3746 | |
---|
[a8a2b0a] | 3747 | //-------------------------------------------------------------------------- |
---|
| 3748 | // AttrType |
---|
[13932f14] | 3749 | template< typename pass_type > |
---|
[ab904dc] | 3750 | void PassVisitor< pass_type >::visit( AttrType * node ) { |
---|
[a8a2b0a] | 3751 | VISIT_START( node ); |
---|
| 3752 | |
---|
| 3753 | if ( node->isType ) { |
---|
| 3754 | assert( node->type ); |
---|
| 3755 | maybeAccept_impl( node->type, *this ); |
---|
| 3756 | } else { |
---|
| 3757 | assert( node->expr ); |
---|
| 3758 | maybeAccept_impl( node->expr, *this ); |
---|
| 3759 | } // if |
---|
| 3760 | |
---|
| 3761 | VISIT_END( node ); |
---|
[13932f14] | 3762 | } |
---|
| 3763 | |
---|
[7870799] | 3764 | template< typename pass_type > |
---|
| 3765 | void PassVisitor< pass_type >::visit( const AttrType * node ) { |
---|
| 3766 | VISIT_START( node ); |
---|
| 3767 | |
---|
| 3768 | if ( node->isType ) { |
---|
| 3769 | assert( node->type ); |
---|
| 3770 | maybeAccept_impl( node->type, *this ); |
---|
| 3771 | } else { |
---|
| 3772 | assert( node->expr ); |
---|
| 3773 | maybeAccept_impl( node->expr, *this ); |
---|
| 3774 | } // if |
---|
| 3775 | |
---|
| 3776 | VISIT_END( node ); |
---|
| 3777 | } |
---|
| 3778 | |
---|
[a8a2b0a] | 3779 | template< typename pass_type > |
---|
| 3780 | Type * PassVisitor< pass_type >::mutate( AttrType * node ) { |
---|
| 3781 | MUTATE_START( node ); |
---|
| 3782 | |
---|
| 3783 | if ( node->isType ) { |
---|
| 3784 | assert( node->type ); |
---|
| 3785 | maybeMutate_impl( node->type, *this ); |
---|
| 3786 | } else { |
---|
| 3787 | assert( node->expr ); |
---|
| 3788 | maybeMutate_impl( node->expr, *this ); |
---|
| 3789 | } // if |
---|
| 3790 | |
---|
| 3791 | MUTATE_END( Type, node ); |
---|
| 3792 | } |
---|
| 3793 | |
---|
| 3794 | //-------------------------------------------------------------------------- |
---|
| 3795 | // VarArgsType |
---|
[13932f14] | 3796 | template< typename pass_type > |
---|
[ab904dc] | 3797 | void PassVisitor< pass_type >::visit( VarArgsType * node ) { |
---|
[a8a2b0a] | 3798 | VISIT_START( node ); |
---|
| 3799 | |
---|
| 3800 | maybeAccept_impl( node->forall, *this ); |
---|
| 3801 | |
---|
| 3802 | VISIT_END( node ); |
---|
[13932f14] | 3803 | } |
---|
| 3804 | |
---|
[7870799] | 3805 | template< typename pass_type > |
---|
| 3806 | void PassVisitor< pass_type >::visit( const VarArgsType * node ) { |
---|
| 3807 | VISIT_START( node ); |
---|
| 3808 | |
---|
| 3809 | maybeAccept_impl( node->forall, *this ); |
---|
| 3810 | |
---|
| 3811 | VISIT_END( node ); |
---|
| 3812 | } |
---|
| 3813 | |
---|
[a8a2b0a] | 3814 | template< typename pass_type > |
---|
| 3815 | Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { |
---|
| 3816 | MUTATE_START( node ); |
---|
| 3817 | |
---|
| 3818 | maybeMutate_impl( node->forall, *this ); |
---|
| 3819 | |
---|
| 3820 | MUTATE_END( Type, node ); |
---|
| 3821 | } |
---|
| 3822 | |
---|
| 3823 | //-------------------------------------------------------------------------- |
---|
| 3824 | // ZeroType |
---|
[13932f14] | 3825 | template< typename pass_type > |
---|
[ab904dc] | 3826 | void PassVisitor< pass_type >::visit( ZeroType * node ) { |
---|
[a8a2b0a] | 3827 | VISIT_START( node ); |
---|
| 3828 | |
---|
| 3829 | maybeAccept_impl( node->forall, *this ); |
---|
| 3830 | |
---|
| 3831 | VISIT_END( node ); |
---|
[13932f14] | 3832 | } |
---|
| 3833 | |
---|
[7870799] | 3834 | template< typename pass_type > |
---|
| 3835 | void PassVisitor< pass_type >::visit( const ZeroType * node ) { |
---|
| 3836 | VISIT_START( node ); |
---|
| 3837 | |
---|
| 3838 | maybeAccept_impl( node->forall, *this ); |
---|
| 3839 | |
---|
| 3840 | VISIT_END( node ); |
---|
| 3841 | } |
---|
| 3842 | |
---|
[a8a2b0a] | 3843 | template< typename pass_type > |
---|
| 3844 | Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { |
---|
| 3845 | MUTATE_START( node ); |
---|
| 3846 | |
---|
| 3847 | maybeMutate_impl( node->forall, *this ); |
---|
| 3848 | |
---|
| 3849 | MUTATE_END( Type, node ); |
---|
| 3850 | } |
---|
| 3851 | |
---|
| 3852 | //-------------------------------------------------------------------------- |
---|
| 3853 | // OneType |
---|
[13932f14] | 3854 | template< typename pass_type > |
---|
[ab904dc] | 3855 | void PassVisitor< pass_type >::visit( OneType * node ) { |
---|
[a8a2b0a] | 3856 | VISIT_START( node ); |
---|
| 3857 | |
---|
| 3858 | maybeAccept_impl( node->forall, *this ); |
---|
| 3859 | |
---|
| 3860 | VISIT_END( node ); |
---|
[13932f14] | 3861 | } |
---|
| 3862 | |
---|
[7870799] | 3863 | template< typename pass_type > |
---|
| 3864 | void PassVisitor< pass_type >::visit( const OneType * node ) { |
---|
| 3865 | VISIT_START( node ); |
---|
| 3866 | |
---|
| 3867 | maybeAccept_impl( node->forall, *this ); |
---|
| 3868 | |
---|
| 3869 | VISIT_END( node ); |
---|
| 3870 | } |
---|
| 3871 | |
---|
[a8a2b0a] | 3872 | template< typename pass_type > |
---|
| 3873 | Type * PassVisitor< pass_type >::mutate( OneType * node ) { |
---|
| 3874 | MUTATE_START( node ); |
---|
| 3875 | |
---|
| 3876 | maybeMutate_impl( node->forall, *this ); |
---|
| 3877 | |
---|
| 3878 | MUTATE_END( Type, node ); |
---|
| 3879 | } |
---|
| 3880 | |
---|
[47498bd] | 3881 | //-------------------------------------------------------------------------- |
---|
| 3882 | // GlobalScopeType |
---|
| 3883 | template< typename pass_type > |
---|
| 3884 | void PassVisitor< pass_type >::visit( GlobalScopeType * node ) { |
---|
| 3885 | VISIT_START( node ); |
---|
| 3886 | |
---|
| 3887 | maybeAccept_impl( node->forall, *this ); |
---|
| 3888 | |
---|
| 3889 | VISIT_END( node ); |
---|
| 3890 | } |
---|
| 3891 | |
---|
[7870799] | 3892 | template< typename pass_type > |
---|
| 3893 | void PassVisitor< pass_type >::visit( const GlobalScopeType * node ) { |
---|
| 3894 | VISIT_START( node ); |
---|
| 3895 | |
---|
| 3896 | maybeAccept_impl( node->forall, *this ); |
---|
| 3897 | |
---|
| 3898 | VISIT_END( node ); |
---|
| 3899 | } |
---|
| 3900 | |
---|
[47498bd] | 3901 | template< typename pass_type > |
---|
| 3902 | Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) { |
---|
| 3903 | MUTATE_START( node ); |
---|
| 3904 | |
---|
| 3905 | maybeMutate_impl( node->forall, *this ); |
---|
| 3906 | |
---|
| 3907 | MUTATE_END( Type, node ); |
---|
| 3908 | } |
---|
| 3909 | |
---|
[a8a2b0a] | 3910 | //-------------------------------------------------------------------------- |
---|
| 3911 | // Designation |
---|
[b11d8e2] | 3912 | template< typename pass_type > |
---|
| 3913 | void PassVisitor< pass_type >::visit( Designation * node ) { |
---|
| 3914 | VISIT_START( node ); |
---|
| 3915 | |
---|
[a8a2b0a] | 3916 | maybeAccept_impl( node->designators, *this ); |
---|
[b11d8e2] | 3917 | |
---|
| 3918 | VISIT_END( node ); |
---|
| 3919 | } |
---|
| 3920 | |
---|
[7870799] | 3921 | template< typename pass_type > |
---|
| 3922 | void PassVisitor< pass_type >::visit( const Designation * node ) { |
---|
| 3923 | VISIT_START( node ); |
---|
| 3924 | |
---|
| 3925 | maybeAccept_impl( node->designators, *this ); |
---|
| 3926 | |
---|
| 3927 | VISIT_END( node ); |
---|
| 3928 | } |
---|
| 3929 | |
---|
[b11d8e2] | 3930 | template< typename pass_type > |
---|
| 3931 | Designation * PassVisitor< pass_type >::mutate( Designation * node ) { |
---|
| 3932 | MUTATE_START( node ); |
---|
| 3933 | |
---|
[a8a2b0a] | 3934 | maybeMutate_impl( node->designators, *this ); |
---|
[b11d8e2] | 3935 | |
---|
| 3936 | MUTATE_END( Designation, node ); |
---|
| 3937 | } |
---|
| 3938 | |
---|
[9c1600c] | 3939 | //-------------------------------------------------------------------------- |
---|
[e0886db] | 3940 | // SingleInit |
---|
[13932f14] | 3941 | template< typename pass_type > |
---|
[ab904dc] | 3942 | void PassVisitor< pass_type >::visit( SingleInit * node ) { |
---|
[9c1600c] | 3943 | VISIT_START( node ); |
---|
| 3944 | |
---|
[a8a2b0a] | 3945 | visitExpression( node->value ); |
---|
[9c1600c] | 3946 | |
---|
| 3947 | VISIT_END( node ); |
---|
[13932f14] | 3948 | } |
---|
| 3949 | |
---|
[7870799] | 3950 | template< typename pass_type > |
---|
| 3951 | void PassVisitor< pass_type >::visit( const SingleInit * node ) { |
---|
| 3952 | VISIT_START( node ); |
---|
| 3953 | |
---|
| 3954 | visitExpression( node->value ); |
---|
| 3955 | |
---|
| 3956 | VISIT_END( node ); |
---|
| 3957 | } |
---|
| 3958 | |
---|
[296b2be] | 3959 | template< typename pass_type > |
---|
| 3960 | Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) { |
---|
| 3961 | MUTATE_START( node ); |
---|
| 3962 | |
---|
[a8a2b0a] | 3963 | node->value = mutateExpression( node->value ); |
---|
[296b2be] | 3964 | |
---|
| 3965 | MUTATE_END( Initializer, node ); |
---|
| 3966 | } |
---|
| 3967 | |
---|
[a8a2b0a] | 3968 | //-------------------------------------------------------------------------- |
---|
| 3969 | // ListInit |
---|
[13932f14] | 3970 | template< typename pass_type > |
---|
[ab904dc] | 3971 | void PassVisitor< pass_type >::visit( ListInit * node ) { |
---|
[a8a2b0a] | 3972 | VISIT_START( node ); |
---|
[13932f14] | 3973 | |
---|
[a8a2b0a] | 3974 | maybeAccept_impl( node->designations, *this ); |
---|
| 3975 | maybeAccept_impl( node->initializers, *this ); |
---|
[13932f14] | 3976 | |
---|
[a8a2b0a] | 3977 | VISIT_END( node ); |
---|
[13932f14] | 3978 | } |
---|
| 3979 | |
---|
[7870799] | 3980 | template< typename pass_type > |
---|
| 3981 | void PassVisitor< pass_type >::visit( const ListInit * node ) { |
---|
| 3982 | VISIT_START( node ); |
---|
| 3983 | |
---|
| 3984 | maybeAccept_impl( node->designations, *this ); |
---|
| 3985 | maybeAccept_impl( node->initializers, *this ); |
---|
| 3986 | |
---|
| 3987 | VISIT_END( node ); |
---|
| 3988 | } |
---|
| 3989 | |
---|
[13932f14] | 3990 | template< typename pass_type > |
---|
[a8a2b0a] | 3991 | Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { |
---|
| 3992 | MUTATE_START( node ); |
---|
| 3993 | |
---|
| 3994 | maybeMutate_impl( node->designations, *this ); |
---|
| 3995 | maybeMutate_impl( node->initializers, *this ); |
---|
| 3996 | |
---|
| 3997 | MUTATE_END( Initializer, node ); |
---|
[13932f14] | 3998 | } |
---|
[ab904dc] | 3999 | |
---|
[a8a2b0a] | 4000 | //-------------------------------------------------------------------------- |
---|
| 4001 | // ConstructorInit |
---|
[5ea7a22] | 4002 | template< typename pass_type > |
---|
[a8a2b0a] | 4003 | void PassVisitor< pass_type >::visit( ConstructorInit * node ) { |
---|
| 4004 | VISIT_START( node ); |
---|
[5ea7a22] | 4005 | |
---|
[a8a2b0a] | 4006 | maybeAccept_impl( node->ctor, *this ); |
---|
| 4007 | maybeAccept_impl( node->dtor, *this ); |
---|
| 4008 | maybeAccept_impl( node->init, *this ); |
---|
[ab904dc] | 4009 | |
---|
[a8a2b0a] | 4010 | VISIT_END( node ); |
---|
[ab904dc] | 4011 | } |
---|
| 4012 | |
---|
[7870799] | 4013 | template< typename pass_type > |
---|
| 4014 | void PassVisitor< pass_type >::visit( const ConstructorInit * node ) { |
---|
| 4015 | VISIT_START( node ); |
---|
| 4016 | |
---|
| 4017 | maybeAccept_impl( node->ctor, *this ); |
---|
| 4018 | maybeAccept_impl( node->dtor, *this ); |
---|
| 4019 | maybeAccept_impl( node->init, *this ); |
---|
| 4020 | |
---|
| 4021 | VISIT_END( node ); |
---|
| 4022 | } |
---|
| 4023 | |
---|
[ab904dc] | 4024 | template< typename pass_type > |
---|
[a8a2b0a] | 4025 | Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { |
---|
| 4026 | MUTATE_START( node ); |
---|
[ab904dc] | 4027 | |
---|
[a8a2b0a] | 4028 | maybeMutate_impl( node->ctor, *this ); |
---|
| 4029 | maybeMutate_impl( node->dtor, *this ); |
---|
| 4030 | maybeMutate_impl( node->init, *this ); |
---|
[ab904dc] | 4031 | |
---|
[a8a2b0a] | 4032 | MUTATE_END( Initializer, node ); |
---|
[ab904dc] | 4033 | } |
---|
| 4034 | |
---|
[a8a2b0a] | 4035 | //-------------------------------------------------------------------------- |
---|
[798a8b3] | 4036 | // Constant |
---|
[ab904dc] | 4037 | template< typename pass_type > |
---|
[a8a2b0a] | 4038 | void PassVisitor< pass_type >::visit( Constant * node ) { |
---|
| 4039 | VISIT_START( node ); |
---|
| 4040 | |
---|
| 4041 | VISIT_END( node ); |
---|
[ab904dc] | 4042 | } |
---|
| 4043 | |
---|
[7870799] | 4044 | template< typename pass_type > |
---|
| 4045 | void PassVisitor< pass_type >::visit( const Constant * node ) { |
---|
| 4046 | VISIT_START( node ); |
---|
| 4047 | |
---|
| 4048 | VISIT_END( node ); |
---|
| 4049 | } |
---|
| 4050 | |
---|
[ab904dc] | 4051 | template< typename pass_type > |
---|
[a8a2b0a] | 4052 | Constant * PassVisitor< pass_type >::mutate( Constant * node ) { |
---|
| 4053 | MUTATE_START( node ); |
---|
| 4054 | |
---|
| 4055 | MUTATE_END( Constant, node ); |
---|
[ab904dc] | 4056 | } |
---|
| 4057 | |
---|
[a8a2b0a] | 4058 | //-------------------------------------------------------------------------- |
---|
| 4059 | // Attribute |
---|
[ab904dc] | 4060 | template< typename pass_type > |
---|
[a8a2b0a] | 4061 | void PassVisitor< pass_type >::visit( Attribute * node ) { |
---|
| 4062 | VISIT_START( node ); |
---|
| 4063 | |
---|
| 4064 | maybeAccept_impl( node->parameters, *this ); |
---|
| 4065 | |
---|
| 4066 | VISIT_END( node ); |
---|
[4551a6e] | 4067 | } |
---|
[5ea7a22] | 4068 | |
---|
[7870799] | 4069 | template< typename pass_type > |
---|
| 4070 | void PassVisitor< pass_type >::visit( const Attribute * node ) { |
---|
| 4071 | VISIT_START( node ); |
---|
| 4072 | |
---|
| 4073 | maybeAccept_impl( node->parameters, *this ); |
---|
| 4074 | |
---|
| 4075 | VISIT_END( node ); |
---|
| 4076 | } |
---|
| 4077 | |
---|
[5ea7a22] | 4078 | template< typename pass_type > |
---|
| 4079 | Attribute * PassVisitor< pass_type >::mutate( Attribute * node ) { |
---|
[a8a2b0a] | 4080 | MUTATE_START( node ); |
---|
| 4081 | |
---|
| 4082 | maybeMutate_impl( node->parameters, *this ); |
---|
| 4083 | |
---|
| 4084 | MUTATE_END( Attribute, node ); |
---|
[5ea7a22] | 4085 | } |
---|
[447c356] | 4086 | |
---|
[a8a2b0a] | 4087 | //-------------------------------------------------------------------------- |
---|
| 4088 | // TypeSubstitution |
---|
[447c356] | 4089 | template< typename pass_type > |
---|
| 4090 | TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) { |
---|
| 4091 | MUTATE_START( node ); |
---|
| 4092 | |
---|
| 4093 | for ( auto & p : node->typeEnv ) { |
---|
| 4094 | indexerScopedMutate( p.second, *this ); |
---|
| 4095 | } |
---|
| 4096 | for ( auto & p : node->varEnv ) { |
---|
| 4097 | indexerScopedMutate( p.second, *this ); |
---|
| 4098 | } |
---|
| 4099 | |
---|
| 4100 | MUTATE_END( TypeSubstitution, node ); |
---|
| 4101 | } |
---|
[342146e1] | 4102 | |
---|
| 4103 | #undef VISIT_START |
---|
| 4104 | #undef VISIT_END |
---|
| 4105 | |
---|
| 4106 | #undef MUTATE_START |
---|
[033ff37] | 4107 | #undef MUTATE_END |
---|