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