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