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