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