| 1 | #pragma once
 | 
|---|
| 2 | // IWYU pragma: private, include "PassVisitor.h"
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #define VISIT_START( node )                                     \
 | 
|---|
| 5 |         __attribute__((unused))                                   \
 | 
|---|
| 6 |         ChildrenGuard children_guard( get_visit_children_ptr() ); \
 | 
|---|
| 7 |         __attribute__((unused))                                   \
 | 
|---|
| 8 |         guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
 | 
|---|
| 9 |         call_previsit( node );                                    \
 | 
|---|
| 10 | 
 | 
|---|
| 11 | #define VISIT_END( node )                       \
 | 
|---|
| 12 |         call_postvisit( node );                   \
 | 
|---|
| 13 | 
 | 
|---|
| 14 | #define MUTATE_START( node )                                    \
 | 
|---|
| 15 |         __attribute__((unused))                                   \
 | 
|---|
| 16 |         ChildrenGuard children_guard( get_visit_children_ptr() ); \
 | 
|---|
| 17 |         __attribute__((unused))                                   \
 | 
|---|
| 18 |         guard_value_impl guard( at_cleanup_impl(pass, 0) );       \
 | 
|---|
| 19 |         call_premutate( node );                                   \
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #define MUTATE_END( type, node )                \
 | 
|---|
| 22 |         auto __return = call_postmutate< type * >( node ); \
 | 
|---|
| 23 |         assert( __return ); \
 | 
|---|
| 24 |         return __return;
 | 
|---|
| 25 | 
 | 
|---|
| 26 | 
 | 
|---|
| 27 | template<typename T>
 | 
|---|
| 28 | static inline bool empty( T * ptr ) {
 | 
|---|
| 29 |         return !ptr || ptr->empty();
 | 
|---|
| 30 | }
 | 
|---|
| 31 | 
 | 
|---|
| 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 {
 | 
|---|
| 42 |                         return new DeclStmt( decl );
 | 
|---|
| 43 |                 }
 | 
|---|
| 44 |         );
 | 
|---|
| 45 |         decls->clear();
 | 
|---|
| 46 | }
 | 
|---|
| 47 | 
 | 
|---|
| 48 | template< typename pass_type >
 | 
|---|
| 49 | inline void acceptAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& visitor ) {
 | 
|---|
| 50 |         DeclList_t* beforeDecls = visitor.get_beforeDecls();
 | 
|---|
| 51 |         DeclList_t* afterDecls  = visitor.get_afterDecls();
 | 
|---|
| 52 |         SemanticErrorException errors;
 | 
|---|
| 53 | 
 | 
|---|
| 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);
 | 
|---|
| 57 |         for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
 | 
|---|
| 58 | 
 | 
|---|
| 59 | 
 | 
|---|
| 60 |                 // splice in new declarations after previous decl
 | 
|---|
| 61 |                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
 | 
|---|
| 62 | 
 | 
|---|
| 63 |                 if ( i == decls.end() ) break;
 | 
|---|
| 64 | 
 | 
|---|
| 65 |                 try {
 | 
|---|
| 66 |                         // run visitor on declaration
 | 
|---|
| 67 |                         maybeAccept_impl( *i, visitor );
 | 
|---|
| 68 |                 } catch( SemanticErrorException &e ) {
 | 
|---|
| 69 |                         errors.append( e );
 | 
|---|
| 70 |                 }
 | 
|---|
| 71 | 
 | 
|---|
| 72 |                 // splice in new declarations before current decl
 | 
|---|
| 73 |                 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
 | 
|---|
| 74 |         }
 | 
|---|
| 75 |         pass_visitor_stats.depth--;
 | 
|---|
| 76 |         if ( ! errors.isEmpty() ) {
 | 
|---|
| 77 |                 throw errors;
 | 
|---|
| 78 |         }
 | 
|---|
| 79 | }
 | 
|---|
| 80 | 
 | 
|---|
| 81 | template< typename pass_type >
 | 
|---|
| 82 | inline void mutateAll( std::list< Declaration* > &decls, PassVisitor< pass_type >& mutator ) {
 | 
|---|
| 83 |         DeclList_t* beforeDecls = mutator.get_beforeDecls();
 | 
|---|
| 84 |         DeclList_t* afterDecls  = mutator.get_afterDecls();
 | 
|---|
| 85 |         SemanticErrorException errors;
 | 
|---|
| 86 | 
 | 
|---|
| 87 |         pass_visitor_stats.depth++;
 | 
|---|
| 88 |         pass_visitor_stats.max->push(pass_visitor_stats.depth);
 | 
|---|
| 89 |         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
 | 
|---|
| 90 |         for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
 | 
|---|
| 91 |                 // splice in new declarations after previous decl
 | 
|---|
| 92 |                 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
 | 
|---|
| 93 | 
 | 
|---|
| 94 |                 if ( i == decls.end() ) break;
 | 
|---|
| 95 |                 try {
 | 
|---|
| 96 |                         // run mutator on declaration
 | 
|---|
| 97 |                         maybeMutate_impl( *i, mutator );
 | 
|---|
| 98 |                 } catch( SemanticErrorException &e ) {
 | 
|---|
| 99 |                         errors.append( e );
 | 
|---|
| 100 |                 }
 | 
|---|
| 101 | 
 | 
|---|
| 102 |                 // splice in new declarations before current decl
 | 
|---|
| 103 |                 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
 | 
|---|
| 104 |         }
 | 
|---|
| 105 |         pass_visitor_stats.depth--;
 | 
|---|
| 106 |         if ( ! errors.isEmpty() ) {
 | 
|---|
| 107 |                 throw errors;
 | 
|---|
| 108 |         }
 | 
|---|
| 109 | }
 | 
|---|
| 110 | 
 | 
|---|
| 111 | template< typename TreeType, typename pass_type >
 | 
|---|
| 112 | inline void maybeAccept_impl( TreeType * tree, PassVisitor< pass_type > & visitor ) {
 | 
|---|
| 113 |         if ( ! visitor.get_visit_children() ) return;
 | 
|---|
| 114 |         if ( tree ) {
 | 
|---|
| 115 |                 tree->accept( visitor );
 | 
|---|
| 116 |         }
 | 
|---|
| 117 | }
 | 
|---|
| 118 | 
 | 
|---|
| 119 | template< typename Container, typename pass_type >
 | 
|---|
| 120 | inline void maybeAccept_impl( Container & container, PassVisitor< pass_type > & visitor ) {
 | 
|---|
| 121 |         if ( ! visitor.get_visit_children() ) return;
 | 
|---|
| 122 |         SemanticErrorException errors;
 | 
|---|
| 123 | 
 | 
|---|
| 124 |         pass_visitor_stats.depth++;
 | 
|---|
| 125 |         pass_visitor_stats.max->push(pass_visitor_stats.depth);
 | 
|---|
| 126 |         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
 | 
|---|
| 127 |         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
 | 
|---|
| 128 |                 try {
 | 
|---|
| 129 |                         if ( *i ) {
 | 
|---|
| 130 |                                 (*i)->accept( visitor );
 | 
|---|
| 131 |                         }
 | 
|---|
| 132 |                 } catch( SemanticErrorException &e ) {
 | 
|---|
| 133 |                         errors.append( e );
 | 
|---|
| 134 |                 }
 | 
|---|
| 135 |         }
 | 
|---|
| 136 |         pass_visitor_stats.depth--;
 | 
|---|
| 137 |         if ( ! errors.isEmpty() ) {
 | 
|---|
| 138 |                 throw errors;
 | 
|---|
| 139 |         }
 | 
|---|
| 140 | }
 | 
|---|
| 141 | 
 | 
|---|
| 142 | template< typename TreeType, typename pass_type >
 | 
|---|
| 143 | inline void maybeMutate_impl( TreeType *& tree, PassVisitor< pass_type > & mutator ) {
 | 
|---|
| 144 |         if ( ! mutator.get_visit_children() ) return;
 | 
|---|
| 145 | 
 | 
|---|
| 146 |         if ( tree ) {
 | 
|---|
| 147 |                 tree = strict_dynamic_cast< TreeType * >( tree->acceptMutator( mutator ) );
 | 
|---|
| 148 |         }
 | 
|---|
| 149 | }
 | 
|---|
| 150 | 
 | 
|---|
| 151 | template< typename Container, typename pass_type >
 | 
|---|
| 152 | inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) {
 | 
|---|
| 153 | 
 | 
|---|
| 154 |         if ( ! mutator.get_visit_children() ) return;
 | 
|---|
| 155 |         SemanticErrorException errors;
 | 
|---|
| 156 | 
 | 
|---|
| 157 |         pass_visitor_stats.depth++;
 | 
|---|
| 158 |         pass_visitor_stats.max->push(pass_visitor_stats.depth);
 | 
|---|
| 159 |         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
 | 
|---|
| 160 |         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
 | 
|---|
| 161 |                 try {
 | 
|---|
| 162 |                         if ( *i ) {
 | 
|---|
| 163 |                                 *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) );
 | 
|---|
| 164 |                                 assert( *i );
 | 
|---|
| 165 |                         } // if
 | 
|---|
| 166 |                 } catch( SemanticErrorException &e ) {
 | 
|---|
| 167 |                         errors.append( e );
 | 
|---|
| 168 |                 } // try
 | 
|---|
| 169 |         } // for
 | 
|---|
| 170 |         pass_visitor_stats.depth--;
 | 
|---|
| 171 |         if ( ! errors.isEmpty() ) {
 | 
|---|
| 172 |                 throw errors;
 | 
|---|
| 173 |         } // if
 | 
|---|
| 174 | }
 | 
|---|
| 175 | 
 | 
|---|
| 176 | template< typename pass_type >
 | 
|---|
| 177 | template< typename func_t >
 | 
|---|
| 178 | void PassVisitor< pass_type >::handleStatementList( std::list< Statement * > & statements, func_t func ) {
 | 
|---|
| 179 |         if ( ! get_visit_children() ) return;
 | 
|---|
| 180 |         SemanticErrorException errors;
 | 
|---|
| 181 | 
 | 
|---|
| 182 |         // don't want statements from outer CompoundStmts to be added to this CompoundStmt
 | 
|---|
| 183 |         ValueGuardPtr< StmtList_t > oldBeforeStmts( get_beforeStmts() );
 | 
|---|
| 184 |         ValueGuardPtr< StmtList_t > oldAfterStmts ( get_afterStmts () );
 | 
|---|
| 185 |         ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() );
 | 
|---|
| 186 |         ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () );
 | 
|---|
| 187 | 
 | 
|---|
| 188 |         StmtList_t* beforeStmts = get_beforeStmts();
 | 
|---|
| 189 |         StmtList_t* afterStmts  = get_afterStmts();
 | 
|---|
| 190 |         DeclList_t* beforeDecls = get_beforeDecls();
 | 
|---|
| 191 |         DeclList_t* afterDecls  = get_afterDecls();
 | 
|---|
| 192 | 
 | 
|---|
| 193 |         pass_visitor_stats.depth++;
 | 
|---|
| 194 |         pass_visitor_stats.max->push(pass_visitor_stats.depth);
 | 
|---|
| 195 |         pass_visitor_stats.avg->push(pass_visitor_stats.depth);
 | 
|---|
| 196 |         for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
 | 
|---|
| 197 | 
 | 
|---|
| 198 |                 if ( !empty( afterDecls ) ) { splice( std::inserter( statements, i ), afterDecls ); }
 | 
|---|
| 199 |                 if ( !empty( afterStmts ) ) { statements.splice( i, *afterStmts ); }
 | 
|---|
| 200 | 
 | 
|---|
| 201 |                 try {
 | 
|---|
| 202 |                         func( *i );
 | 
|---|
| 203 |                         assert( *i );
 | 
|---|
| 204 |                         assert(( empty( beforeStmts ) && empty( afterStmts ))
 | 
|---|
| 205 |                             || ( empty( beforeDecls ) && empty( afterDecls )) );
 | 
|---|
| 206 | 
 | 
|---|
| 207 |                 } catch ( SemanticErrorException &e ) {
 | 
|---|
| 208 |                         errors.append( e );
 | 
|---|
| 209 |                 }
 | 
|---|
| 210 | 
 | 
|---|
| 211 |                 if ( !empty( beforeDecls ) ) { splice( std::inserter( statements, i ), beforeDecls ); }
 | 
|---|
| 212 |                 if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
 | 
|---|
| 213 |         }
 | 
|---|
| 214 |         pass_visitor_stats.depth--;
 | 
|---|
| 215 | 
 | 
|---|
| 216 |         if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
 | 
|---|
| 217 |         if ( !empty( afterStmts ) ) { statements.splice( statements.end(), *afterStmts ); }
 | 
|---|
| 218 |         if ( !errors.isEmpty() ) { throw errors; }
 | 
|---|
| 219 | }
 | 
|---|
| 220 | 
 | 
|---|
| 221 | template< typename pass_type >
 | 
|---|
| 222 | void PassVisitor< pass_type >::visitStatementList( std::list< Statement * > & statements ) {
 | 
|---|
| 223 |         handleStatementList( statements, [this]( Statement * stmt) {
 | 
|---|
| 224 |                 maybeAccept_impl( stmt, *this );
 | 
|---|
| 225 |         });
 | 
|---|
| 226 | }
 | 
|---|
| 227 | 
 | 
|---|
| 228 | template< typename pass_type >
 | 
|---|
| 229 | void PassVisitor< pass_type >::mutateStatementList( std::list< Statement * > & statements ) {
 | 
|---|
| 230 |         handleStatementList( statements, [this]( Statement *& stmt) {
 | 
|---|
| 231 |                 maybeMutate_impl( stmt, *this );
 | 
|---|
| 232 |         });
 | 
|---|
| 233 | }
 | 
|---|
| 234 | 
 | 
|---|
| 235 | 
 | 
|---|
| 236 | template< typename pass_type >
 | 
|---|
| 237 | template< typename func_t >
 | 
|---|
| 238 | Statement * PassVisitor< pass_type >::handleStatement( Statement * stmt, func_t func ) {
 | 
|---|
| 239 |         if ( ! get_visit_children() ) return stmt;
 | 
|---|
| 240 | 
 | 
|---|
| 241 |         // don't want statements from outer CompoundStmts to be added to this CompoundStmt
 | 
|---|
| 242 |         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
 | 
|---|
| 243 |         ValueGuardPtr< DeclList_t >          oldBeforeDecls( get_beforeDecls() );
 | 
|---|
| 244 |         ValueGuardPtr< DeclList_t >          oldAfterDecls ( get_afterDecls () );
 | 
|---|
| 245 |         ValueGuardPtr< StmtList_t >          oldBeforeStmts( get_beforeStmts() );
 | 
|---|
| 246 |         ValueGuardPtr< StmtList_t >          oldAfterStmts ( get_afterStmts () );
 | 
|---|
| 247 | 
 | 
|---|
| 248 |         Statement *newStmt = func( stmt );
 | 
|---|
| 249 | 
 | 
|---|
| 250 |         StmtList_t* beforeStmts = get_beforeStmts();
 | 
|---|
| 251 |         StmtList_t* afterStmts  = get_afterStmts();
 | 
|---|
| 252 |         DeclList_t* beforeDecls = get_beforeDecls();
 | 
|---|
| 253 |         DeclList_t* afterDecls  = get_afterDecls();
 | 
|---|
| 254 | 
 | 
|---|
| 255 |         if( empty(beforeStmts) && empty(afterStmts) && empty(beforeDecls) && empty(afterDecls) ) { return newStmt; }
 | 
|---|
| 256 |         assert(( empty( beforeStmts ) && empty( afterStmts ))
 | 
|---|
| 257 |             || ( empty( beforeDecls ) && empty( afterDecls )) );
 | 
|---|
| 258 | 
 | 
|---|
| 259 |         CompoundStmt *compound = new CompoundStmt();
 | 
|---|
| 260 |         if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
 | 
|---|
| 261 |         if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
 | 
|---|
| 262 |         compound->get_kids().push_back( newStmt );
 | 
|---|
| 263 |         if( !empty(afterDecls) ) { splice( std::back_inserter( compound->get_kids() ), afterDecls ); }
 | 
|---|
| 264 |         if( !empty(afterStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *afterStmts ); }
 | 
|---|
| 265 |         return compound;
 | 
|---|
| 266 | }
 | 
|---|
| 267 | 
 | 
|---|
| 268 | template< typename pass_type >
 | 
|---|
| 269 | Statement * PassVisitor< pass_type >::visitStatement( Statement * stmt ) {
 | 
|---|
| 270 |         return handleStatement( stmt, [this]( Statement * stmt ) {
 | 
|---|
| 271 |                 maybeAccept_impl( stmt, *this );
 | 
|---|
| 272 |                 return stmt;
 | 
|---|
| 273 |         });
 | 
|---|
| 274 | }
 | 
|---|
| 275 | 
 | 
|---|
| 276 | template< typename pass_type >
 | 
|---|
| 277 | Statement * PassVisitor< pass_type >::mutateStatement( Statement * stmt ) {
 | 
|---|
| 278 |         return handleStatement( stmt, [this]( Statement * stmt ) {
 | 
|---|
| 279 |                 maybeMutate_impl( stmt, *this );
 | 
|---|
| 280 |                 return stmt;
 | 
|---|
| 281 |         });
 | 
|---|
| 282 | }
 | 
|---|
| 283 | 
 | 
|---|
| 284 | template< typename pass_type >
 | 
|---|
| 285 | template< typename func_t >
 | 
|---|
| 286 | Expression * PassVisitor< pass_type >::handleExpression( Expression * expr, func_t func ) {
 | 
|---|
| 287 |         if ( ! get_visit_children() ) return expr;
 | 
|---|
| 288 |         if( !expr ) return nullptr;
 | 
|---|
| 289 | 
 | 
|---|
| 290 |         auto env_ptr = get_env_ptr();
 | 
|---|
| 291 |         if ( env_ptr && expr->get_env() ) {
 | 
|---|
| 292 |                 *env_ptr = expr->get_env();
 | 
|---|
| 293 |         }
 | 
|---|
| 294 | 
 | 
|---|
| 295 |         // should env be moved onto the result of the mutate?
 | 
|---|
| 296 |         return func( expr );
 | 
|---|
| 297 | }
 | 
|---|
| 298 | 
 | 
|---|
| 299 | template< typename pass_type >
 | 
|---|
| 300 | Expression * PassVisitor< pass_type >::visitExpression( Expression * expr ) {
 | 
|---|
| 301 |         return handleExpression(expr, [this]( Expression * expr ) {
 | 
|---|
| 302 |                 maybeAccept_impl( expr, *this );
 | 
|---|
| 303 |                 return expr;
 | 
|---|
| 304 |         });
 | 
|---|
| 305 | }
 | 
|---|
| 306 | 
 | 
|---|
| 307 | template< typename pass_type >
 | 
|---|
| 308 | Expression * PassVisitor< pass_type >::mutateExpression( Expression * expr ) {
 | 
|---|
| 309 |         return handleExpression(expr, [this]( Expression * expr ) {
 | 
|---|
| 310 |                 maybeMutate_impl( expr, *this );
 | 
|---|
| 311 |                 return expr;
 | 
|---|
| 312 |         });
 | 
|---|
| 313 | }
 | 
|---|
| 314 | 
 | 
|---|
| 315 | template< typename TreeType, typename VisitorType >
 | 
|---|
| 316 | inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
 | 
|---|
| 317 |         if ( ! visitor.get_visit_children() ) return;
 | 
|---|
| 318 |         auto guard = makeFuncGuard(
 | 
|---|
| 319 |                 [&visitor]() { visitor.indexerScopeEnter(); },
 | 
|---|
| 320 |                 [&visitor]() { visitor.indexerScopeLeave(); }
 | 
|---|
| 321 |         );
 | 
|---|
| 322 |         maybeAccept_impl( tree, visitor );
 | 
|---|
| 323 | }
 | 
|---|
| 324 | 
 | 
|---|
| 325 | template< typename TreeType, typename MutatorType >
 | 
|---|
| 326 | inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) {
 | 
|---|
| 327 |         if ( ! mutator.get_visit_children() ) return;
 | 
|---|
| 328 |         auto guard = makeFuncGuard(
 | 
|---|
| 329 |                 [&mutator]() { mutator.indexerScopeEnter(); },
 | 
|---|
| 330 |                 [&mutator]() { mutator.indexerScopeLeave(); }
 | 
|---|
| 331 |         );
 | 
|---|
| 332 |         maybeMutate_impl( tree, mutator );
 | 
|---|
| 333 | }
 | 
|---|
| 334 | 
 | 
|---|
| 335 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 | 
|---|
| 336 | //========================================================================================================================================================================
 | 
|---|
| 337 | //========================================================================================================================================================================
 | 
|---|
| 338 | //========================================================================================================================================================================
 | 
|---|
| 339 | //========================================================================================================================================================================
 | 
|---|
| 340 | //========================================================================================================================================================================
 | 
|---|
| 341 | //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 | 
|---|
| 342 | 
 | 
|---|
| 343 | // A NOTE ON THE ORDER OF TRAVERSAL
 | 
|---|
| 344 | //
 | 
|---|
| 345 | // Types and typedefs have their base types visited before they are added to the type table.  This is ok, since there is
 | 
|---|
| 346 | // no such thing as a recursive type or typedef.
 | 
|---|
| 347 | //
 | 
|---|
| 348 | //             typedef struct { T *x; } T; // never allowed
 | 
|---|
| 349 | //
 | 
|---|
| 350 | // for structs/unions, it is possible to have recursion, so the decl should be added as if it's incomplete to begin, the
 | 
|---|
| 351 | // members are traversed, and then the complete type should be added (assuming the type is completed by this particular
 | 
|---|
| 352 | // declaration).
 | 
|---|
| 353 | //
 | 
|---|
| 354 | //             struct T { struct T *x; }; // allowed
 | 
|---|
| 355 | //
 | 
|---|
| 356 | // It is important to add the complete type to the symbol table *after* the members/base has been traversed, since that
 | 
|---|
| 357 | // traversal may modify the definition of the type and these modifications should be visible when the symbol table is
 | 
|---|
| 358 | // queried later in this pass.
 | 
|---|
| 359 | //
 | 
|---|
| 360 | // TODO: figure out whether recursive contexts are sensible/possible/reasonable.
 | 
|---|
| 361 | 
 | 
|---|
| 362 | //--------------------------------------------------------------------------
 | 
|---|
| 363 | // ObjectDecl
 | 
|---|
| 364 | template< typename pass_type >
 | 
|---|
| 365 | void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
 | 
|---|
| 366 |         VISIT_START( node );
 | 
|---|
| 367 | 
 | 
|---|
| 368 |         indexerScopedAccept( node->type         , *this );
 | 
|---|
| 369 |         maybeAccept_impl   ( node->init         , *this );
 | 
|---|
| 370 |         maybeAccept_impl   ( node->bitfieldWidth, *this );
 | 
|---|
| 371 |         maybeAccept_impl   ( node->attributes   , *this );
 | 
|---|
| 372 | 
 | 
|---|
| 373 |         indexerAddId( node );
 | 
|---|
| 374 | 
 | 
|---|
| 375 |         VISIT_END( node );
 | 
|---|
| 376 | }
 | 
|---|
| 377 | 
 | 
|---|
| 378 | template< typename pass_type >
 | 
|---|
| 379 | DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
 | 
|---|
| 380 |         MUTATE_START( node );
 | 
|---|
| 381 | 
 | 
|---|
| 382 |         indexerScopedMutate( node->type         , *this );
 | 
|---|
| 383 |         maybeMutate_impl   ( node->init         , *this );
 | 
|---|
| 384 |         maybeMutate_impl   ( node->bitfieldWidth, *this );
 | 
|---|
| 385 |         maybeMutate_impl   ( node->attributes   , *this );
 | 
|---|
| 386 | 
 | 
|---|
| 387 |         indexerAddId( node );
 | 
|---|
| 388 | 
 | 
|---|
| 389 |         MUTATE_END( DeclarationWithType, node );
 | 
|---|
| 390 | }
 | 
|---|
| 391 | 
 | 
|---|
| 392 | //--------------------------------------------------------------------------
 | 
|---|
| 393 | // FunctionDecl
 | 
|---|
| 394 | template< typename pass_type >
 | 
|---|
| 395 | void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
 | 
|---|
| 396 |         VISIT_START( node );
 | 
|---|
| 397 | 
 | 
|---|
| 398 |         indexerAddId( node );
 | 
|---|
| 399 | 
 | 
|---|
| 400 |         maybeAccept_impl( node->withExprs, *this );
 | 
|---|
| 401 |         {
 | 
|---|
| 402 |                 // with clause introduces a level of scope (for the with expression members).
 | 
|---|
| 403 |                 // with clause exprs are added to the indexer before parameters so that parameters
 | 
|---|
| 404 |                 // shadow with exprs and not the other way around.
 | 
|---|
| 405 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 406 |                 indexerAddWith( node->withExprs, node );
 | 
|---|
| 407 |                 {
 | 
|---|
| 408 |                         auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 409 |                         // implicit add __func__ identifier as specified in the C manual 6.4.2.2
 | 
|---|
| 410 |                         static ObjectDecl func(
 | 
|---|
| 411 |                                 "__func__", noStorageClasses, LinkageSpec::C, nullptr,
 | 
|---|
| 412 |                                 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
 | 
|---|
| 413 |                                 nullptr
 | 
|---|
| 414 |                         );
 | 
|---|
| 415 |                         indexerAddId( &func );
 | 
|---|
| 416 |                         maybeAccept_impl( node->type, *this );
 | 
|---|
| 417 |                         // function body needs to have the same scope as parameters - CompoundStmt will not enter
 | 
|---|
| 418 |                         // a new scope if inFunction is true
 | 
|---|
| 419 |                         ValueGuard< bool > oldInFunction( inFunction );
 | 
|---|
| 420 |                         inFunction = true;
 | 
|---|
| 421 |                         maybeAccept_impl( node->statements, *this );
 | 
|---|
| 422 |                         maybeAccept_impl( node->attributes, *this );
 | 
|---|
| 423 |                 }
 | 
|---|
| 424 |         }
 | 
|---|
| 425 | 
 | 
|---|
| 426 |         VISIT_END( node );
 | 
|---|
| 427 | }
 | 
|---|
| 428 | 
 | 
|---|
| 429 | template< typename pass_type >
 | 
|---|
| 430 | DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
 | 
|---|
| 431 |         MUTATE_START( node );
 | 
|---|
| 432 | 
 | 
|---|
| 433 |         indexerAddId( node );
 | 
|---|
| 434 | 
 | 
|---|
| 435 |         {
 | 
|---|
| 436 |                 // with clause introduces a level of scope (for the with expression members).
 | 
|---|
| 437 |                 // with clause exprs are added to the indexer before parameters so that parameters
 | 
|---|
| 438 |                 // shadow with exprs and not the other way around.
 | 
|---|
| 439 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 440 |                 indexerAddWith( node->withExprs, node );
 | 
|---|
| 441 |                 {
 | 
|---|
| 442 |                         auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 443 |                         // implicit add __func__ identifier as specified in the C manual 6.4.2.2
 | 
|---|
| 444 |                         static ObjectDecl func(
 | 
|---|
| 445 |                                 "__func__", noStorageClasses, LinkageSpec::C, nullptr,
 | 
|---|
| 446 |                                 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
 | 
|---|
| 447 |                                 nullptr
 | 
|---|
| 448 |                         );
 | 
|---|
| 449 |                         indexerAddId( &func );
 | 
|---|
| 450 |                         maybeMutate_impl( node->type, *this );
 | 
|---|
| 451 |                         // function body needs to have the same scope as parameters - CompoundStmt will not enter
 | 
|---|
| 452 |                         // a new scope if inFunction is true
 | 
|---|
| 453 |                         ValueGuard< bool > oldInFunction( inFunction );
 | 
|---|
| 454 |                         inFunction = true;
 | 
|---|
| 455 |                         maybeMutate_impl( node->statements, *this );
 | 
|---|
| 456 |                         maybeMutate_impl( node->attributes, *this );
 | 
|---|
| 457 |                 }
 | 
|---|
| 458 |         }
 | 
|---|
| 459 | 
 | 
|---|
| 460 |         MUTATE_END( DeclarationWithType, node );
 | 
|---|
| 461 | }
 | 
|---|
| 462 | 
 | 
|---|
| 463 | //--------------------------------------------------------------------------
 | 
|---|
| 464 | // StructDecl
 | 
|---|
| 465 | template< typename pass_type >
 | 
|---|
| 466 | void PassVisitor< pass_type >::visit( StructDecl * node ) {
 | 
|---|
| 467 |         VISIT_START( node );
 | 
|---|
| 468 | 
 | 
|---|
| 469 |         // make up a forward declaration and add it before processing the members
 | 
|---|
| 470 |         // needs to be on the heap because addStruct saves the pointer
 | 
|---|
| 471 |         indexerAddStructFwd( node );
 | 
|---|
| 472 | 
 | 
|---|
| 473 |         {
 | 
|---|
| 474 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 475 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 476 |                 maybeAccept_impl( node->members   , *this );
 | 
|---|
| 477 |         }
 | 
|---|
| 478 | 
 | 
|---|
| 479 |         // this addition replaces the forward declaration
 | 
|---|
| 480 |         indexerAddStruct( node );
 | 
|---|
| 481 | 
 | 
|---|
| 482 |         VISIT_END( node );
 | 
|---|
| 483 | }
 | 
|---|
| 484 | 
 | 
|---|
| 485 | template< typename pass_type >
 | 
|---|
| 486 | Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
 | 
|---|
| 487 |         MUTATE_START( node );
 | 
|---|
| 488 | 
 | 
|---|
| 489 |         // make up a forward declaration and add it before processing the members
 | 
|---|
| 490 |         // needs to be on the heap because addStruct saves the pointer
 | 
|---|
| 491 |         indexerAddStructFwd( node );
 | 
|---|
| 492 | 
 | 
|---|
| 493 |         {
 | 
|---|
| 494 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 495 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 496 |                 maybeMutate_impl( node->members   , *this );
 | 
|---|
| 497 |         }
 | 
|---|
| 498 | 
 | 
|---|
| 499 |         // this addition replaces the forward declaration
 | 
|---|
| 500 |         indexerAddStruct( node );
 | 
|---|
| 501 | 
 | 
|---|
| 502 |         MUTATE_END( Declaration, node );
 | 
|---|
| 503 | }
 | 
|---|
| 504 | 
 | 
|---|
| 505 | //--------------------------------------------------------------------------
 | 
|---|
| 506 | // UnionDecl
 | 
|---|
| 507 | template< typename pass_type >
 | 
|---|
| 508 | void PassVisitor< pass_type >::visit( UnionDecl * node ) {
 | 
|---|
| 509 |         VISIT_START( node );
 | 
|---|
| 510 | 
 | 
|---|
| 511 |         // make up a forward declaration and add it before processing the members
 | 
|---|
| 512 |         indexerAddUnionFwd( node );
 | 
|---|
| 513 | 
 | 
|---|
| 514 |         {
 | 
|---|
| 515 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 516 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 517 |                 maybeAccept_impl( node->members   , *this );
 | 
|---|
| 518 |         }
 | 
|---|
| 519 | 
 | 
|---|
| 520 |         indexerAddUnion( node );
 | 
|---|
| 521 | 
 | 
|---|
| 522 |         VISIT_END( node );
 | 
|---|
| 523 | }
 | 
|---|
| 524 | 
 | 
|---|
| 525 | template< typename pass_type >
 | 
|---|
| 526 | Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
 | 
|---|
| 527 |         MUTATE_START( node );
 | 
|---|
| 528 | 
 | 
|---|
| 529 |         // make up a forward declaration and add it before processing the members
 | 
|---|
| 530 |         indexerAddUnionFwd( node );
 | 
|---|
| 531 | 
 | 
|---|
| 532 |         {
 | 
|---|
| 533 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 534 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 535 |                 maybeMutate_impl( node->members   , *this );
 | 
|---|
| 536 |         }
 | 
|---|
| 537 | 
 | 
|---|
| 538 |         indexerAddUnion( node );
 | 
|---|
| 539 | 
 | 
|---|
| 540 |         MUTATE_END( Declaration, node );
 | 
|---|
| 541 | }
 | 
|---|
| 542 | 
 | 
|---|
| 543 | //--------------------------------------------------------------------------
 | 
|---|
| 544 | // EnumDecl
 | 
|---|
| 545 | template< typename pass_type >
 | 
|---|
| 546 | void PassVisitor< pass_type >::visit( EnumDecl * node ) {
 | 
|---|
| 547 |         VISIT_START( node );
 | 
|---|
| 548 | 
 | 
|---|
| 549 |         indexerAddEnum( node );
 | 
|---|
| 550 | 
 | 
|---|
| 551 |         // unlike structs, traits, and unions, enums inject their members into the global scope
 | 
|---|
| 552 |         maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 553 |         maybeAccept_impl( node->members   , *this );
 | 
|---|
| 554 | 
 | 
|---|
| 555 |         VISIT_END( node );
 | 
|---|
| 556 | }
 | 
|---|
| 557 | 
 | 
|---|
| 558 | template< typename pass_type >
 | 
|---|
| 559 | Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
 | 
|---|
| 560 |         MUTATE_START( node );
 | 
|---|
| 561 | 
 | 
|---|
| 562 |         indexerAddEnum( node );
 | 
|---|
| 563 | 
 | 
|---|
| 564 |         // unlike structs, traits, and unions, enums inject their members into the global scope
 | 
|---|
| 565 |         maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 566 |         maybeMutate_impl( node->members   , *this );
 | 
|---|
| 567 | 
 | 
|---|
| 568 |         MUTATE_END( Declaration, node );
 | 
|---|
| 569 | }
 | 
|---|
| 570 | 
 | 
|---|
| 571 | //--------------------------------------------------------------------------
 | 
|---|
| 572 | // TraitDecl
 | 
|---|
| 573 | template< typename pass_type >
 | 
|---|
| 574 | void PassVisitor< pass_type >::visit( TraitDecl * node ) {
 | 
|---|
| 575 |         VISIT_START( node );
 | 
|---|
| 576 | 
 | 
|---|
| 577 |         {
 | 
|---|
| 578 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 579 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 580 |                 maybeAccept_impl( node->members   , *this );
 | 
|---|
| 581 |         }
 | 
|---|
| 582 | 
 | 
|---|
| 583 |         indexerAddTrait( node );
 | 
|---|
| 584 | 
 | 
|---|
| 585 |         VISIT_END( node );
 | 
|---|
| 586 | }
 | 
|---|
| 587 | 
 | 
|---|
| 588 | template< typename pass_type >
 | 
|---|
| 589 | Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
 | 
|---|
| 590 |         MUTATE_START( node );
 | 
|---|
| 591 | 
 | 
|---|
| 592 |         {
 | 
|---|
| 593 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 594 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 595 |                 maybeMutate_impl( node->members   , *this );
 | 
|---|
| 596 |         }
 | 
|---|
| 597 | 
 | 
|---|
| 598 |         indexerAddTrait( node );
 | 
|---|
| 599 | 
 | 
|---|
| 600 |         MUTATE_END( Declaration, node );
 | 
|---|
| 601 | }
 | 
|---|
| 602 | 
 | 
|---|
| 603 | //--------------------------------------------------------------------------
 | 
|---|
| 604 | // TypeDecl
 | 
|---|
| 605 | template< typename pass_type >
 | 
|---|
| 606 | void PassVisitor< pass_type >::visit( TypeDecl * node ) {
 | 
|---|
| 607 |         VISIT_START( node );
 | 
|---|
| 608 | 
 | 
|---|
| 609 |         {
 | 
|---|
| 610 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 611 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 612 |                 maybeAccept_impl( node->base      , *this );
 | 
|---|
| 613 |         }
 | 
|---|
| 614 | 
 | 
|---|
| 615 |         // see A NOTE ON THE ORDER OF TRAVERSAL, above
 | 
|---|
| 616 |         // note that assertions come after the type is added to the symtab, since they are not part of the type proper
 | 
|---|
| 617 |         // and may depend on the type itself
 | 
|---|
| 618 |         indexerAddType( node );
 | 
|---|
| 619 | 
 | 
|---|
| 620 |         maybeAccept_impl( node->assertions, *this );
 | 
|---|
| 621 | 
 | 
|---|
| 622 |         indexerScopedAccept( node->init, *this );
 | 
|---|
| 623 | 
 | 
|---|
| 624 |         VISIT_END( node );
 | 
|---|
| 625 | }
 | 
|---|
| 626 | 
 | 
|---|
| 627 | template< typename pass_type >
 | 
|---|
| 628 | Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
 | 
|---|
| 629 |         MUTATE_START( node );
 | 
|---|
| 630 | 
 | 
|---|
| 631 |         {
 | 
|---|
| 632 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 633 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 634 |                 maybeMutate_impl( node->base      , *this );
 | 
|---|
| 635 |         }
 | 
|---|
| 636 | 
 | 
|---|
| 637 |         // see A NOTE ON THE ORDER OF TRAVERSAL, above
 | 
|---|
| 638 |         // note that assertions come after the type is added to the symtab, since they are not part of the type proper
 | 
|---|
| 639 |         // and may depend on the type itself
 | 
|---|
| 640 |         indexerAddType( node );
 | 
|---|
| 641 | 
 | 
|---|
| 642 |         maybeMutate_impl( node->assertions, *this );
 | 
|---|
| 643 | 
 | 
|---|
| 644 |         indexerScopedMutate( node->init, *this );
 | 
|---|
| 645 | 
 | 
|---|
| 646 |         MUTATE_END( Declaration, node );
 | 
|---|
| 647 | }
 | 
|---|
| 648 | 
 | 
|---|
| 649 | //--------------------------------------------------------------------------
 | 
|---|
| 650 | // TypedefDecl
 | 
|---|
| 651 | template< typename pass_type >
 | 
|---|
| 652 | void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
 | 
|---|
| 653 |         VISIT_START( node );
 | 
|---|
| 654 | 
 | 
|---|
| 655 |         {
 | 
|---|
| 656 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 657 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 658 |                 maybeAccept_impl( node->base      , *this );
 | 
|---|
| 659 |         }
 | 
|---|
| 660 | 
 | 
|---|
| 661 |         indexerAddType( node );
 | 
|---|
| 662 | 
 | 
|---|
| 663 |         maybeAccept_impl( node->assertions, *this );
 | 
|---|
| 664 | 
 | 
|---|
| 665 |         VISIT_END( node );
 | 
|---|
| 666 | }
 | 
|---|
| 667 | 
 | 
|---|
| 668 | template< typename pass_type >
 | 
|---|
| 669 | Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
 | 
|---|
| 670 |         MUTATE_START( node );
 | 
|---|
| 671 | 
 | 
|---|
| 672 |         {
 | 
|---|
| 673 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 674 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 675 |                 maybeMutate_impl( node->base      , *this );
 | 
|---|
| 676 |         }
 | 
|---|
| 677 | 
 | 
|---|
| 678 |         indexerAddType( node );
 | 
|---|
| 679 | 
 | 
|---|
| 680 |         maybeMutate_impl( node->assertions, *this );
 | 
|---|
| 681 | 
 | 
|---|
| 682 |         MUTATE_END( Declaration, node );
 | 
|---|
| 683 | }
 | 
|---|
| 684 | 
 | 
|---|
| 685 | //--------------------------------------------------------------------------
 | 
|---|
| 686 | // AsmDecl
 | 
|---|
| 687 | template< typename pass_type >
 | 
|---|
| 688 | void PassVisitor< pass_type >::visit( AsmDecl * node ) {
 | 
|---|
| 689 |         VISIT_START( node );
 | 
|---|
| 690 | 
 | 
|---|
| 691 |         maybeAccept_impl( node->stmt, *this );
 | 
|---|
| 692 | 
 | 
|---|
| 693 |         VISIT_END( node );
 | 
|---|
| 694 | }
 | 
|---|
| 695 | 
 | 
|---|
| 696 | template< typename pass_type >
 | 
|---|
| 697 | AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
 | 
|---|
| 698 |         MUTATE_START( node );
 | 
|---|
| 699 | 
 | 
|---|
| 700 |         maybeMutate_impl( node->stmt, *this );
 | 
|---|
| 701 | 
 | 
|---|
| 702 |         MUTATE_END( AsmDecl, node );
 | 
|---|
| 703 | }
 | 
|---|
| 704 | 
 | 
|---|
| 705 | //--------------------------------------------------------------------------
 | 
|---|
| 706 | // StaticAssertDecl
 | 
|---|
| 707 | template< typename pass_type >
 | 
|---|
| 708 | void PassVisitor< pass_type >::visit( StaticAssertDecl * node ) {
 | 
|---|
| 709 |         VISIT_START( node );
 | 
|---|
| 710 | 
 | 
|---|
| 711 |         node->condition = visitExpression( node->condition );
 | 
|---|
| 712 |         maybeAccept_impl( node->message, *this );
 | 
|---|
| 713 | 
 | 
|---|
| 714 |         VISIT_END( node );
 | 
|---|
| 715 | }
 | 
|---|
| 716 | 
 | 
|---|
| 717 | template< typename pass_type >
 | 
|---|
| 718 | StaticAssertDecl * PassVisitor< pass_type >::mutate( StaticAssertDecl * node ) {
 | 
|---|
| 719 |         MUTATE_START( node );
 | 
|---|
| 720 | 
 | 
|---|
| 721 |         node->condition = mutateExpression( node->condition );
 | 
|---|
| 722 |         maybeMutate_impl( node->message, *this );
 | 
|---|
| 723 | 
 | 
|---|
| 724 |         MUTATE_END( StaticAssertDecl, node );
 | 
|---|
| 725 | }
 | 
|---|
| 726 | 
 | 
|---|
| 727 | //--------------------------------------------------------------------------
 | 
|---|
| 728 | // CompoundStmt
 | 
|---|
| 729 | template< typename pass_type >
 | 
|---|
| 730 | void PassVisitor< pass_type >::visit( CompoundStmt * node ) {
 | 
|---|
| 731 |         VISIT_START( node );
 | 
|---|
| 732 |         {
 | 
|---|
| 733 |                 // do not enter a new scope if inFunction is true - needs to check old state before the assignment
 | 
|---|
| 734 |                 ValueGuard< bool > oldInFunction( inFunction );
 | 
|---|
| 735 |                 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
 | 
|---|
| 736 |                 auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
 | 
|---|
| 737 |                 inFunction = false;
 | 
|---|
| 738 |                 visitStatementList( node->kids );
 | 
|---|
| 739 |         }
 | 
|---|
| 740 |         VISIT_END( node );
 | 
|---|
| 741 | }
 | 
|---|
| 742 | 
 | 
|---|
| 743 | template< typename pass_type >
 | 
|---|
| 744 | CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
 | 
|---|
| 745 |         MUTATE_START( node );
 | 
|---|
| 746 |         {
 | 
|---|
| 747 |                 // do not enter a new scope if inFunction is true - needs to check old state before the assignment
 | 
|---|
| 748 |                 ValueGuard< bool > oldInFunction( inFunction );
 | 
|---|
| 749 |                 auto guard1 = makeFuncGuard( [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeEnter(); }, [this, &oldInFunction]() { if ( ! oldInFunction.old ) indexerScopeLeave(); } );
 | 
|---|
| 750 |                 auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
 | 
|---|
| 751 |                 inFunction = false;
 | 
|---|
| 752 |                 mutateStatementList( node->kids );
 | 
|---|
| 753 |         }
 | 
|---|
| 754 |         MUTATE_END( CompoundStmt, node );
 | 
|---|
| 755 | }
 | 
|---|
| 756 | 
 | 
|---|
| 757 | //--------------------------------------------------------------------------
 | 
|---|
| 758 | // ExprStmt
 | 
|---|
| 759 | template< typename pass_type >
 | 
|---|
| 760 | void PassVisitor< pass_type >::visit( ExprStmt * node ) {
 | 
|---|
| 761 |         VISIT_START( node );
 | 
|---|
| 762 | 
 | 
|---|
| 763 |         visitExpression( node->expr );
 | 
|---|
| 764 | 
 | 
|---|
| 765 |         VISIT_END( node );
 | 
|---|
| 766 | }
 | 
|---|
| 767 | 
 | 
|---|
| 768 | template< typename pass_type >
 | 
|---|
| 769 | Statement * PassVisitor< pass_type >::mutate( ExprStmt * node ) {
 | 
|---|
| 770 |         MUTATE_START( node );
 | 
|---|
| 771 | 
 | 
|---|
| 772 |         node->expr = mutateExpression( node->expr );
 | 
|---|
| 773 | 
 | 
|---|
| 774 |         MUTATE_END( Statement, node );
 | 
|---|
| 775 | }
 | 
|---|
| 776 | 
 | 
|---|
| 777 | //--------------------------------------------------------------------------
 | 
|---|
| 778 | // AsmStmt
 | 
|---|
| 779 | template< typename pass_type >
 | 
|---|
| 780 | void PassVisitor< pass_type >::visit( AsmStmt * node ) {
 | 
|---|
| 781 |         VISIT_START( node )
 | 
|---|
| 782 | 
 | 
|---|
| 783 |         maybeAccept_impl( node->instruction, *this );
 | 
|---|
| 784 |         maybeAccept_impl( node->output, *this );
 | 
|---|
| 785 |         maybeAccept_impl( node->input, *this );
 | 
|---|
| 786 |         maybeAccept_impl( node->clobber, *this );
 | 
|---|
| 787 | 
 | 
|---|
| 788 |         VISIT_END( node );
 | 
|---|
| 789 | }
 | 
|---|
| 790 | 
 | 
|---|
| 791 | template< typename pass_type >
 | 
|---|
| 792 | Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
 | 
|---|
| 793 |         MUTATE_START( node );
 | 
|---|
| 794 | 
 | 
|---|
| 795 |         maybeMutate_impl( node->instruction, *this );
 | 
|---|
| 796 |         maybeMutate_impl( node->output, *this );
 | 
|---|
| 797 |         maybeMutate_impl( node->input, *this );
 | 
|---|
| 798 |         maybeMutate_impl( node->clobber, *this );
 | 
|---|
| 799 | 
 | 
|---|
| 800 |         MUTATE_END( Statement, node );
 | 
|---|
| 801 | }
 | 
|---|
| 802 | 
 | 
|---|
| 803 | //--------------------------------------------------------------------------
 | 
|---|
| 804 | // AsmStmt
 | 
|---|
| 805 | template< typename pass_type >
 | 
|---|
| 806 | void PassVisitor< pass_type >::visit( DirectiveStmt * node ) {
 | 
|---|
| 807 |         VISIT_START( node )
 | 
|---|
| 808 | 
 | 
|---|
| 809 |         VISIT_END( node );
 | 
|---|
| 810 | }
 | 
|---|
| 811 | 
 | 
|---|
| 812 | template< typename pass_type >
 | 
|---|
| 813 | Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
 | 
|---|
| 814 |         MUTATE_START( node );
 | 
|---|
| 815 | 
 | 
|---|
| 816 |         MUTATE_END( Statement, node );
 | 
|---|
| 817 | }
 | 
|---|
| 818 | 
 | 
|---|
| 819 | //--------------------------------------------------------------------------
 | 
|---|
| 820 | // IfStmt
 | 
|---|
| 821 | template< typename pass_type >
 | 
|---|
| 822 | void PassVisitor< pass_type >::visit( IfStmt * node ) {
 | 
|---|
| 823 |         VISIT_START( node );
 | 
|---|
| 824 |         {
 | 
|---|
| 825 |                 // if statements introduce a level of scope (for the initialization)
 | 
|---|
| 826 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 827 |                 maybeAccept_impl( node->get_initialization(), *this );
 | 
|---|
| 828 |                 visitExpression ( node->condition );
 | 
|---|
| 829 |                 node->thenPart = visitStatement( node->thenPart );
 | 
|---|
| 830 |                 node->elsePart = visitStatement( node->elsePart );
 | 
|---|
| 831 |         }
 | 
|---|
| 832 |         VISIT_END( node );
 | 
|---|
| 833 | }
 | 
|---|
| 834 | 
 | 
|---|
| 835 | template< typename pass_type >
 | 
|---|
| 836 | Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
 | 
|---|
| 837 |         MUTATE_START( node );
 | 
|---|
| 838 |         {
 | 
|---|
| 839 |                 // if statements introduce a level of scope (for the initialization)
 | 
|---|
| 840 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 841 |                 maybeMutate_impl( node->get_initialization(), *this );
 | 
|---|
| 842 |                 node->condition = mutateExpression( node->condition );
 | 
|---|
| 843 |                 node->thenPart  = mutateStatement ( node->thenPart  );
 | 
|---|
| 844 |                 node->elsePart  = mutateStatement ( node->elsePart  );
 | 
|---|
| 845 |         }
 | 
|---|
| 846 |         MUTATE_END( Statement, node );
 | 
|---|
| 847 | }
 | 
|---|
| 848 | 
 | 
|---|
| 849 | //--------------------------------------------------------------------------
 | 
|---|
| 850 | // WhileStmt
 | 
|---|
| 851 | template< typename pass_type >
 | 
|---|
| 852 | void PassVisitor< pass_type >::visit( WhileStmt * node ) {
 | 
|---|
| 853 |         VISIT_START( node );
 | 
|---|
| 854 | 
 | 
|---|
| 855 |         {
 | 
|---|
| 856 |                 // while statements introduce a level of scope (for the initialization)
 | 
|---|
| 857 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 858 |                 maybeAccept_impl( node->initialization, *this );
 | 
|---|
| 859 |                 visitExpression ( node->condition );
 | 
|---|
| 860 |                 node->body = visitStatement( node->body );
 | 
|---|
| 861 |         }
 | 
|---|
| 862 | 
 | 
|---|
| 863 |         VISIT_END( node );
 | 
|---|
| 864 | }
 | 
|---|
| 865 | 
 | 
|---|
| 866 | template< typename pass_type >
 | 
|---|
| 867 | Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) {
 | 
|---|
| 868 |         MUTATE_START( node );
 | 
|---|
| 869 | 
 | 
|---|
| 870 |         {
 | 
|---|
| 871 |                 // while statements introduce a level of scope (for the initialization)
 | 
|---|
| 872 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 873 |                 maybeMutate_impl( node->initialization, *this );
 | 
|---|
| 874 |                 node->condition = mutateExpression( node->condition );
 | 
|---|
| 875 |                 node->body      = mutateStatement ( node->body      );
 | 
|---|
| 876 |         }
 | 
|---|
| 877 | 
 | 
|---|
| 878 | 
 | 
|---|
| 879 |         MUTATE_END( Statement, node );
 | 
|---|
| 880 | }
 | 
|---|
| 881 | 
 | 
|---|
| 882 | //--------------------------------------------------------------------------
 | 
|---|
| 883 | // ForStmt
 | 
|---|
| 884 | template< typename pass_type >
 | 
|---|
| 885 | void PassVisitor< pass_type >::visit( ForStmt * node ) {
 | 
|---|
| 886 |         VISIT_START( node );
 | 
|---|
| 887 |         {
 | 
|---|
| 888 |                 // for statements introduce a level of scope (for the initialization)
 | 
|---|
| 889 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 890 |                 maybeAccept_impl( node->initialization, *this );
 | 
|---|
| 891 |                 visitExpression( node->condition );
 | 
|---|
| 892 |                 visitExpression( node->increment );
 | 
|---|
| 893 |                 node->body = visitStatement( node->body );
 | 
|---|
| 894 |         }
 | 
|---|
| 895 |         VISIT_END( node );
 | 
|---|
| 896 | }
 | 
|---|
| 897 | 
 | 
|---|
| 898 | template< typename pass_type >
 | 
|---|
| 899 | Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
 | 
|---|
| 900 |         MUTATE_START( node );
 | 
|---|
| 901 |         {
 | 
|---|
| 902 |                 // for statements introduce a level of scope (for the initialization)
 | 
|---|
| 903 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 904 |                 maybeMutate_impl( node->initialization, *this );
 | 
|---|
| 905 |                 node->condition = mutateExpression( node->condition );
 | 
|---|
| 906 |                 node->increment = mutateExpression( node->increment );
 | 
|---|
| 907 |                 node->body      = mutateStatement ( node->body      );
 | 
|---|
| 908 |         }
 | 
|---|
| 909 |         MUTATE_END( Statement, node );
 | 
|---|
| 910 | }
 | 
|---|
| 911 | 
 | 
|---|
| 912 | //--------------------------------------------------------------------------
 | 
|---|
| 913 | // SwitchStmt
 | 
|---|
| 914 | template< typename pass_type >
 | 
|---|
| 915 | void PassVisitor< pass_type >::visit( SwitchStmt * node ) {
 | 
|---|
| 916 |         VISIT_START( node );
 | 
|---|
| 917 | 
 | 
|---|
| 918 |         visitExpression   ( node->condition  );
 | 
|---|
| 919 |         visitStatementList( node->statements );
 | 
|---|
| 920 | 
 | 
|---|
| 921 |         VISIT_END( node );
 | 
|---|
| 922 | }
 | 
|---|
| 923 | 
 | 
|---|
| 924 | template< typename pass_type >
 | 
|---|
| 925 | Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) {
 | 
|---|
| 926 |         MUTATE_START( node );
 | 
|---|
| 927 | 
 | 
|---|
| 928 |         node->condition = mutateExpression( node->condition );
 | 
|---|
| 929 |         mutateStatementList( node->statements );
 | 
|---|
| 930 | 
 | 
|---|
| 931 |         MUTATE_END( Statement, node );
 | 
|---|
| 932 | }
 | 
|---|
| 933 | 
 | 
|---|
| 934 | //--------------------------------------------------------------------------
 | 
|---|
| 935 | // CaseStmt
 | 
|---|
| 936 | template< typename pass_type >
 | 
|---|
| 937 | void PassVisitor< pass_type >::visit( CaseStmt * node ) {
 | 
|---|
| 938 |         VISIT_START( node );
 | 
|---|
| 939 | 
 | 
|---|
| 940 |         visitExpression   ( node->condition );
 | 
|---|
| 941 |         visitStatementList( node->stmts     );
 | 
|---|
| 942 | 
 | 
|---|
| 943 |         VISIT_END( node );
 | 
|---|
| 944 | }
 | 
|---|
| 945 | 
 | 
|---|
| 946 | template< typename pass_type >
 | 
|---|
| 947 | Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) {
 | 
|---|
| 948 |         MUTATE_START( node );
 | 
|---|
| 949 | 
 | 
|---|
| 950 |         node->condition = mutateExpression( node->condition );
 | 
|---|
| 951 |         mutateStatementList( node->stmts );
 | 
|---|
| 952 | 
 | 
|---|
| 953 |         MUTATE_END( Statement, node );
 | 
|---|
| 954 | }
 | 
|---|
| 955 | 
 | 
|---|
| 956 | //--------------------------------------------------------------------------
 | 
|---|
| 957 | // BranchStmt
 | 
|---|
| 958 | template< typename pass_type >
 | 
|---|
| 959 | void PassVisitor< pass_type >::visit( BranchStmt * node ) {
 | 
|---|
| 960 |         VISIT_START( node );
 | 
|---|
| 961 |         VISIT_END( node );
 | 
|---|
| 962 | }
 | 
|---|
| 963 | 
 | 
|---|
| 964 | template< typename pass_type >
 | 
|---|
| 965 | Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
 | 
|---|
| 966 |         MUTATE_START( node );
 | 
|---|
| 967 |         MUTATE_END( Statement, node );
 | 
|---|
| 968 | }
 | 
|---|
| 969 | 
 | 
|---|
| 970 | //--------------------------------------------------------------------------
 | 
|---|
| 971 | // ReturnStmt
 | 
|---|
| 972 | template< typename pass_type >
 | 
|---|
| 973 | void PassVisitor< pass_type >::visit( ReturnStmt * node ) {
 | 
|---|
| 974 |         VISIT_START( node );
 | 
|---|
| 975 | 
 | 
|---|
| 976 |         visitExpression( node->expr );
 | 
|---|
| 977 | 
 | 
|---|
| 978 |         VISIT_END( node );
 | 
|---|
| 979 | }
 | 
|---|
| 980 | 
 | 
|---|
| 981 | template< typename pass_type >
 | 
|---|
| 982 | Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
 | 
|---|
| 983 |         MUTATE_START( node );
 | 
|---|
| 984 | 
 | 
|---|
| 985 |         node->expr = mutateExpression( node->expr );
 | 
|---|
| 986 | 
 | 
|---|
| 987 |         MUTATE_END( Statement, node );
 | 
|---|
| 988 | }
 | 
|---|
| 989 | 
 | 
|---|
| 990 | //--------------------------------------------------------------------------
 | 
|---|
| 991 | // ThrowStmt
 | 
|---|
| 992 | 
 | 
|---|
| 993 | template< typename pass_type >
 | 
|---|
| 994 | void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
 | 
|---|
| 995 |         VISIT_START( node );
 | 
|---|
| 996 | 
 | 
|---|
| 997 |         maybeAccept_impl( node->expr, *this );
 | 
|---|
| 998 |         maybeAccept_impl( node->target, *this );
 | 
|---|
| 999 | 
 | 
|---|
| 1000 |         VISIT_END( node );
 | 
|---|
| 1001 | }
 | 
|---|
| 1002 | 
 | 
|---|
| 1003 | template< typename pass_type >
 | 
|---|
| 1004 | Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
 | 
|---|
| 1005 |         MUTATE_START( node );
 | 
|---|
| 1006 | 
 | 
|---|
| 1007 |         maybeMutate_impl( node->expr, *this );
 | 
|---|
| 1008 |         maybeMutate_impl( node->target, *this );
 | 
|---|
| 1009 | 
 | 
|---|
| 1010 |         MUTATE_END( Statement, node );
 | 
|---|
| 1011 | }
 | 
|---|
| 1012 | 
 | 
|---|
| 1013 | //--------------------------------------------------------------------------
 | 
|---|
| 1014 | // TryStmt
 | 
|---|
| 1015 | template< typename pass_type >
 | 
|---|
| 1016 | void PassVisitor< pass_type >::visit( TryStmt * node ) {
 | 
|---|
| 1017 |         VISIT_START( node );
 | 
|---|
| 1018 | 
 | 
|---|
| 1019 |         maybeAccept_impl( node->block       , *this );
 | 
|---|
| 1020 |         maybeAccept_impl( node->handlers    , *this );
 | 
|---|
| 1021 |         maybeAccept_impl( node->finallyBlock, *this );
 | 
|---|
| 1022 | 
 | 
|---|
| 1023 |         VISIT_END( node );
 | 
|---|
| 1024 | }
 | 
|---|
| 1025 | 
 | 
|---|
| 1026 | template< typename pass_type >
 | 
|---|
| 1027 | Statement * PassVisitor< pass_type >::mutate( TryStmt * node ) {
 | 
|---|
| 1028 |         MUTATE_START( node );
 | 
|---|
| 1029 | 
 | 
|---|
| 1030 |         maybeMutate_impl( node->block       , *this );
 | 
|---|
| 1031 |         maybeMutate_impl( node->handlers    , *this );
 | 
|---|
| 1032 |         maybeMutate_impl( node->finallyBlock, *this );
 | 
|---|
| 1033 | 
 | 
|---|
| 1034 |         MUTATE_END( Statement, node );
 | 
|---|
| 1035 | }
 | 
|---|
| 1036 | 
 | 
|---|
| 1037 | //--------------------------------------------------------------------------
 | 
|---|
| 1038 | // CatchStmt
 | 
|---|
| 1039 | template< typename pass_type >
 | 
|---|
| 1040 | void PassVisitor< pass_type >::visit( CatchStmt * node ) {
 | 
|---|
| 1041 |         VISIT_START( node );
 | 
|---|
| 1042 |         {
 | 
|---|
| 1043 |                 // catch statements introduce a level of scope (for the caught exception)
 | 
|---|
| 1044 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 1045 |                 maybeAccept_impl( node->decl, *this );
 | 
|---|
| 1046 |                 node->cond = visitExpression( node->cond );
 | 
|---|
| 1047 |                 node->body = visitStatement ( node->body );
 | 
|---|
| 1048 |         }
 | 
|---|
| 1049 |         VISIT_END( node );
 | 
|---|
| 1050 | }
 | 
|---|
| 1051 | 
 | 
|---|
| 1052 | template< typename pass_type >
 | 
|---|
| 1053 | Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
 | 
|---|
| 1054 |         MUTATE_START( node );
 | 
|---|
| 1055 |         {
 | 
|---|
| 1056 |                 // catch statements introduce a level of scope (for the caught exception)
 | 
|---|
| 1057 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 1058 |                 maybeMutate_impl( node->decl, *this );
 | 
|---|
| 1059 |                 node->cond = mutateExpression( node->cond );
 | 
|---|
| 1060 |                 node->body = mutateStatement ( node->body );
 | 
|---|
| 1061 |         }
 | 
|---|
| 1062 |         MUTATE_END( Statement, node );
 | 
|---|
| 1063 | }
 | 
|---|
| 1064 | 
 | 
|---|
| 1065 | //--------------------------------------------------------------------------
 | 
|---|
| 1066 | // FinallyStmt
 | 
|---|
| 1067 | template< typename pass_type >
 | 
|---|
| 1068 | void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
 | 
|---|
| 1069 |         VISIT_START( node );
 | 
|---|
| 1070 | 
 | 
|---|
| 1071 |         maybeAccept_impl( node->block, *this );
 | 
|---|
| 1072 | 
 | 
|---|
| 1073 |         VISIT_END( node );
 | 
|---|
| 1074 | }
 | 
|---|
| 1075 | 
 | 
|---|
| 1076 | template< typename pass_type >
 | 
|---|
| 1077 | Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
 | 
|---|
| 1078 |         MUTATE_START( node );
 | 
|---|
| 1079 | 
 | 
|---|
| 1080 |         maybeMutate_impl( node->block, *this );
 | 
|---|
| 1081 | 
 | 
|---|
| 1082 |         MUTATE_END( Statement, node );
 | 
|---|
| 1083 | }
 | 
|---|
| 1084 | 
 | 
|---|
| 1085 | //--------------------------------------------------------------------------
 | 
|---|
| 1086 | // WaitForStmt
 | 
|---|
| 1087 | template< typename pass_type >
 | 
|---|
| 1088 | void PassVisitor< pass_type >::visit( WaitForStmt * node ) {
 | 
|---|
| 1089 |         VISIT_START( node );
 | 
|---|
| 1090 | 
 | 
|---|
| 1091 |         for( auto & clause : node->clauses ) {
 | 
|---|
| 1092 |                 maybeAccept_impl( clause.target.function, *this );
 | 
|---|
| 1093 |                 maybeAccept_impl( clause.target.arguments, *this );
 | 
|---|
| 1094 | 
 | 
|---|
| 1095 |                 maybeAccept_impl( clause.statement, *this );
 | 
|---|
| 1096 |                 maybeAccept_impl( clause.condition, *this );
 | 
|---|
| 1097 |         }
 | 
|---|
| 1098 | 
 | 
|---|
| 1099 |         maybeAccept_impl( node->timeout.time, *this );
 | 
|---|
| 1100 |         maybeAccept_impl( node->timeout.statement, *this );
 | 
|---|
| 1101 |         maybeAccept_impl( node->timeout.condition, *this );
 | 
|---|
| 1102 |         maybeAccept_impl( node->orelse.statement, *this );
 | 
|---|
| 1103 |         maybeAccept_impl( node->orelse.condition, *this );
 | 
|---|
| 1104 | 
 | 
|---|
| 1105 |         VISIT_END( node );
 | 
|---|
| 1106 | }
 | 
|---|
| 1107 | 
 | 
|---|
| 1108 | template< typename pass_type >
 | 
|---|
| 1109 | Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
 | 
|---|
| 1110 |         MUTATE_START( node );
 | 
|---|
| 1111 | 
 | 
|---|
| 1112 |         for( auto & clause : node->clauses ) {
 | 
|---|
| 1113 |                 maybeMutate_impl( clause.target.function, *this );
 | 
|---|
| 1114 |                 maybeMutate_impl( clause.target.arguments, *this );
 | 
|---|
| 1115 | 
 | 
|---|
| 1116 |                 maybeMutate_impl( clause.statement, *this );
 | 
|---|
| 1117 |                 maybeMutate_impl( clause.condition, *this );
 | 
|---|
| 1118 |         }
 | 
|---|
| 1119 | 
 | 
|---|
| 1120 |         maybeMutate_impl( node->timeout.time, *this );
 | 
|---|
| 1121 |         maybeMutate_impl( node->timeout.statement, *this );
 | 
|---|
| 1122 |         maybeMutate_impl( node->timeout.condition, *this );
 | 
|---|
| 1123 |         maybeMutate_impl( node->orelse.statement, *this );
 | 
|---|
| 1124 |         maybeMutate_impl( node->orelse.condition, *this );
 | 
|---|
| 1125 | 
 | 
|---|
| 1126 |         MUTATE_END( Statement, node );
 | 
|---|
| 1127 | }
 | 
|---|
| 1128 | 
 | 
|---|
| 1129 | 
 | 
|---|
| 1130 | 
 | 
|---|
| 1131 | //--------------------------------------------------------------------------
 | 
|---|
| 1132 | // NullStmt
 | 
|---|
| 1133 | template< typename pass_type >
 | 
|---|
| 1134 | void PassVisitor< pass_type >::visit( WithStmt * node ) {
 | 
|---|
| 1135 |         VISIT_START( node );
 | 
|---|
| 1136 |         maybeAccept_impl( node->exprs, *this );
 | 
|---|
| 1137 |         {
 | 
|---|
| 1138 |                 // catch statements introduce a level of scope (for the caught exception)
 | 
|---|
| 1139 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 1140 |                 indexerAddWith( node->exprs, node );
 | 
|---|
| 1141 |                 maybeAccept_impl( node->stmt, *this );
 | 
|---|
| 1142 |         }
 | 
|---|
| 1143 |         VISIT_END( node );
 | 
|---|
| 1144 | }
 | 
|---|
| 1145 | 
 | 
|---|
| 1146 | template< typename pass_type >
 | 
|---|
| 1147 | Statement * PassVisitor< pass_type >::mutate( WithStmt * node ) {
 | 
|---|
| 1148 |         MUTATE_START( node );
 | 
|---|
| 1149 |         maybeMutate_impl( node->exprs, *this );
 | 
|---|
| 1150 |         {
 | 
|---|
| 1151 |                 // catch statements introduce a level of scope (for the caught exception)
 | 
|---|
| 1152 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 1153 |                 indexerAddWith( node->exprs, node );
 | 
|---|
| 1154 |                 maybeMutate_impl( node->stmt, *this );
 | 
|---|
| 1155 |         }
 | 
|---|
| 1156 |         MUTATE_END( Statement, node );
 | 
|---|
| 1157 | }
 | 
|---|
| 1158 | 
 | 
|---|
| 1159 | //--------------------------------------------------------------------------
 | 
|---|
| 1160 | // NullStmt
 | 
|---|
| 1161 | template< typename pass_type >
 | 
|---|
| 1162 | void PassVisitor< pass_type >::visit( NullStmt * node ) {
 | 
|---|
| 1163 |         VISIT_START( node );
 | 
|---|
| 1164 |         VISIT_END( node );
 | 
|---|
| 1165 | }
 | 
|---|
| 1166 | 
 | 
|---|
| 1167 | template< typename pass_type >
 | 
|---|
| 1168 | NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
 | 
|---|
| 1169 |         MUTATE_START( node );
 | 
|---|
| 1170 |         MUTATE_END( NullStmt, node );
 | 
|---|
| 1171 | }
 | 
|---|
| 1172 | 
 | 
|---|
| 1173 | //--------------------------------------------------------------------------
 | 
|---|
| 1174 | // DeclStmt
 | 
|---|
| 1175 | template< typename pass_type >
 | 
|---|
| 1176 | void PassVisitor< pass_type >::visit( DeclStmt * node ) {
 | 
|---|
| 1177 |         VISIT_START( node );
 | 
|---|
| 1178 | 
 | 
|---|
| 1179 |         maybeAccept_impl( node->decl, *this );
 | 
|---|
| 1180 | 
 | 
|---|
| 1181 |         VISIT_END( node );
 | 
|---|
| 1182 | }
 | 
|---|
| 1183 | 
 | 
|---|
| 1184 | template< typename pass_type >
 | 
|---|
| 1185 | Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
 | 
|---|
| 1186 |         MUTATE_START( node );
 | 
|---|
| 1187 | 
 | 
|---|
| 1188 |         maybeMutate_impl( node->decl, *this );
 | 
|---|
| 1189 | 
 | 
|---|
| 1190 |         MUTATE_END( Statement, node );
 | 
|---|
| 1191 | }
 | 
|---|
| 1192 | 
 | 
|---|
| 1193 | //--------------------------------------------------------------------------
 | 
|---|
| 1194 | // ImplicitCtorDtorStmt
 | 
|---|
| 1195 | template< typename pass_type >
 | 
|---|
| 1196 | void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
 | 
|---|
| 1197 |         VISIT_START( node );
 | 
|---|
| 1198 | 
 | 
|---|
| 1199 |         maybeAccept_impl( node->callStmt, *this );
 | 
|---|
| 1200 | 
 | 
|---|
| 1201 |         VISIT_END( node );
 | 
|---|
| 1202 | }
 | 
|---|
| 1203 | 
 | 
|---|
| 1204 | template< typename pass_type >
 | 
|---|
| 1205 | Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
 | 
|---|
| 1206 |         MUTATE_START( node );
 | 
|---|
| 1207 | 
 | 
|---|
| 1208 |         maybeMutate_impl( node->callStmt, *this );
 | 
|---|
| 1209 | 
 | 
|---|
| 1210 |         MUTATE_END( Statement, node );
 | 
|---|
| 1211 | }
 | 
|---|
| 1212 | 
 | 
|---|
| 1213 | //--------------------------------------------------------------------------
 | 
|---|
| 1214 | // ApplicationExpr
 | 
|---|
| 1215 | template< typename pass_type >
 | 
|---|
| 1216 | void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
 | 
|---|
| 1217 |         VISIT_START( node );
 | 
|---|
| 1218 | 
 | 
|---|
| 1219 |         indexerScopedAccept( node->result  , *this );
 | 
|---|
| 1220 |         maybeAccept_impl        ( node->function, *this );
 | 
|---|
| 1221 |         maybeAccept_impl        ( node->args    , *this );
 | 
|---|
| 1222 | 
 | 
|---|
| 1223 |         VISIT_END( node );
 | 
|---|
| 1224 | }
 | 
|---|
| 1225 | 
 | 
|---|
| 1226 | template< typename pass_type >
 | 
|---|
| 1227 | Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
 | 
|---|
| 1228 |         MUTATE_START( node );
 | 
|---|
| 1229 | 
 | 
|---|
| 1230 |         indexerScopedMutate( node->env     , *this );
 | 
|---|
| 1231 |         indexerScopedMutate( node->result  , *this );
 | 
|---|
| 1232 |         maybeMutate_impl   ( node->function, *this );
 | 
|---|
| 1233 |         maybeMutate_impl   ( node->args    , *this );
 | 
|---|
| 1234 | 
 | 
|---|
| 1235 |         MUTATE_END( Expression, node );
 | 
|---|
| 1236 | }
 | 
|---|
| 1237 | 
 | 
|---|
| 1238 | //--------------------------------------------------------------------------
 | 
|---|
| 1239 | // UntypedExpr
 | 
|---|
| 1240 | template< typename pass_type >
 | 
|---|
| 1241 | void PassVisitor< pass_type >::visit( UntypedExpr * node ) {
 | 
|---|
| 1242 |         VISIT_START( node );
 | 
|---|
| 1243 | 
 | 
|---|
| 1244 |         // maybeAccept_impl( node->get_env(), *this );
 | 
|---|
| 1245 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1246 | 
 | 
|---|
| 1247 |         for ( auto expr : node->args ) {
 | 
|---|
| 1248 |                 visitExpression( expr );
 | 
|---|
| 1249 |         }
 | 
|---|
| 1250 | 
 | 
|---|
| 1251 |         VISIT_END( node );
 | 
|---|
| 1252 | }
 | 
|---|
| 1253 | 
 | 
|---|
| 1254 | template< typename pass_type >
 | 
|---|
| 1255 | Expression * PassVisitor< pass_type >::mutate( UntypedExpr * node ) {
 | 
|---|
| 1256 |         MUTATE_START( node );
 | 
|---|
| 1257 | 
 | 
|---|
| 1258 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1259 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1260 | 
 | 
|---|
| 1261 |         for ( auto& expr : node->args ) {
 | 
|---|
| 1262 |                 expr = mutateExpression( expr );
 | 
|---|
| 1263 |         }
 | 
|---|
| 1264 | 
 | 
|---|
| 1265 |         MUTATE_END( Expression, node );
 | 
|---|
| 1266 | }
 | 
|---|
| 1267 | 
 | 
|---|
| 1268 | //--------------------------------------------------------------------------
 | 
|---|
| 1269 | // NameExpr
 | 
|---|
| 1270 | template< typename pass_type >
 | 
|---|
| 1271 | void PassVisitor< pass_type >::visit( NameExpr * node ) {
 | 
|---|
| 1272 |         VISIT_START( node );
 | 
|---|
| 1273 | 
 | 
|---|
| 1274 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1275 | 
 | 
|---|
| 1276 |         VISIT_END( node );
 | 
|---|
| 1277 | }
 | 
|---|
| 1278 | 
 | 
|---|
| 1279 | template< typename pass_type >
 | 
|---|
| 1280 | Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
 | 
|---|
| 1281 |         MUTATE_START( node );
 | 
|---|
| 1282 | 
 | 
|---|
| 1283 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1284 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1285 | 
 | 
|---|
| 1286 |         MUTATE_END( Expression, node );
 | 
|---|
| 1287 | }
 | 
|---|
| 1288 | 
 | 
|---|
| 1289 | //--------------------------------------------------------------------------
 | 
|---|
| 1290 | // CastExpr
 | 
|---|
| 1291 | template< typename pass_type >
 | 
|---|
| 1292 | void PassVisitor< pass_type >::visit( CastExpr * node ) {
 | 
|---|
| 1293 |         VISIT_START( node );
 | 
|---|
| 1294 | 
 | 
|---|
| 1295 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1296 |         maybeAccept_impl        ( node->arg   , *this );
 | 
|---|
| 1297 | 
 | 
|---|
| 1298 |         VISIT_END( node );
 | 
|---|
| 1299 | }
 | 
|---|
| 1300 | 
 | 
|---|
| 1301 | template< typename pass_type >
 | 
|---|
| 1302 | Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
 | 
|---|
| 1303 |         MUTATE_START( node );
 | 
|---|
| 1304 | 
 | 
|---|
| 1305 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1306 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1307 |         maybeMutate_impl   ( node->arg   , *this );
 | 
|---|
| 1308 | 
 | 
|---|
| 1309 |         MUTATE_END( Expression, node );
 | 
|---|
| 1310 | }
 | 
|---|
| 1311 | 
 | 
|---|
| 1312 | //--------------------------------------------------------------------------
 | 
|---|
| 1313 | // KeywordCastExpr
 | 
|---|
| 1314 | template< typename pass_type >
 | 
|---|
| 1315 | void PassVisitor< pass_type >::visit( KeywordCastExpr * node ) {
 | 
|---|
| 1316 |         VISIT_START( node );
 | 
|---|
| 1317 | 
 | 
|---|
| 1318 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1319 |         maybeAccept_impl        ( node->arg   , *this );
 | 
|---|
| 1320 | 
 | 
|---|
| 1321 |         VISIT_END( node );
 | 
|---|
| 1322 | }
 | 
|---|
| 1323 | 
 | 
|---|
| 1324 | template< typename pass_type >
 | 
|---|
| 1325 | Expression * PassVisitor< pass_type >::mutate( KeywordCastExpr * node ) {
 | 
|---|
| 1326 |         MUTATE_START( node );
 | 
|---|
| 1327 | 
 | 
|---|
| 1328 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1329 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1330 |         maybeMutate_impl   ( node->arg   , *this );
 | 
|---|
| 1331 | 
 | 
|---|
| 1332 |         MUTATE_END( Expression, node );
 | 
|---|
| 1333 | }
 | 
|---|
| 1334 | 
 | 
|---|
| 1335 | //--------------------------------------------------------------------------
 | 
|---|
| 1336 | // VirtualCastExpr
 | 
|---|
| 1337 | template< typename pass_type >
 | 
|---|
| 1338 | void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) {
 | 
|---|
| 1339 |         VISIT_START( node );
 | 
|---|
| 1340 | 
 | 
|---|
| 1341 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1342 |         maybeAccept_impl( node->arg, *this );
 | 
|---|
| 1343 | 
 | 
|---|
| 1344 |         VISIT_END( node );
 | 
|---|
| 1345 | }
 | 
|---|
| 1346 | 
 | 
|---|
| 1347 | template< typename pass_type >
 | 
|---|
| 1348 | Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
 | 
|---|
| 1349 |         MUTATE_START( node );
 | 
|---|
| 1350 | 
 | 
|---|
| 1351 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1352 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1353 |         maybeMutate_impl   ( node->arg   , *this );
 | 
|---|
| 1354 | 
 | 
|---|
| 1355 |         MUTATE_END( Expression, node );
 | 
|---|
| 1356 | }
 | 
|---|
| 1357 | 
 | 
|---|
| 1358 | //--------------------------------------------------------------------------
 | 
|---|
| 1359 | // AddressExpr
 | 
|---|
| 1360 | template< typename pass_type >
 | 
|---|
| 1361 | void PassVisitor< pass_type >::visit( AddressExpr * node ) {
 | 
|---|
| 1362 |         VISIT_START( node );
 | 
|---|
| 1363 | 
 | 
|---|
| 1364 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1365 |         maybeAccept_impl   ( node->arg   , *this );
 | 
|---|
| 1366 | 
 | 
|---|
| 1367 |         VISIT_END( node );
 | 
|---|
| 1368 | }
 | 
|---|
| 1369 | 
 | 
|---|
| 1370 | template< typename pass_type >
 | 
|---|
| 1371 | Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
 | 
|---|
| 1372 |         MUTATE_START( node );
 | 
|---|
| 1373 | 
 | 
|---|
| 1374 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1375 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1376 |         maybeMutate_impl   ( node->arg   , *this );
 | 
|---|
| 1377 | 
 | 
|---|
| 1378 |         MUTATE_END( Expression, node );
 | 
|---|
| 1379 | }
 | 
|---|
| 1380 | 
 | 
|---|
| 1381 | //--------------------------------------------------------------------------
 | 
|---|
| 1382 | // LabelAddressExpr
 | 
|---|
| 1383 | template< typename pass_type >
 | 
|---|
| 1384 | void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
 | 
|---|
| 1385 |         VISIT_START( node );
 | 
|---|
| 1386 | 
 | 
|---|
| 1387 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1388 | 
 | 
|---|
| 1389 |         VISIT_END( node );
 | 
|---|
| 1390 | }
 | 
|---|
| 1391 | 
 | 
|---|
| 1392 | template< typename pass_type >
 | 
|---|
| 1393 | Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
 | 
|---|
| 1394 |         MUTATE_START( node );
 | 
|---|
| 1395 | 
 | 
|---|
| 1396 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1397 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1398 | 
 | 
|---|
| 1399 |         MUTATE_END( Expression, node );
 | 
|---|
| 1400 | }
 | 
|---|
| 1401 | 
 | 
|---|
| 1402 | //--------------------------------------------------------------------------
 | 
|---|
| 1403 | // UntypedMemberExpr
 | 
|---|
| 1404 | template< typename pass_type >
 | 
|---|
| 1405 | void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
 | 
|---|
| 1406 |         VISIT_START( node );
 | 
|---|
| 1407 | 
 | 
|---|
| 1408 |         indexerScopedAccept( node->result   , *this );
 | 
|---|
| 1409 |         maybeAccept_impl   ( node->aggregate, *this );
 | 
|---|
| 1410 |         maybeAccept_impl   ( node->member   , *this );
 | 
|---|
| 1411 | 
 | 
|---|
| 1412 |         VISIT_END( node );
 | 
|---|
| 1413 | }
 | 
|---|
| 1414 | 
 | 
|---|
| 1415 | template< typename pass_type >
 | 
|---|
| 1416 | Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
 | 
|---|
| 1417 |         MUTATE_START( node );
 | 
|---|
| 1418 | 
 | 
|---|
| 1419 |         indexerScopedMutate( node->env      , *this );
 | 
|---|
| 1420 |         indexerScopedMutate( node->result   , *this );
 | 
|---|
| 1421 |         maybeMutate_impl   ( node->aggregate, *this );
 | 
|---|
| 1422 |         maybeMutate_impl   ( node->member   , *this );
 | 
|---|
| 1423 | 
 | 
|---|
| 1424 |         MUTATE_END( Expression, node );
 | 
|---|
| 1425 | }
 | 
|---|
| 1426 | 
 | 
|---|
| 1427 | //--------------------------------------------------------------------------
 | 
|---|
| 1428 | // MemberExpr
 | 
|---|
| 1429 | template< typename pass_type >
 | 
|---|
| 1430 | void PassVisitor< pass_type >::visit( MemberExpr * node ) {
 | 
|---|
| 1431 |         VISIT_START( node );
 | 
|---|
| 1432 | 
 | 
|---|
| 1433 |         indexerScopedAccept( node->result   , *this );
 | 
|---|
| 1434 |         maybeAccept_impl   ( node->aggregate, *this );
 | 
|---|
| 1435 | 
 | 
|---|
| 1436 |         VISIT_END( node );
 | 
|---|
| 1437 | }
 | 
|---|
| 1438 | 
 | 
|---|
| 1439 | template< typename pass_type >
 | 
|---|
| 1440 | Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
 | 
|---|
| 1441 |         MUTATE_START( node );
 | 
|---|
| 1442 | 
 | 
|---|
| 1443 |         indexerScopedMutate( node->env      , *this );
 | 
|---|
| 1444 |         indexerScopedMutate( node->result   , *this );
 | 
|---|
| 1445 |         maybeMutate_impl   ( node->aggregate, *this );
 | 
|---|
| 1446 | 
 | 
|---|
| 1447 |         MUTATE_END( Expression, node );
 | 
|---|
| 1448 | }
 | 
|---|
| 1449 | 
 | 
|---|
| 1450 | //--------------------------------------------------------------------------
 | 
|---|
| 1451 | // VariableExpr
 | 
|---|
| 1452 | template< typename pass_type >
 | 
|---|
| 1453 | void PassVisitor< pass_type >::visit( VariableExpr * node ) {
 | 
|---|
| 1454 |         VISIT_START( node );
 | 
|---|
| 1455 | 
 | 
|---|
| 1456 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1457 | 
 | 
|---|
| 1458 |         VISIT_END( node );
 | 
|---|
| 1459 | }
 | 
|---|
| 1460 | 
 | 
|---|
| 1461 | template< typename pass_type >
 | 
|---|
| 1462 | Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
 | 
|---|
| 1463 |         MUTATE_START( node );
 | 
|---|
| 1464 | 
 | 
|---|
| 1465 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1466 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1467 | 
 | 
|---|
| 1468 |         MUTATE_END( Expression, node );
 | 
|---|
| 1469 | }
 | 
|---|
| 1470 | 
 | 
|---|
| 1471 | //--------------------------------------------------------------------------
 | 
|---|
| 1472 | // ConstantExpr
 | 
|---|
| 1473 | template< typename pass_type >
 | 
|---|
| 1474 | void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
 | 
|---|
| 1475 |         VISIT_START( node );
 | 
|---|
| 1476 | 
 | 
|---|
| 1477 |         indexerScopedAccept( node->result   , *this );
 | 
|---|
| 1478 |         maybeAccept_impl   ( &node->constant, *this );
 | 
|---|
| 1479 | 
 | 
|---|
| 1480 |         VISIT_END( node );
 | 
|---|
| 1481 | }
 | 
|---|
| 1482 | 
 | 
|---|
| 1483 | template< typename pass_type >
 | 
|---|
| 1484 | Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
 | 
|---|
| 1485 |         MUTATE_START( node );
 | 
|---|
| 1486 | 
 | 
|---|
| 1487 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1488 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1489 |         Constant * ptr = &node->constant;
 | 
|---|
| 1490 |         maybeMutate_impl( ptr, *this );
 | 
|---|
| 1491 |         node->constant = *ptr;
 | 
|---|
| 1492 | 
 | 
|---|
| 1493 |         MUTATE_END( Expression, node );
 | 
|---|
| 1494 | }
 | 
|---|
| 1495 | 
 | 
|---|
| 1496 | //--------------------------------------------------------------------------
 | 
|---|
| 1497 | // SizeofExpr
 | 
|---|
| 1498 | template< typename pass_type >
 | 
|---|
| 1499 | void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
 | 
|---|
| 1500 |         VISIT_START( node );
 | 
|---|
| 1501 | 
 | 
|---|
| 1502 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1503 |         if ( node->get_isType() ) {
 | 
|---|
| 1504 |                 maybeAccept_impl( node->type, *this );
 | 
|---|
| 1505 |         } else {
 | 
|---|
| 1506 |                 maybeAccept_impl( node->expr, *this );
 | 
|---|
| 1507 |         }
 | 
|---|
| 1508 | 
 | 
|---|
| 1509 |         VISIT_END( node );
 | 
|---|
| 1510 | }
 | 
|---|
| 1511 | 
 | 
|---|
| 1512 | template< typename pass_type >
 | 
|---|
| 1513 | Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
 | 
|---|
| 1514 |         MUTATE_START( node );
 | 
|---|
| 1515 | 
 | 
|---|
| 1516 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1517 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1518 |         if ( node->get_isType() ) {
 | 
|---|
| 1519 |                 maybeMutate_impl( node->type, *this );
 | 
|---|
| 1520 |         } else {
 | 
|---|
| 1521 |                 maybeMutate_impl( node->expr, *this );
 | 
|---|
| 1522 |         }
 | 
|---|
| 1523 | 
 | 
|---|
| 1524 |         MUTATE_END( Expression, node );
 | 
|---|
| 1525 | }
 | 
|---|
| 1526 | 
 | 
|---|
| 1527 | //--------------------------------------------------------------------------
 | 
|---|
| 1528 | // AlignofExpr
 | 
|---|
| 1529 | template< typename pass_type >
 | 
|---|
| 1530 | void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
 | 
|---|
| 1531 |         VISIT_START( node );
 | 
|---|
| 1532 | 
 | 
|---|
| 1533 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1534 |         if ( node->get_isType() ) {
 | 
|---|
| 1535 |                 maybeAccept_impl( node->type, *this );
 | 
|---|
| 1536 |         } else {
 | 
|---|
| 1537 |                 maybeAccept_impl( node->expr, *this );
 | 
|---|
| 1538 |         }
 | 
|---|
| 1539 | 
 | 
|---|
| 1540 |         VISIT_END( node );
 | 
|---|
| 1541 | }
 | 
|---|
| 1542 | 
 | 
|---|
| 1543 | template< typename pass_type >
 | 
|---|
| 1544 | Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
 | 
|---|
| 1545 |         MUTATE_START( node );
 | 
|---|
| 1546 | 
 | 
|---|
| 1547 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1548 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1549 |         if ( node->get_isType() ) {
 | 
|---|
| 1550 |                 maybeMutate_impl( node->type, *this );
 | 
|---|
| 1551 |         } else {
 | 
|---|
| 1552 |                 maybeMutate_impl( node->expr, *this );
 | 
|---|
| 1553 |         }
 | 
|---|
| 1554 | 
 | 
|---|
| 1555 |         MUTATE_END( Expression, node );
 | 
|---|
| 1556 | }
 | 
|---|
| 1557 | 
 | 
|---|
| 1558 | //--------------------------------------------------------------------------
 | 
|---|
| 1559 | // UntypedOffsetofExpr
 | 
|---|
| 1560 | template< typename pass_type >
 | 
|---|
| 1561 | void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
 | 
|---|
| 1562 |         VISIT_START( node );
 | 
|---|
| 1563 | 
 | 
|---|
| 1564 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1565 |         maybeAccept_impl   ( node->type  , *this );
 | 
|---|
| 1566 | 
 | 
|---|
| 1567 |         VISIT_END( node );
 | 
|---|
| 1568 | }
 | 
|---|
| 1569 | 
 | 
|---|
| 1570 | template< typename pass_type >
 | 
|---|
| 1571 | Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
 | 
|---|
| 1572 |         MUTATE_START( node );
 | 
|---|
| 1573 | 
 | 
|---|
| 1574 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1575 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1576 |         maybeMutate_impl   ( node->type  , *this );
 | 
|---|
| 1577 | 
 | 
|---|
| 1578 |         MUTATE_END( Expression, node );
 | 
|---|
| 1579 | }
 | 
|---|
| 1580 | 
 | 
|---|
| 1581 | //--------------------------------------------------------------------------
 | 
|---|
| 1582 | // OffsetofExpr
 | 
|---|
| 1583 | template< typename pass_type >
 | 
|---|
| 1584 | void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
 | 
|---|
| 1585 |         VISIT_START( node );
 | 
|---|
| 1586 | 
 | 
|---|
| 1587 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1588 |         maybeAccept_impl   ( node->type  , *this );
 | 
|---|
| 1589 | 
 | 
|---|
| 1590 |         VISIT_END( node );
 | 
|---|
| 1591 | }
 | 
|---|
| 1592 | 
 | 
|---|
| 1593 | template< typename pass_type >
 | 
|---|
| 1594 | Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
 | 
|---|
| 1595 |         MUTATE_START( node );
 | 
|---|
| 1596 | 
 | 
|---|
| 1597 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1598 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1599 |         maybeMutate_impl   ( node->type  , *this );
 | 
|---|
| 1600 | 
 | 
|---|
| 1601 |         MUTATE_END( Expression, node );
 | 
|---|
| 1602 | }
 | 
|---|
| 1603 | 
 | 
|---|
| 1604 | //--------------------------------------------------------------------------
 | 
|---|
| 1605 | // OffsetPackExpr
 | 
|---|
| 1606 | template< typename pass_type >
 | 
|---|
| 1607 | void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
 | 
|---|
| 1608 |         VISIT_START( node );
 | 
|---|
| 1609 | 
 | 
|---|
| 1610 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1611 |         maybeAccept_impl   ( node->type  , *this );
 | 
|---|
| 1612 | 
 | 
|---|
| 1613 |         VISIT_END( node );
 | 
|---|
| 1614 | }
 | 
|---|
| 1615 | 
 | 
|---|
| 1616 | template< typename pass_type >
 | 
|---|
| 1617 | Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
 | 
|---|
| 1618 |         MUTATE_START( node );
 | 
|---|
| 1619 | 
 | 
|---|
| 1620 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1621 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1622 |         maybeMutate_impl   ( node->type  , *this );
 | 
|---|
| 1623 | 
 | 
|---|
| 1624 |         MUTATE_END( Expression, node );
 | 
|---|
| 1625 | }
 | 
|---|
| 1626 | 
 | 
|---|
| 1627 | //--------------------------------------------------------------------------
 | 
|---|
| 1628 | // AttrExpr
 | 
|---|
| 1629 | template< typename pass_type >
 | 
|---|
| 1630 | void PassVisitor< pass_type >::visit( AttrExpr * node ) {
 | 
|---|
| 1631 |         VISIT_START( node );
 | 
|---|
| 1632 | 
 | 
|---|
| 1633 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1634 |         if ( node->get_isType() ) {
 | 
|---|
| 1635 |                 maybeAccept_impl( node->type, *this );
 | 
|---|
| 1636 |         } else {
 | 
|---|
| 1637 |                 maybeAccept_impl( node->expr, *this );
 | 
|---|
| 1638 |         }
 | 
|---|
| 1639 | 
 | 
|---|
| 1640 |         VISIT_END( node );
 | 
|---|
| 1641 | }
 | 
|---|
| 1642 | 
 | 
|---|
| 1643 | template< typename pass_type >
 | 
|---|
| 1644 | Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
 | 
|---|
| 1645 |         MUTATE_START( node );
 | 
|---|
| 1646 | 
 | 
|---|
| 1647 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1648 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1649 |         if ( node->get_isType() ) {
 | 
|---|
| 1650 |                 maybeMutate_impl( node->type, *this );
 | 
|---|
| 1651 |         } else {
 | 
|---|
| 1652 |                 maybeMutate_impl( node->expr, *this );
 | 
|---|
| 1653 |         }
 | 
|---|
| 1654 | 
 | 
|---|
| 1655 |         MUTATE_END( Expression, node );
 | 
|---|
| 1656 | }
 | 
|---|
| 1657 | 
 | 
|---|
| 1658 | //--------------------------------------------------------------------------
 | 
|---|
| 1659 | // LogicalExpr
 | 
|---|
| 1660 | template< typename pass_type >
 | 
|---|
| 1661 | void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
 | 
|---|
| 1662 |         VISIT_START( node );
 | 
|---|
| 1663 | 
 | 
|---|
| 1664 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1665 |         maybeAccept_impl   ( node->arg1  , *this );
 | 
|---|
| 1666 |         maybeAccept_impl   ( node->arg2  , *this );
 | 
|---|
| 1667 | 
 | 
|---|
| 1668 |         VISIT_END( node );
 | 
|---|
| 1669 | }
 | 
|---|
| 1670 | 
 | 
|---|
| 1671 | template< typename pass_type >
 | 
|---|
| 1672 | Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
 | 
|---|
| 1673 |         MUTATE_START( node );
 | 
|---|
| 1674 | 
 | 
|---|
| 1675 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1676 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1677 |         maybeMutate_impl   ( node->arg1  , *this );
 | 
|---|
| 1678 |         maybeMutate_impl   ( node->arg2  , *this );
 | 
|---|
| 1679 | 
 | 
|---|
| 1680 |         MUTATE_END( Expression, node );
 | 
|---|
| 1681 | }
 | 
|---|
| 1682 | 
 | 
|---|
| 1683 | //--------------------------------------------------------------------------
 | 
|---|
| 1684 | // ConditionalExpr
 | 
|---|
| 1685 | template< typename pass_type >
 | 
|---|
| 1686 | void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
 | 
|---|
| 1687 |         VISIT_START( node );
 | 
|---|
| 1688 | 
 | 
|---|
| 1689 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1690 |         maybeAccept_impl        ( node->arg1  , *this );
 | 
|---|
| 1691 |         maybeAccept_impl        ( node->arg2  , *this );
 | 
|---|
| 1692 |         maybeAccept_impl        ( node->arg3  , *this );
 | 
|---|
| 1693 | 
 | 
|---|
| 1694 |         VISIT_END( node );
 | 
|---|
| 1695 | }
 | 
|---|
| 1696 | 
 | 
|---|
| 1697 | template< typename pass_type >
 | 
|---|
| 1698 | Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
 | 
|---|
| 1699 |         MUTATE_START( node );
 | 
|---|
| 1700 | 
 | 
|---|
| 1701 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1702 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1703 |         maybeMutate_impl   ( node->arg1  , *this );
 | 
|---|
| 1704 |         maybeMutate_impl   ( node->arg2  , *this );
 | 
|---|
| 1705 |         maybeMutate_impl   ( node->arg3  , *this );
 | 
|---|
| 1706 | 
 | 
|---|
| 1707 |         MUTATE_END( Expression, node );
 | 
|---|
| 1708 | }
 | 
|---|
| 1709 | 
 | 
|---|
| 1710 | //--------------------------------------------------------------------------
 | 
|---|
| 1711 | // CommaExpr
 | 
|---|
| 1712 | template< typename pass_type >
 | 
|---|
| 1713 | void PassVisitor< pass_type >::visit( CommaExpr * node ) {
 | 
|---|
| 1714 |         VISIT_START( node );
 | 
|---|
| 1715 | 
 | 
|---|
| 1716 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1717 |         maybeAccept_impl   ( node->arg1  , *this );
 | 
|---|
| 1718 |         maybeAccept_impl   ( node->arg2  , *this );
 | 
|---|
| 1719 | 
 | 
|---|
| 1720 |         VISIT_END( node );
 | 
|---|
| 1721 | }
 | 
|---|
| 1722 | 
 | 
|---|
| 1723 | template< typename pass_type >
 | 
|---|
| 1724 | Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
 | 
|---|
| 1725 |         MUTATE_START( node );
 | 
|---|
| 1726 | 
 | 
|---|
| 1727 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1728 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1729 |         maybeMutate_impl   ( node->arg1  , *this );
 | 
|---|
| 1730 |         maybeMutate_impl   ( node->arg2  , *this );
 | 
|---|
| 1731 | 
 | 
|---|
| 1732 |         MUTATE_END( Expression, node );
 | 
|---|
| 1733 | }
 | 
|---|
| 1734 | 
 | 
|---|
| 1735 | //--------------------------------------------------------------------------
 | 
|---|
| 1736 | // TypeExpr
 | 
|---|
| 1737 | template< typename pass_type >
 | 
|---|
| 1738 | void PassVisitor< pass_type >::visit( TypeExpr * node ) {
 | 
|---|
| 1739 |         VISIT_START( node );
 | 
|---|
| 1740 | 
 | 
|---|
| 1741 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1742 |         maybeAccept_impl   ( node->type, *this );
 | 
|---|
| 1743 | 
 | 
|---|
| 1744 |         VISIT_END( node );
 | 
|---|
| 1745 | }
 | 
|---|
| 1746 | 
 | 
|---|
| 1747 | template< typename pass_type >
 | 
|---|
| 1748 | Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
 | 
|---|
| 1749 |         MUTATE_START( node );
 | 
|---|
| 1750 | 
 | 
|---|
| 1751 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1752 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1753 |         maybeMutate_impl   ( node->type  , *this );
 | 
|---|
| 1754 | 
 | 
|---|
| 1755 |         MUTATE_END( Expression, node );
 | 
|---|
| 1756 | }
 | 
|---|
| 1757 | 
 | 
|---|
| 1758 | //--------------------------------------------------------------------------
 | 
|---|
| 1759 | // AsmExpr
 | 
|---|
| 1760 | template< typename pass_type >
 | 
|---|
| 1761 | void PassVisitor< pass_type >::visit( AsmExpr * node ) {
 | 
|---|
| 1762 |         VISIT_START( node );
 | 
|---|
| 1763 | 
 | 
|---|
| 1764 |         indexerScopedAccept( node->result    , *this );
 | 
|---|
| 1765 |         maybeAccept_impl   ( node->inout     , *this );
 | 
|---|
| 1766 |         maybeAccept_impl   ( node->constraint, *this );
 | 
|---|
| 1767 |         maybeAccept_impl   ( node->operand   , *this );
 | 
|---|
| 1768 | 
 | 
|---|
| 1769 |         VISIT_END( node );
 | 
|---|
| 1770 | }
 | 
|---|
| 1771 | 
 | 
|---|
| 1772 | template< typename pass_type >
 | 
|---|
| 1773 | Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
 | 
|---|
| 1774 |         MUTATE_START( node );
 | 
|---|
| 1775 | 
 | 
|---|
| 1776 |         indexerScopedMutate( node->env       , *this );
 | 
|---|
| 1777 |         indexerScopedMutate( node->result    , *this );
 | 
|---|
| 1778 |         maybeMutate_impl   ( node->inout     , *this );
 | 
|---|
| 1779 |         maybeMutate_impl   ( node->constraint, *this );
 | 
|---|
| 1780 |         maybeMutate_impl   ( node->operand   , *this );
 | 
|---|
| 1781 | 
 | 
|---|
| 1782 |         MUTATE_END( Expression, node );
 | 
|---|
| 1783 | }
 | 
|---|
| 1784 | 
 | 
|---|
| 1785 | //--------------------------------------------------------------------------
 | 
|---|
| 1786 | // ImplicitCopyCtorExpr
 | 
|---|
| 1787 | template< typename pass_type >
 | 
|---|
| 1788 | void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
 | 
|---|
| 1789 |         VISIT_START( node );
 | 
|---|
| 1790 | 
 | 
|---|
| 1791 |         indexerScopedAccept( node->result     , *this );
 | 
|---|
| 1792 |         maybeAccept_impl   ( node->callExpr   , *this );
 | 
|---|
| 1793 |         maybeAccept_impl   ( node->tempDecls  , *this );
 | 
|---|
| 1794 |         maybeAccept_impl   ( node->returnDecls, *this );
 | 
|---|
| 1795 |         maybeAccept_impl   ( node->dtors      , *this );
 | 
|---|
| 1796 | 
 | 
|---|
| 1797 |         VISIT_END( node );
 | 
|---|
| 1798 | }
 | 
|---|
| 1799 | 
 | 
|---|
| 1800 | template< typename pass_type >
 | 
|---|
| 1801 | Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
 | 
|---|
| 1802 |         MUTATE_START( node );
 | 
|---|
| 1803 | 
 | 
|---|
| 1804 |         indexerScopedMutate( node->env        , *this );
 | 
|---|
| 1805 |         indexerScopedMutate( node->result     , *this );
 | 
|---|
| 1806 |         maybeMutate_impl   ( node->callExpr   , *this );
 | 
|---|
| 1807 |         maybeMutate_impl   ( node->tempDecls  , *this );
 | 
|---|
| 1808 |         maybeMutate_impl   ( node->returnDecls, *this );
 | 
|---|
| 1809 |         maybeMutate_impl   ( node->dtors      , *this );
 | 
|---|
| 1810 | 
 | 
|---|
| 1811 |         MUTATE_END( Expression, node );
 | 
|---|
| 1812 | }
 | 
|---|
| 1813 | 
 | 
|---|
| 1814 | //--------------------------------------------------------------------------
 | 
|---|
| 1815 | // ConstructorExpr
 | 
|---|
| 1816 | template< typename pass_type >
 | 
|---|
| 1817 | void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
 | 
|---|
| 1818 |         VISIT_START( node );
 | 
|---|
| 1819 | 
 | 
|---|
| 1820 |         indexerScopedAccept( node->result  , *this );
 | 
|---|
| 1821 |         maybeAccept_impl   ( node->callExpr, *this );
 | 
|---|
| 1822 | 
 | 
|---|
| 1823 |         VISIT_END( node );
 | 
|---|
| 1824 | }
 | 
|---|
| 1825 | 
 | 
|---|
| 1826 | template< typename pass_type >
 | 
|---|
| 1827 | Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
 | 
|---|
| 1828 |         MUTATE_START( node );
 | 
|---|
| 1829 | 
 | 
|---|
| 1830 |         indexerScopedMutate( node->env     , *this );
 | 
|---|
| 1831 |         indexerScopedMutate( node->result  , *this );
 | 
|---|
| 1832 |         maybeMutate_impl   ( node->callExpr, *this );
 | 
|---|
| 1833 | 
 | 
|---|
| 1834 |         MUTATE_END( Expression, node );
 | 
|---|
| 1835 | }
 | 
|---|
| 1836 | 
 | 
|---|
| 1837 | //--------------------------------------------------------------------------
 | 
|---|
| 1838 | // CompoundLiteralExpr
 | 
|---|
| 1839 | template< typename pass_type >
 | 
|---|
| 1840 | void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
 | 
|---|
| 1841 |         VISIT_START( node );
 | 
|---|
| 1842 | 
 | 
|---|
| 1843 |         indexerScopedAccept( node->result     , *this );
 | 
|---|
| 1844 |         maybeAccept_impl   ( node->initializer, *this );
 | 
|---|
| 1845 | 
 | 
|---|
| 1846 |         VISIT_END( node );
 | 
|---|
| 1847 | }
 | 
|---|
| 1848 | 
 | 
|---|
| 1849 | template< typename pass_type >
 | 
|---|
| 1850 | Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
 | 
|---|
| 1851 |         MUTATE_START( node );
 | 
|---|
| 1852 | 
 | 
|---|
| 1853 |         indexerScopedMutate( node->env        , *this );
 | 
|---|
| 1854 |         indexerScopedMutate( node->result     , *this );
 | 
|---|
| 1855 |         maybeMutate_impl     ( node->initializer, *this );
 | 
|---|
| 1856 | 
 | 
|---|
| 1857 |         MUTATE_END( Expression, node );
 | 
|---|
| 1858 | }
 | 
|---|
| 1859 | 
 | 
|---|
| 1860 | //--------------------------------------------------------------------------
 | 
|---|
| 1861 | // RangeExpr
 | 
|---|
| 1862 | template< typename pass_type >
 | 
|---|
| 1863 | void PassVisitor< pass_type >::visit( RangeExpr * node ) {
 | 
|---|
| 1864 |         VISIT_START( node );
 | 
|---|
| 1865 | 
 | 
|---|
| 1866 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1867 |         maybeAccept_impl   ( node->low   , *this );
 | 
|---|
| 1868 |         maybeAccept_impl   ( node->high  , *this );
 | 
|---|
| 1869 | 
 | 
|---|
| 1870 |         VISIT_END( node );
 | 
|---|
| 1871 | }
 | 
|---|
| 1872 | 
 | 
|---|
| 1873 | template< typename pass_type >
 | 
|---|
| 1874 | Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
 | 
|---|
| 1875 |         MUTATE_START( node );
 | 
|---|
| 1876 | 
 | 
|---|
| 1877 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1878 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1879 |         maybeMutate_impl   ( node->low   , *this );
 | 
|---|
| 1880 |         maybeMutate_impl   ( node->high  , *this );
 | 
|---|
| 1881 | 
 | 
|---|
| 1882 |         MUTATE_END( Expression, node );
 | 
|---|
| 1883 | }
 | 
|---|
| 1884 | 
 | 
|---|
| 1885 | //--------------------------------------------------------------------------
 | 
|---|
| 1886 | // UntypedTupleExpr
 | 
|---|
| 1887 | template< typename pass_type >
 | 
|---|
| 1888 | void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
 | 
|---|
| 1889 |         VISIT_START( node );
 | 
|---|
| 1890 | 
 | 
|---|
| 1891 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1892 |         maybeAccept_impl   ( node->exprs , *this );
 | 
|---|
| 1893 | 
 | 
|---|
| 1894 |         VISIT_END( node );
 | 
|---|
| 1895 | }
 | 
|---|
| 1896 | 
 | 
|---|
| 1897 | template< typename pass_type >
 | 
|---|
| 1898 | Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
 | 
|---|
| 1899 |         MUTATE_START( node );
 | 
|---|
| 1900 | 
 | 
|---|
| 1901 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1902 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1903 |         maybeMutate_impl   ( node->exprs , *this );
 | 
|---|
| 1904 | 
 | 
|---|
| 1905 |         MUTATE_END( Expression, node );
 | 
|---|
| 1906 | }
 | 
|---|
| 1907 | 
 | 
|---|
| 1908 | //--------------------------------------------------------------------------
 | 
|---|
| 1909 | // TupleExpr
 | 
|---|
| 1910 | template< typename pass_type >
 | 
|---|
| 1911 | void PassVisitor< pass_type >::visit( TupleExpr * node ) {
 | 
|---|
| 1912 |         VISIT_START( node );
 | 
|---|
| 1913 | 
 | 
|---|
| 1914 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1915 |         maybeAccept_impl   ( node->exprs , *this );
 | 
|---|
| 1916 | 
 | 
|---|
| 1917 |         VISIT_END( node );
 | 
|---|
| 1918 | }
 | 
|---|
| 1919 | 
 | 
|---|
| 1920 | template< typename pass_type >
 | 
|---|
| 1921 | Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
 | 
|---|
| 1922 |         MUTATE_START( node );
 | 
|---|
| 1923 | 
 | 
|---|
| 1924 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1925 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1926 |         maybeMutate_impl   ( node->exprs , *this );
 | 
|---|
| 1927 | 
 | 
|---|
| 1928 |         MUTATE_END( Expression, node );
 | 
|---|
| 1929 | }
 | 
|---|
| 1930 | 
 | 
|---|
| 1931 | //--------------------------------------------------------------------------
 | 
|---|
| 1932 | // TupleIndexExpr
 | 
|---|
| 1933 | template< typename pass_type >
 | 
|---|
| 1934 | void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
 | 
|---|
| 1935 |         VISIT_START( node );
 | 
|---|
| 1936 | 
 | 
|---|
| 1937 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 1938 |         maybeAccept_impl   ( node->tuple , *this );
 | 
|---|
| 1939 | 
 | 
|---|
| 1940 |         VISIT_END( node );
 | 
|---|
| 1941 | }
 | 
|---|
| 1942 | 
 | 
|---|
| 1943 | template< typename pass_type >
 | 
|---|
| 1944 | Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
 | 
|---|
| 1945 |         MUTATE_START( node );
 | 
|---|
| 1946 | 
 | 
|---|
| 1947 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 1948 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 1949 |         maybeMutate_impl   ( node->tuple , *this );
 | 
|---|
| 1950 | 
 | 
|---|
| 1951 |         MUTATE_END( Expression, node );
 | 
|---|
| 1952 | }
 | 
|---|
| 1953 | 
 | 
|---|
| 1954 | //--------------------------------------------------------------------------
 | 
|---|
| 1955 | // TupleAssignExpr
 | 
|---|
| 1956 | template< typename pass_type >
 | 
|---|
| 1957 | void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
 | 
|---|
| 1958 |         VISIT_START( node );
 | 
|---|
| 1959 | 
 | 
|---|
| 1960 |         indexerScopedAccept( node->result  , *this );
 | 
|---|
| 1961 |         maybeAccept_impl   ( node->stmtExpr, *this );
 | 
|---|
| 1962 | 
 | 
|---|
| 1963 |         VISIT_END( node );
 | 
|---|
| 1964 | }
 | 
|---|
| 1965 | 
 | 
|---|
| 1966 | template< typename pass_type >
 | 
|---|
| 1967 | Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
 | 
|---|
| 1968 |         MUTATE_START( node );
 | 
|---|
| 1969 | 
 | 
|---|
| 1970 |         indexerScopedMutate( node->env     , *this );
 | 
|---|
| 1971 |         indexerScopedMutate( node->result  , *this );
 | 
|---|
| 1972 |         maybeMutate_impl   ( node->stmtExpr, *this );
 | 
|---|
| 1973 | 
 | 
|---|
| 1974 |         MUTATE_END( Expression, node );
 | 
|---|
| 1975 | }
 | 
|---|
| 1976 | 
 | 
|---|
| 1977 | //--------------------------------------------------------------------------
 | 
|---|
| 1978 | // StmtExpr
 | 
|---|
| 1979 | template< typename pass_type >
 | 
|---|
| 1980 | void PassVisitor< pass_type >::visit( StmtExpr * node ) {
 | 
|---|
| 1981 |         VISIT_START( node );
 | 
|---|
| 1982 | 
 | 
|---|
| 1983 |         // don't want statements from outer CompoundStmts to be added to this StmtExpr
 | 
|---|
| 1984 |         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
 | 
|---|
| 1985 |         ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
 | 
|---|
| 1986 |         ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
 | 
|---|
| 1987 | 
 | 
|---|
| 1988 |         indexerScopedAccept( node->result     , *this );
 | 
|---|
| 1989 |         maybeAccept_impl   ( node->statements , *this );
 | 
|---|
| 1990 |         maybeAccept_impl   ( node->returnDecls, *this );
 | 
|---|
| 1991 |         maybeAccept_impl   ( node->dtors      , *this );
 | 
|---|
| 1992 | 
 | 
|---|
| 1993 |         VISIT_END( node );
 | 
|---|
| 1994 | }
 | 
|---|
| 1995 | 
 | 
|---|
| 1996 | template< typename pass_type >
 | 
|---|
| 1997 | Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) {
 | 
|---|
| 1998 |         MUTATE_START( node );
 | 
|---|
| 1999 | 
 | 
|---|
| 2000 |         // don't want statements from outer CompoundStmts to be added to this StmtExpr
 | 
|---|
| 2001 |         ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type >  oldEnv( get_env_ptr() );
 | 
|---|
| 2002 |         ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() );
 | 
|---|
| 2003 |         ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
 | 
|---|
| 2004 | 
 | 
|---|
| 2005 |         indexerScopedMutate( node->result     , *this );
 | 
|---|
| 2006 |         maybeMutate_impl   ( node->statements , *this );
 | 
|---|
| 2007 |         maybeMutate_impl   ( node->returnDecls, *this );
 | 
|---|
| 2008 |         maybeMutate_impl   ( node->dtors      , *this );
 | 
|---|
| 2009 | 
 | 
|---|
| 2010 |         MUTATE_END( Expression, node );
 | 
|---|
| 2011 | }
 | 
|---|
| 2012 | 
 | 
|---|
| 2013 | //--------------------------------------------------------------------------
 | 
|---|
| 2014 | // UniqueExpr
 | 
|---|
| 2015 | template< typename pass_type >
 | 
|---|
| 2016 | void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
 | 
|---|
| 2017 |         VISIT_START( node );
 | 
|---|
| 2018 | 
 | 
|---|
| 2019 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 2020 |         maybeAccept_impl   ( node->expr  , *this );
 | 
|---|
| 2021 | 
 | 
|---|
| 2022 |         VISIT_END( node );
 | 
|---|
| 2023 | }
 | 
|---|
| 2024 | 
 | 
|---|
| 2025 | template< typename pass_type >
 | 
|---|
| 2026 | Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
 | 
|---|
| 2027 |         MUTATE_START( node );
 | 
|---|
| 2028 | 
 | 
|---|
| 2029 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 2030 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 2031 |         maybeMutate_impl   ( node->expr  , *this );
 | 
|---|
| 2032 | 
 | 
|---|
| 2033 |         MUTATE_END( Expression, node );
 | 
|---|
| 2034 | }
 | 
|---|
| 2035 | 
 | 
|---|
| 2036 | //--------------------------------------------------------------------------
 | 
|---|
| 2037 | // UntypedInitExpr
 | 
|---|
| 2038 | template< typename pass_type >
 | 
|---|
| 2039 | void PassVisitor< pass_type >::visit( UntypedInitExpr * node ) {
 | 
|---|
| 2040 |         VISIT_START( node );
 | 
|---|
| 2041 | 
 | 
|---|
| 2042 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 2043 |         maybeAccept_impl   ( node->expr  , *this );
 | 
|---|
| 2044 |         // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
 | 
|---|
| 2045 | 
 | 
|---|
| 2046 |         VISIT_END( node );
 | 
|---|
| 2047 | }
 | 
|---|
| 2048 | 
 | 
|---|
| 2049 | template< typename pass_type >
 | 
|---|
| 2050 | Expression * PassVisitor< pass_type >::mutate( UntypedInitExpr * node ) {
 | 
|---|
| 2051 |         MUTATE_START( node );
 | 
|---|
| 2052 | 
 | 
|---|
| 2053 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 2054 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 2055 |         maybeMutate_impl   ( node->expr  , *this );
 | 
|---|
| 2056 |         // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
 | 
|---|
| 2057 | 
 | 
|---|
| 2058 |         MUTATE_END( Expression, node );
 | 
|---|
| 2059 | }
 | 
|---|
| 2060 | 
 | 
|---|
| 2061 | //--------------------------------------------------------------------------
 | 
|---|
| 2062 | // InitExpr
 | 
|---|
| 2063 | template< typename pass_type >
 | 
|---|
| 2064 | void PassVisitor< pass_type >::visit( InitExpr * node ) {
 | 
|---|
| 2065 |         VISIT_START( node );
 | 
|---|
| 2066 | 
 | 
|---|
| 2067 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 2068 |         maybeAccept_impl   ( node->expr  , *this );
 | 
|---|
| 2069 |         maybeAccept_impl   ( node->designation, *this );
 | 
|---|
| 2070 | 
 | 
|---|
| 2071 |         VISIT_END( node );
 | 
|---|
| 2072 | }
 | 
|---|
| 2073 | 
 | 
|---|
| 2074 | template< typename pass_type >
 | 
|---|
| 2075 | Expression * PassVisitor< pass_type >::mutate( InitExpr * node ) {
 | 
|---|
| 2076 |         MUTATE_START( node );
 | 
|---|
| 2077 | 
 | 
|---|
| 2078 |         indexerScopedMutate( node->env   , *this );
 | 
|---|
| 2079 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 2080 |         maybeMutate_impl   ( node->expr  , *this );
 | 
|---|
| 2081 |         maybeMutate_impl   ( node->designation, *this );
 | 
|---|
| 2082 | 
 | 
|---|
| 2083 |         MUTATE_END( Expression, node );
 | 
|---|
| 2084 | }
 | 
|---|
| 2085 | 
 | 
|---|
| 2086 | //--------------------------------------------------------------------------
 | 
|---|
| 2087 | // DeletedExpr
 | 
|---|
| 2088 | template< typename pass_type >
 | 
|---|
| 2089 | void PassVisitor< pass_type >::visit( DeletedExpr * node ) {
 | 
|---|
| 2090 |         VISIT_START( node );
 | 
|---|
| 2091 | 
 | 
|---|
| 2092 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 2093 |         maybeAccept_impl( node->expr, *this );
 | 
|---|
| 2094 |         // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
 | 
|---|
| 2095 | 
 | 
|---|
| 2096 |         VISIT_END( node );
 | 
|---|
| 2097 | }
 | 
|---|
| 2098 | 
 | 
|---|
| 2099 | template< typename pass_type >
 | 
|---|
| 2100 | Expression * PassVisitor< pass_type >::mutate( DeletedExpr * node ) {
 | 
|---|
| 2101 |         MUTATE_START( node );
 | 
|---|
| 2102 | 
 | 
|---|
| 2103 |         indexerScopedMutate( node->env, *this );
 | 
|---|
| 2104 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 2105 |         maybeMutate_impl( node->expr, *this );
 | 
|---|
| 2106 | 
 | 
|---|
| 2107 |         MUTATE_END( Expression, node );
 | 
|---|
| 2108 | }
 | 
|---|
| 2109 | 
 | 
|---|
| 2110 | //--------------------------------------------------------------------------
 | 
|---|
| 2111 | // DefaultArgExpr
 | 
|---|
| 2112 | template< typename pass_type >
 | 
|---|
| 2113 | void PassVisitor< pass_type >::visit( DefaultArgExpr * node ) {
 | 
|---|
| 2114 |         VISIT_START( node );
 | 
|---|
| 2115 | 
 | 
|---|
| 2116 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 2117 |         maybeAccept_impl( node->expr, *this );
 | 
|---|
| 2118 | 
 | 
|---|
| 2119 |         VISIT_END( node );
 | 
|---|
| 2120 | }
 | 
|---|
| 2121 | 
 | 
|---|
| 2122 | template< typename pass_type >
 | 
|---|
| 2123 | Expression * PassVisitor< pass_type >::mutate( DefaultArgExpr * node ) {
 | 
|---|
| 2124 |         MUTATE_START( node );
 | 
|---|
| 2125 | 
 | 
|---|
| 2126 |         indexerScopedMutate( node->env, *this );
 | 
|---|
| 2127 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 2128 |         maybeMutate_impl( node->expr, *this );
 | 
|---|
| 2129 | 
 | 
|---|
| 2130 |         MUTATE_END( Expression, node );
 | 
|---|
| 2131 | }
 | 
|---|
| 2132 | 
 | 
|---|
| 2133 | //--------------------------------------------------------------------------
 | 
|---|
| 2134 | // GenericExpr
 | 
|---|
| 2135 | template< typename pass_type >
 | 
|---|
| 2136 | void PassVisitor< pass_type >::visit( GenericExpr * node ) {
 | 
|---|
| 2137 |         VISIT_START( node );
 | 
|---|
| 2138 | 
 | 
|---|
| 2139 |         indexerScopedAccept( node->result, *this );
 | 
|---|
| 2140 |         maybeAccept_impl( node->control, *this );
 | 
|---|
| 2141 |         for ( GenericExpr::Association & assoc : node->associations ) {
 | 
|---|
| 2142 |                 indexerScopedAccept( assoc.type, *this );
 | 
|---|
| 2143 |                 maybeAccept_impl( assoc.expr, *this );
 | 
|---|
| 2144 |         }
 | 
|---|
| 2145 | 
 | 
|---|
| 2146 |         VISIT_END( node );
 | 
|---|
| 2147 | }
 | 
|---|
| 2148 | 
 | 
|---|
| 2149 | template< typename pass_type >
 | 
|---|
| 2150 | Expression * PassVisitor< pass_type >::mutate( GenericExpr * node ) {
 | 
|---|
| 2151 |         MUTATE_START( node );
 | 
|---|
| 2152 | 
 | 
|---|
| 2153 |         indexerScopedMutate( node->env, *this );
 | 
|---|
| 2154 |         indexerScopedMutate( node->result, *this );
 | 
|---|
| 2155 |         maybeMutate_impl( node->control, *this );
 | 
|---|
| 2156 |         for ( GenericExpr::Association & assoc : node->associations ) {
 | 
|---|
| 2157 |                 indexerScopedMutate( assoc.type, *this );
 | 
|---|
| 2158 |                 maybeMutate_impl( assoc.expr, *this );
 | 
|---|
| 2159 |         }
 | 
|---|
| 2160 | 
 | 
|---|
| 2161 |         MUTATE_END( Expression, node );
 | 
|---|
| 2162 | }
 | 
|---|
| 2163 | 
 | 
|---|
| 2164 | //--------------------------------------------------------------------------
 | 
|---|
| 2165 | // VoidType
 | 
|---|
| 2166 | template< typename pass_type >
 | 
|---|
| 2167 | void PassVisitor< pass_type >::visit( VoidType * node ) {
 | 
|---|
| 2168 |         VISIT_START( node );
 | 
|---|
| 2169 | 
 | 
|---|
| 2170 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2171 | 
 | 
|---|
| 2172 |         VISIT_END( node );
 | 
|---|
| 2173 | }
 | 
|---|
| 2174 | 
 | 
|---|
| 2175 | template< typename pass_type >
 | 
|---|
| 2176 | Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
 | 
|---|
| 2177 |         MUTATE_START( node );
 | 
|---|
| 2178 | 
 | 
|---|
| 2179 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2180 | 
 | 
|---|
| 2181 |         MUTATE_END( Type, node );
 | 
|---|
| 2182 | }
 | 
|---|
| 2183 | 
 | 
|---|
| 2184 | //--------------------------------------------------------------------------
 | 
|---|
| 2185 | // BasicType
 | 
|---|
| 2186 | template< typename pass_type >
 | 
|---|
| 2187 | void PassVisitor< pass_type >::visit( BasicType * node ) {
 | 
|---|
| 2188 |         VISIT_START( node );
 | 
|---|
| 2189 | 
 | 
|---|
| 2190 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2191 | 
 | 
|---|
| 2192 |         VISIT_END( node );
 | 
|---|
| 2193 | }
 | 
|---|
| 2194 | 
 | 
|---|
| 2195 | template< typename pass_type >
 | 
|---|
| 2196 | Type * PassVisitor< pass_type >::mutate( BasicType * node ) {
 | 
|---|
| 2197 |         MUTATE_START( node );
 | 
|---|
| 2198 | 
 | 
|---|
| 2199 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2200 | 
 | 
|---|
| 2201 |         MUTATE_END( Type, node );
 | 
|---|
| 2202 | }
 | 
|---|
| 2203 | 
 | 
|---|
| 2204 | //--------------------------------------------------------------------------
 | 
|---|
| 2205 | // PointerType
 | 
|---|
| 2206 | template< typename pass_type >
 | 
|---|
| 2207 | void PassVisitor< pass_type >::visit( PointerType * node ) {
 | 
|---|
| 2208 |         VISIT_START( node );
 | 
|---|
| 2209 | 
 | 
|---|
| 2210 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2211 |         // xxx - should PointerType visit/mutate dimension?
 | 
|---|
| 2212 |         maybeAccept_impl( node->base, *this );
 | 
|---|
| 2213 | 
 | 
|---|
| 2214 |         VISIT_END( node );
 | 
|---|
| 2215 | }
 | 
|---|
| 2216 | 
 | 
|---|
| 2217 | template< typename pass_type >
 | 
|---|
| 2218 | Type * PassVisitor< pass_type >::mutate( PointerType * node ) {
 | 
|---|
| 2219 |         MUTATE_START( node );
 | 
|---|
| 2220 | 
 | 
|---|
| 2221 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2222 |         // xxx - should PointerType visit/mutate dimension?
 | 
|---|
| 2223 |         maybeMutate_impl( node->base, *this );
 | 
|---|
| 2224 | 
 | 
|---|
| 2225 |         MUTATE_END( Type, node );
 | 
|---|
| 2226 | }
 | 
|---|
| 2227 | 
 | 
|---|
| 2228 | //--------------------------------------------------------------------------
 | 
|---|
| 2229 | // ArrayType
 | 
|---|
| 2230 | template< typename pass_type >
 | 
|---|
| 2231 | void PassVisitor< pass_type >::visit( ArrayType * node ) {
 | 
|---|
| 2232 |         VISIT_START( node );
 | 
|---|
| 2233 | 
 | 
|---|
| 2234 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2235 |         maybeAccept_impl( node->dimension, *this );
 | 
|---|
| 2236 |         maybeAccept_impl( node->base, *this );
 | 
|---|
| 2237 | 
 | 
|---|
| 2238 |         VISIT_END( node );
 | 
|---|
| 2239 | }
 | 
|---|
| 2240 | 
 | 
|---|
| 2241 | template< typename pass_type >
 | 
|---|
| 2242 | Type * PassVisitor< pass_type >::mutate( ArrayType * node ) {
 | 
|---|
| 2243 |         MUTATE_START( node );
 | 
|---|
| 2244 | 
 | 
|---|
| 2245 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2246 |         maybeMutate_impl( node->dimension, *this );
 | 
|---|
| 2247 |         maybeMutate_impl( node->base, *this );
 | 
|---|
| 2248 | 
 | 
|---|
| 2249 |         MUTATE_END( Type, node );
 | 
|---|
| 2250 | }
 | 
|---|
| 2251 | 
 | 
|---|
| 2252 | //--------------------------------------------------------------------------
 | 
|---|
| 2253 | // ReferenceType
 | 
|---|
| 2254 | template< typename pass_type >
 | 
|---|
| 2255 | void PassVisitor< pass_type >::visit( ReferenceType * node ) {
 | 
|---|
| 2256 |         VISIT_START( node );
 | 
|---|
| 2257 | 
 | 
|---|
| 2258 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2259 |         maybeAccept_impl( node->base, *this );
 | 
|---|
| 2260 | 
 | 
|---|
| 2261 |         VISIT_END( node );
 | 
|---|
| 2262 | }
 | 
|---|
| 2263 | 
 | 
|---|
| 2264 | template< typename pass_type >
 | 
|---|
| 2265 | Type * PassVisitor< pass_type >::mutate( ReferenceType * node ) {
 | 
|---|
| 2266 |         MUTATE_START( node );
 | 
|---|
| 2267 | 
 | 
|---|
| 2268 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2269 |         maybeMutate_impl( node->base, *this );
 | 
|---|
| 2270 | 
 | 
|---|
| 2271 |         MUTATE_END( Type, node );
 | 
|---|
| 2272 | }
 | 
|---|
| 2273 | 
 | 
|---|
| 2274 | //--------------------------------------------------------------------------
 | 
|---|
| 2275 | // QualifiedType
 | 
|---|
| 2276 | template< typename pass_type >
 | 
|---|
| 2277 | void PassVisitor< pass_type >::visit( QualifiedType * node ) {
 | 
|---|
| 2278 |         VISIT_START( node );
 | 
|---|
| 2279 | 
 | 
|---|
| 2280 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2281 |         maybeAccept_impl( node->parent, *this );
 | 
|---|
| 2282 |         maybeAccept_impl( node->child, *this );
 | 
|---|
| 2283 | 
 | 
|---|
| 2284 |         VISIT_END( node );
 | 
|---|
| 2285 | }
 | 
|---|
| 2286 | 
 | 
|---|
| 2287 | template< typename pass_type >
 | 
|---|
| 2288 | Type * PassVisitor< pass_type >::mutate( QualifiedType * node ) {
 | 
|---|
| 2289 |         MUTATE_START( node );
 | 
|---|
| 2290 | 
 | 
|---|
| 2291 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2292 |         maybeMutate_impl( node->parent, *this );
 | 
|---|
| 2293 |         maybeMutate_impl( node->child, *this );
 | 
|---|
| 2294 | 
 | 
|---|
| 2295 |         MUTATE_END( Type, node );
 | 
|---|
| 2296 | }
 | 
|---|
| 2297 | 
 | 
|---|
| 2298 | //--------------------------------------------------------------------------
 | 
|---|
| 2299 | // FunctionType
 | 
|---|
| 2300 | template< typename pass_type >
 | 
|---|
| 2301 | void PassVisitor< pass_type >::visit( FunctionType * node ) {
 | 
|---|
| 2302 |         VISIT_START( node );
 | 
|---|
| 2303 | 
 | 
|---|
| 2304 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2305 |         maybeAccept_impl( node->returnVals, *this );
 | 
|---|
| 2306 |         maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2307 | 
 | 
|---|
| 2308 |         VISIT_END( node );
 | 
|---|
| 2309 | }
 | 
|---|
| 2310 | 
 | 
|---|
| 2311 | template< typename pass_type >
 | 
|---|
| 2312 | Type * PassVisitor< pass_type >::mutate( FunctionType * node ) {
 | 
|---|
| 2313 |         MUTATE_START( node );
 | 
|---|
| 2314 | 
 | 
|---|
| 2315 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2316 |         maybeMutate_impl( node->returnVals, *this );
 | 
|---|
| 2317 |         maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2318 | 
 | 
|---|
| 2319 |         MUTATE_END( Type, node );
 | 
|---|
| 2320 | }
 | 
|---|
| 2321 | 
 | 
|---|
| 2322 | //--------------------------------------------------------------------------
 | 
|---|
| 2323 | // StructInstType
 | 
|---|
| 2324 | template< typename pass_type >
 | 
|---|
| 2325 | void PassVisitor< pass_type >::visit( StructInstType * node ) {
 | 
|---|
| 2326 |         VISIT_START( node );
 | 
|---|
| 2327 | 
 | 
|---|
| 2328 |         indexerAddStruct( node->name );
 | 
|---|
| 2329 | 
 | 
|---|
| 2330 |         {
 | 
|---|
| 2331 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 2332 |                 maybeAccept_impl( node->forall    , *this );
 | 
|---|
| 2333 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2334 |         }
 | 
|---|
| 2335 | 
 | 
|---|
| 2336 |         VISIT_END( node );
 | 
|---|
| 2337 | }
 | 
|---|
| 2338 | 
 | 
|---|
| 2339 | template< typename pass_type >
 | 
|---|
| 2340 | Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
 | 
|---|
| 2341 |         MUTATE_START( node );
 | 
|---|
| 2342 | 
 | 
|---|
| 2343 |         indexerAddStruct( node->name );
 | 
|---|
| 2344 | 
 | 
|---|
| 2345 |         {
 | 
|---|
| 2346 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 2347 |                 maybeMutate_impl( node->forall    , *this );
 | 
|---|
| 2348 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2349 |         }
 | 
|---|
| 2350 | 
 | 
|---|
| 2351 |         MUTATE_END( Type, node );
 | 
|---|
| 2352 | }
 | 
|---|
| 2353 | 
 | 
|---|
| 2354 | //--------------------------------------------------------------------------
 | 
|---|
| 2355 | // UnionInstType
 | 
|---|
| 2356 | template< typename pass_type >
 | 
|---|
| 2357 | void PassVisitor< pass_type >::visit( UnionInstType * node ) {
 | 
|---|
| 2358 |         VISIT_START( node );
 | 
|---|
| 2359 | 
 | 
|---|
| 2360 |         indexerAddStruct( node->name );
 | 
|---|
| 2361 | 
 | 
|---|
| 2362 |         {
 | 
|---|
| 2363 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 2364 |                 maybeAccept_impl( node->forall    , *this );
 | 
|---|
| 2365 |                 maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2366 |         }
 | 
|---|
| 2367 | 
 | 
|---|
| 2368 |         VISIT_END( node );
 | 
|---|
| 2369 | }
 | 
|---|
| 2370 | 
 | 
|---|
| 2371 | template< typename pass_type >
 | 
|---|
| 2372 | Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
 | 
|---|
| 2373 |         MUTATE_START( node );
 | 
|---|
| 2374 | 
 | 
|---|
| 2375 |         indexerAddStruct( node->name );
 | 
|---|
| 2376 | 
 | 
|---|
| 2377 |         {
 | 
|---|
| 2378 |                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
 | 
|---|
| 2379 |                 maybeMutate_impl( node->forall    , *this );
 | 
|---|
| 2380 |                 maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2381 |         }
 | 
|---|
| 2382 | 
 | 
|---|
| 2383 |         MUTATE_END( Type, node );
 | 
|---|
| 2384 | }
 | 
|---|
| 2385 | 
 | 
|---|
| 2386 | //--------------------------------------------------------------------------
 | 
|---|
| 2387 | // EnumInstType
 | 
|---|
| 2388 | template< typename pass_type >
 | 
|---|
| 2389 | void PassVisitor< pass_type >::visit( EnumInstType * node ) {
 | 
|---|
| 2390 |         VISIT_START( node );
 | 
|---|
| 2391 | 
 | 
|---|
| 2392 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2393 |         maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2394 | 
 | 
|---|
| 2395 |         VISIT_END( node );
 | 
|---|
| 2396 | }
 | 
|---|
| 2397 | 
 | 
|---|
| 2398 | template< typename pass_type >
 | 
|---|
| 2399 | Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
 | 
|---|
| 2400 |         MUTATE_START( node );
 | 
|---|
| 2401 | 
 | 
|---|
| 2402 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2403 |         maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2404 | 
 | 
|---|
| 2405 |         MUTATE_END( Type, node );
 | 
|---|
| 2406 | }
 | 
|---|
| 2407 | 
 | 
|---|
| 2408 | //--------------------------------------------------------------------------
 | 
|---|
| 2409 | // TraitInstType
 | 
|---|
| 2410 | template< typename pass_type >
 | 
|---|
| 2411 | void PassVisitor< pass_type >::visit( TraitInstType * node ) {
 | 
|---|
| 2412 |         VISIT_START( node );
 | 
|---|
| 2413 | 
 | 
|---|
| 2414 |         maybeAccept_impl( node->forall    , *this );
 | 
|---|
| 2415 |         maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2416 | 
 | 
|---|
| 2417 |         VISIT_END( node );
 | 
|---|
| 2418 | }
 | 
|---|
| 2419 | 
 | 
|---|
| 2420 | template< typename pass_type >
 | 
|---|
| 2421 | Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
 | 
|---|
| 2422 |         MUTATE_START( node );
 | 
|---|
| 2423 | 
 | 
|---|
| 2424 |         maybeMutate_impl( node->forall    , *this );
 | 
|---|
| 2425 |         maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2426 | 
 | 
|---|
| 2427 |         MUTATE_END( Type, node );
 | 
|---|
| 2428 | }
 | 
|---|
| 2429 | 
 | 
|---|
| 2430 | //--------------------------------------------------------------------------
 | 
|---|
| 2431 | // TypeInstType
 | 
|---|
| 2432 | template< typename pass_type >
 | 
|---|
| 2433 | void PassVisitor< pass_type >::visit( TypeInstType * node ) {
 | 
|---|
| 2434 |         VISIT_START( node );
 | 
|---|
| 2435 | 
 | 
|---|
| 2436 |         maybeAccept_impl( node->forall    , *this );
 | 
|---|
| 2437 |         maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2438 | 
 | 
|---|
| 2439 |         VISIT_END( node );
 | 
|---|
| 2440 | }
 | 
|---|
| 2441 | 
 | 
|---|
| 2442 | template< typename pass_type >
 | 
|---|
| 2443 | Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) {
 | 
|---|
| 2444 |         MUTATE_START( node );
 | 
|---|
| 2445 | 
 | 
|---|
| 2446 |         maybeMutate_impl( node->forall    , *this );
 | 
|---|
| 2447 |         maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2448 | 
 | 
|---|
| 2449 |         MUTATE_END( Type, node );
 | 
|---|
| 2450 | }
 | 
|---|
| 2451 | 
 | 
|---|
| 2452 | //--------------------------------------------------------------------------
 | 
|---|
| 2453 | // TupleType
 | 
|---|
| 2454 | template< typename pass_type >
 | 
|---|
| 2455 | void PassVisitor< pass_type >::visit( TupleType * node ) {
 | 
|---|
| 2456 |         VISIT_START( node );
 | 
|---|
| 2457 | 
 | 
|---|
| 2458 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2459 |         maybeAccept_impl( node->types, *this );
 | 
|---|
| 2460 |         maybeAccept_impl( node->members, *this );
 | 
|---|
| 2461 | 
 | 
|---|
| 2462 |         VISIT_END( node );
 | 
|---|
| 2463 | }
 | 
|---|
| 2464 | 
 | 
|---|
| 2465 | template< typename pass_type >
 | 
|---|
| 2466 | Type * PassVisitor< pass_type >::mutate( TupleType * node ) {
 | 
|---|
| 2467 |         MUTATE_START( node );
 | 
|---|
| 2468 | 
 | 
|---|
| 2469 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2470 |         maybeMutate_impl( node->types, *this );
 | 
|---|
| 2471 |         maybeMutate_impl( node->members, *this );
 | 
|---|
| 2472 | 
 | 
|---|
| 2473 |         MUTATE_END( Type, node );
 | 
|---|
| 2474 | }
 | 
|---|
| 2475 | 
 | 
|---|
| 2476 | //--------------------------------------------------------------------------
 | 
|---|
| 2477 | // TypeofType
 | 
|---|
| 2478 | template< typename pass_type >
 | 
|---|
| 2479 | void PassVisitor< pass_type >::visit( TypeofType * node ) {
 | 
|---|
| 2480 |         VISIT_START( node );
 | 
|---|
| 2481 | 
 | 
|---|
| 2482 |         assert( node->expr );
 | 
|---|
| 2483 |         maybeAccept_impl( node->expr, *this );
 | 
|---|
| 2484 | 
 | 
|---|
| 2485 |         VISIT_END( node );
 | 
|---|
| 2486 | }
 | 
|---|
| 2487 | 
 | 
|---|
| 2488 | template< typename pass_type >
 | 
|---|
| 2489 | Type * PassVisitor< pass_type >::mutate( TypeofType * node ) {
 | 
|---|
| 2490 |         MUTATE_START( node );
 | 
|---|
| 2491 | 
 | 
|---|
| 2492 |         assert( node->expr );
 | 
|---|
| 2493 |         maybeMutate_impl( node->expr, *this );
 | 
|---|
| 2494 | 
 | 
|---|
| 2495 |         MUTATE_END( Type, node );
 | 
|---|
| 2496 | }
 | 
|---|
| 2497 | 
 | 
|---|
| 2498 | //--------------------------------------------------------------------------
 | 
|---|
| 2499 | // AttrType
 | 
|---|
| 2500 | template< typename pass_type >
 | 
|---|
| 2501 | void PassVisitor< pass_type >::visit( AttrType * node ) {
 | 
|---|
| 2502 |         VISIT_START( node );
 | 
|---|
| 2503 | 
 | 
|---|
| 2504 |         if ( node->isType ) {
 | 
|---|
| 2505 |                 assert( node->type );
 | 
|---|
| 2506 |                 maybeAccept_impl( node->type, *this );
 | 
|---|
| 2507 |         } else {
 | 
|---|
| 2508 |                 assert( node->expr );
 | 
|---|
| 2509 |                 maybeAccept_impl( node->expr, *this );
 | 
|---|
| 2510 |         } // if
 | 
|---|
| 2511 | 
 | 
|---|
| 2512 |         VISIT_END( node );
 | 
|---|
| 2513 | }
 | 
|---|
| 2514 | 
 | 
|---|
| 2515 | template< typename pass_type >
 | 
|---|
| 2516 | Type * PassVisitor< pass_type >::mutate( AttrType * node ) {
 | 
|---|
| 2517 |         MUTATE_START( node );
 | 
|---|
| 2518 | 
 | 
|---|
| 2519 |         if ( node->isType ) {
 | 
|---|
| 2520 |                 assert( node->type );
 | 
|---|
| 2521 |                 maybeMutate_impl( node->type, *this );
 | 
|---|
| 2522 |         } else {
 | 
|---|
| 2523 |                 assert( node->expr );
 | 
|---|
| 2524 |                 maybeMutate_impl( node->expr, *this );
 | 
|---|
| 2525 |         } // if
 | 
|---|
| 2526 | 
 | 
|---|
| 2527 |         MUTATE_END( Type, node );
 | 
|---|
| 2528 | }
 | 
|---|
| 2529 | 
 | 
|---|
| 2530 | //--------------------------------------------------------------------------
 | 
|---|
| 2531 | // VarArgsType
 | 
|---|
| 2532 | template< typename pass_type >
 | 
|---|
| 2533 | void PassVisitor< pass_type >::visit( VarArgsType * node ) {
 | 
|---|
| 2534 |         VISIT_START( node );
 | 
|---|
| 2535 | 
 | 
|---|
| 2536 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2537 | 
 | 
|---|
| 2538 |         VISIT_END( node );
 | 
|---|
| 2539 | }
 | 
|---|
| 2540 | 
 | 
|---|
| 2541 | template< typename pass_type >
 | 
|---|
| 2542 | Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) {
 | 
|---|
| 2543 |         MUTATE_START( node );
 | 
|---|
| 2544 | 
 | 
|---|
| 2545 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2546 | 
 | 
|---|
| 2547 |         MUTATE_END( Type, node );
 | 
|---|
| 2548 | }
 | 
|---|
| 2549 | 
 | 
|---|
| 2550 | //--------------------------------------------------------------------------
 | 
|---|
| 2551 | // ZeroType
 | 
|---|
| 2552 | template< typename pass_type >
 | 
|---|
| 2553 | void PassVisitor< pass_type >::visit( ZeroType * node ) {
 | 
|---|
| 2554 |         VISIT_START( node );
 | 
|---|
| 2555 | 
 | 
|---|
| 2556 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2557 | 
 | 
|---|
| 2558 |         VISIT_END( node );
 | 
|---|
| 2559 | }
 | 
|---|
| 2560 | 
 | 
|---|
| 2561 | template< typename pass_type >
 | 
|---|
| 2562 | Type * PassVisitor< pass_type >::mutate( ZeroType * node ) {
 | 
|---|
| 2563 |         MUTATE_START( node );
 | 
|---|
| 2564 | 
 | 
|---|
| 2565 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2566 | 
 | 
|---|
| 2567 |         MUTATE_END( Type, node );
 | 
|---|
| 2568 | }
 | 
|---|
| 2569 | 
 | 
|---|
| 2570 | //--------------------------------------------------------------------------
 | 
|---|
| 2571 | // OneType
 | 
|---|
| 2572 | template< typename pass_type >
 | 
|---|
| 2573 | void PassVisitor< pass_type >::visit( OneType * node ) {
 | 
|---|
| 2574 |         VISIT_START( node );
 | 
|---|
| 2575 | 
 | 
|---|
| 2576 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2577 | 
 | 
|---|
| 2578 |         VISIT_END( node );
 | 
|---|
| 2579 | }
 | 
|---|
| 2580 | 
 | 
|---|
| 2581 | template< typename pass_type >
 | 
|---|
| 2582 | Type * PassVisitor< pass_type >::mutate( OneType * node ) {
 | 
|---|
| 2583 |         MUTATE_START( node );
 | 
|---|
| 2584 | 
 | 
|---|
| 2585 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2586 | 
 | 
|---|
| 2587 |         MUTATE_END( Type, node );
 | 
|---|
| 2588 | }
 | 
|---|
| 2589 | 
 | 
|---|
| 2590 | //--------------------------------------------------------------------------
 | 
|---|
| 2591 | // GlobalScopeType
 | 
|---|
| 2592 | template< typename pass_type >
 | 
|---|
| 2593 | void PassVisitor< pass_type >::visit( GlobalScopeType * node ) {
 | 
|---|
| 2594 |         VISIT_START( node );
 | 
|---|
| 2595 | 
 | 
|---|
| 2596 |         maybeAccept_impl( node->forall, *this );
 | 
|---|
| 2597 | 
 | 
|---|
| 2598 |         VISIT_END( node );
 | 
|---|
| 2599 | }
 | 
|---|
| 2600 | 
 | 
|---|
| 2601 | template< typename pass_type >
 | 
|---|
| 2602 | Type * PassVisitor< pass_type >::mutate( GlobalScopeType * node ) {
 | 
|---|
| 2603 |         MUTATE_START( node );
 | 
|---|
| 2604 | 
 | 
|---|
| 2605 |         maybeMutate_impl( node->forall, *this );
 | 
|---|
| 2606 | 
 | 
|---|
| 2607 |         MUTATE_END( Type, node );
 | 
|---|
| 2608 | }
 | 
|---|
| 2609 | 
 | 
|---|
| 2610 | //--------------------------------------------------------------------------
 | 
|---|
| 2611 | // Designation
 | 
|---|
| 2612 | template< typename pass_type >
 | 
|---|
| 2613 | void PassVisitor< pass_type >::visit( Designation * node ) {
 | 
|---|
| 2614 |         VISIT_START( node );
 | 
|---|
| 2615 | 
 | 
|---|
| 2616 |         maybeAccept_impl( node->designators, *this );
 | 
|---|
| 2617 | 
 | 
|---|
| 2618 |         VISIT_END( node );
 | 
|---|
| 2619 | }
 | 
|---|
| 2620 | 
 | 
|---|
| 2621 | template< typename pass_type >
 | 
|---|
| 2622 | Designation * PassVisitor< pass_type >::mutate( Designation * node ) {
 | 
|---|
| 2623 |         MUTATE_START( node );
 | 
|---|
| 2624 | 
 | 
|---|
| 2625 |         maybeMutate_impl( node->designators, *this );
 | 
|---|
| 2626 | 
 | 
|---|
| 2627 |         MUTATE_END( Designation, node );
 | 
|---|
| 2628 | }
 | 
|---|
| 2629 | 
 | 
|---|
| 2630 | //--------------------------------------------------------------------------
 | 
|---|
| 2631 | // SingleInit
 | 
|---|
| 2632 | template< typename pass_type >
 | 
|---|
| 2633 | void PassVisitor< pass_type >::visit( SingleInit * node ) {
 | 
|---|
| 2634 |         VISIT_START( node );
 | 
|---|
| 2635 | 
 | 
|---|
| 2636 |         visitExpression( node->value );
 | 
|---|
| 2637 | 
 | 
|---|
| 2638 |         VISIT_END( node );
 | 
|---|
| 2639 | }
 | 
|---|
| 2640 | 
 | 
|---|
| 2641 | template< typename pass_type >
 | 
|---|
| 2642 | Initializer * PassVisitor< pass_type >::mutate( SingleInit * node ) {
 | 
|---|
| 2643 |         MUTATE_START( node );
 | 
|---|
| 2644 | 
 | 
|---|
| 2645 |         node->value = mutateExpression( node->value );
 | 
|---|
| 2646 | 
 | 
|---|
| 2647 |         MUTATE_END( Initializer, node );
 | 
|---|
| 2648 | }
 | 
|---|
| 2649 | 
 | 
|---|
| 2650 | //--------------------------------------------------------------------------
 | 
|---|
| 2651 | // ListInit
 | 
|---|
| 2652 | template< typename pass_type >
 | 
|---|
| 2653 | void PassVisitor< pass_type >::visit( ListInit * node ) {
 | 
|---|
| 2654 |         VISIT_START( node );
 | 
|---|
| 2655 | 
 | 
|---|
| 2656 |         maybeAccept_impl( node->designations, *this );
 | 
|---|
| 2657 |         maybeAccept_impl( node->initializers, *this );
 | 
|---|
| 2658 | 
 | 
|---|
| 2659 |         VISIT_END( node );
 | 
|---|
| 2660 | }
 | 
|---|
| 2661 | 
 | 
|---|
| 2662 | template< typename pass_type >
 | 
|---|
| 2663 | Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) {
 | 
|---|
| 2664 |         MUTATE_START( node );
 | 
|---|
| 2665 | 
 | 
|---|
| 2666 |         maybeMutate_impl( node->designations, *this );
 | 
|---|
| 2667 |         maybeMutate_impl( node->initializers, *this );
 | 
|---|
| 2668 | 
 | 
|---|
| 2669 |         MUTATE_END( Initializer, node );
 | 
|---|
| 2670 | }
 | 
|---|
| 2671 | 
 | 
|---|
| 2672 | //--------------------------------------------------------------------------
 | 
|---|
| 2673 | // ConstructorInit
 | 
|---|
| 2674 | template< typename pass_type >
 | 
|---|
| 2675 | void PassVisitor< pass_type >::visit( ConstructorInit * node ) {
 | 
|---|
| 2676 |         VISIT_START( node );
 | 
|---|
| 2677 | 
 | 
|---|
| 2678 |         maybeAccept_impl( node->ctor, *this );
 | 
|---|
| 2679 |         maybeAccept_impl( node->dtor, *this );
 | 
|---|
| 2680 |         maybeAccept_impl( node->init, *this );
 | 
|---|
| 2681 | 
 | 
|---|
| 2682 |         VISIT_END( node );
 | 
|---|
| 2683 | }
 | 
|---|
| 2684 | 
 | 
|---|
| 2685 | template< typename pass_type >
 | 
|---|
| 2686 | Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) {
 | 
|---|
| 2687 |         MUTATE_START( node );
 | 
|---|
| 2688 | 
 | 
|---|
| 2689 |         maybeMutate_impl( node->ctor, *this );
 | 
|---|
| 2690 |         maybeMutate_impl( node->dtor, *this );
 | 
|---|
| 2691 |         maybeMutate_impl( node->init, *this );
 | 
|---|
| 2692 | 
 | 
|---|
| 2693 |         MUTATE_END( Initializer, node );
 | 
|---|
| 2694 | }
 | 
|---|
| 2695 | 
 | 
|---|
| 2696 | //--------------------------------------------------------------------------
 | 
|---|
| 2697 | // Attribute
 | 
|---|
| 2698 | template< typename pass_type >
 | 
|---|
| 2699 | void PassVisitor< pass_type >::visit( Constant * node ) {
 | 
|---|
| 2700 |         VISIT_START( node );
 | 
|---|
| 2701 | 
 | 
|---|
| 2702 |         VISIT_END( node );
 | 
|---|
| 2703 | }
 | 
|---|
| 2704 | 
 | 
|---|
| 2705 | template< typename pass_type >
 | 
|---|
| 2706 | Constant * PassVisitor< pass_type >::mutate( Constant * node  )  {
 | 
|---|
| 2707 |         MUTATE_START( node );
 | 
|---|
| 2708 | 
 | 
|---|
| 2709 |         MUTATE_END( Constant, node );
 | 
|---|
| 2710 | }
 | 
|---|
| 2711 | 
 | 
|---|
| 2712 | //--------------------------------------------------------------------------
 | 
|---|
| 2713 | // Attribute
 | 
|---|
| 2714 | template< typename pass_type >
 | 
|---|
| 2715 | void PassVisitor< pass_type >::visit( Attribute * node ) {
 | 
|---|
| 2716 |         VISIT_START( node );
 | 
|---|
| 2717 | 
 | 
|---|
| 2718 |         maybeAccept_impl( node->parameters, *this );
 | 
|---|
| 2719 | 
 | 
|---|
| 2720 |         VISIT_END( node );
 | 
|---|
| 2721 | }
 | 
|---|
| 2722 | 
 | 
|---|
| 2723 | template< typename pass_type >
 | 
|---|
| 2724 | Attribute * PassVisitor< pass_type >::mutate( Attribute * node  )  {
 | 
|---|
| 2725 |         MUTATE_START( node );
 | 
|---|
| 2726 | 
 | 
|---|
| 2727 |         maybeMutate_impl( node->parameters, *this );
 | 
|---|
| 2728 | 
 | 
|---|
| 2729 |         MUTATE_END( Attribute, node );
 | 
|---|
| 2730 | }
 | 
|---|
| 2731 | 
 | 
|---|
| 2732 | //--------------------------------------------------------------------------
 | 
|---|
| 2733 | // TypeSubstitution
 | 
|---|
| 2734 | template< typename pass_type >
 | 
|---|
| 2735 | TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
 | 
|---|
| 2736 |         MUTATE_START( node );
 | 
|---|
| 2737 | 
 | 
|---|
| 2738 |         for ( auto & p : node->typeEnv ) {
 | 
|---|
| 2739 |                 indexerScopedMutate( p.second, *this );
 | 
|---|
| 2740 |         }
 | 
|---|
| 2741 |         for ( auto & p : node->varEnv ) {
 | 
|---|
| 2742 |                 indexerScopedMutate( p.second, *this );
 | 
|---|
| 2743 |         }
 | 
|---|
| 2744 | 
 | 
|---|
| 2745 |         MUTATE_END( TypeSubstitution, node );
 | 
|---|
| 2746 | }
 | 
|---|
| 2747 | 
 | 
|---|
| 2748 | #undef VISIT_START
 | 
|---|
| 2749 | #undef VISIT_END
 | 
|---|
| 2750 | 
 | 
|---|
| 2751 | #undef MUTATE_START
 | 
|---|
| 2752 | #undef MUTATE_END
 | 
|---|