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