Changeset a8a2b0a for src/Common
- Timestamp:
- Mar 1, 2018, 4:58:03 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 2ec65ad
- Parents:
- babeeda
- git-author:
- Rob Schluntz <rschlunt@…> (03/01/18 15:17:24)
- git-committer:
- Rob Schluntz <rschlunt@…> (03/01/18 16:58:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
rbabeeda ra8a2b0a 2277 2277 } 2278 2278 2279 2279 //-------------------------------------------------------------------------- 2280 // TupleType 2280 2281 template< typename pass_type > 2281 2282 void PassVisitor< pass_type >::visit( TupleType * node ) { 2282 VISIT_BODY( node ); 2283 } 2284 2283 VISIT_START( node ); 2284 2285 maybeAccept_impl( node->forall, *this ); 2286 maybeAccept_impl( node->types, *this ); 2287 maybeAccept_impl( node->members, *this ); 2288 2289 VISIT_END( node ); 2290 } 2291 2292 template< typename pass_type > 2293 Type * PassVisitor< pass_type >::mutate( TupleType * node ) { 2294 MUTATE_START( node ); 2295 2296 maybeMutate_impl( node->forall, *this ); 2297 maybeMutate_impl( node->types, *this ); 2298 maybeMutate_impl( node->members, *this ); 2299 2300 MUTATE_END( Type, node ); 2301 } 2302 2303 //-------------------------------------------------------------------------- 2304 // TypeofType 2285 2305 template< typename pass_type > 2286 2306 void PassVisitor< pass_type >::visit( TypeofType * node ) { 2287 VISIT_BODY( node ); 2288 } 2289 2307 VISIT_START( node ); 2308 2309 assert( node->expr ); 2310 maybeAccept_impl( node->expr, *this ); 2311 2312 VISIT_END( node ); 2313 } 2314 2315 template< typename pass_type > 2316 Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { 2317 MUTATE_START( node ); 2318 2319 assert( node->expr ); 2320 maybeMutate_impl( node->expr, *this ); 2321 2322 MUTATE_END( Type, node ); 2323 } 2324 2325 //-------------------------------------------------------------------------- 2326 // AttrType 2290 2327 template< typename pass_type > 2291 2328 void PassVisitor< pass_type >::visit( AttrType * node ) { 2292 VISIT_BODY( node ); 2293 } 2294 2329 VISIT_START( node ); 2330 2331 if ( node->isType ) { 2332 assert( node->type ); 2333 maybeAccept_impl( node->type, *this ); 2334 } else { 2335 assert( node->expr ); 2336 maybeAccept_impl( node->expr, *this ); 2337 } // if 2338 2339 VISIT_END( node ); 2340 } 2341 2342 template< typename pass_type > 2343 Type * PassVisitor< pass_type >::mutate( AttrType * node ) { 2344 MUTATE_START( node ); 2345 2346 if ( node->isType ) { 2347 assert( node->type ); 2348 maybeMutate_impl( node->type, *this ); 2349 } else { 2350 assert( node->expr ); 2351 maybeMutate_impl( node->expr, *this ); 2352 } // if 2353 2354 MUTATE_END( Type, node ); 2355 } 2356 2357 //-------------------------------------------------------------------------- 2358 // VarArgsType 2295 2359 template< typename pass_type > 2296 2360 void PassVisitor< pass_type >::visit( VarArgsType * node ) { 2297 VISIT_BODY( node ); 2298 } 2299 2361 VISIT_START( node ); 2362 2363 maybeAccept_impl( node->forall, *this ); 2364 2365 VISIT_END( node ); 2366 } 2367 2368 template< typename pass_type > 2369 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { 2370 MUTATE_START( node ); 2371 2372 maybeMutate_impl( node->forall, *this ); 2373 2374 MUTATE_END( Type, node ); 2375 } 2376 2377 //-------------------------------------------------------------------------- 2378 // ZeroType 2300 2379 template< typename pass_type > 2301 2380 void PassVisitor< pass_type >::visit( ZeroType * node ) { 2302 VISIT_BODY( node ); 2303 } 2304 2381 VISIT_START( node ); 2382 2383 maybeAccept_impl( node->forall, *this ); 2384 2385 VISIT_END( node ); 2386 } 2387 2388 template< typename pass_type > 2389 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { 2390 MUTATE_START( node ); 2391 2392 maybeMutate_impl( node->forall, *this ); 2393 2394 MUTATE_END( Type, node ); 2395 } 2396 2397 //-------------------------------------------------------------------------- 2398 // OneType 2305 2399 template< typename pass_type > 2306 2400 void PassVisitor< pass_type >::visit( OneType * node ) { 2307 VISIT_BODY( node ); 2308 } 2309 2401 VISIT_START( node ); 2402 2403 maybeAccept_impl( node->forall, *this ); 2404 2405 VISIT_END( node ); 2406 } 2407 2408 template< typename pass_type > 2409 Type * PassVisitor< pass_type >::mutate( OneType * node ) { 2410 MUTATE_START( node ); 2411 2412 maybeMutate_impl( node->forall, *this ); 2413 2414 MUTATE_END( Type, node ); 2415 } 2416 2417 //-------------------------------------------------------------------------- 2418 // Designation 2310 2419 template< typename pass_type > 2311 2420 void PassVisitor< pass_type >::visit( Designation * node ) { 2312 2421 VISIT_START( node ); 2313 2422 2314 maybeAccept_impl( node-> get_designators(), *this );2423 maybeAccept_impl( node->designators, *this ); 2315 2424 2316 2425 VISIT_END( node ); … … 2321 2430 MUTATE_START( node ); 2322 2431 2323 maybeMutate_impl( node-> get_designators(), *this );2432 maybeMutate_impl( node->designators, *this ); 2324 2433 2325 2434 MUTATE_END( Designation, node ); … … 2332 2441 VISIT_START( node ); 2333 2442 2334 visitExpression( node-> get_value());2443 visitExpression( node->value ); 2335 2444 2336 2445 VISIT_END( node ); … … 2341 2450 MUTATE_START( node ); 2342 2451 2343 node-> set_value( mutateExpression( node->get_value() ));2452 node->value = mutateExpression( node->value ); 2344 2453 2345 2454 MUTATE_END( Initializer, node ); 2346 2455 } 2347 2456 2457 //-------------------------------------------------------------------------- 2458 // ListInit 2348 2459 template< typename pass_type > 2349 2460 void PassVisitor< pass_type >::visit( ListInit * node ) { 2350 VISIT_BODY( node ); 2351 } 2352 2461 VISIT_START( node ); 2462 2463 maybeAccept_impl( node->designations, *this ); 2464 maybeAccept_impl( node->initializers, *this ); 2465 2466 VISIT_END( node ); 2467 } 2468 2469 template< typename pass_type > 2470 Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { 2471 MUTATE_START( node ); 2472 2473 maybeMutate_impl( node->designations, *this ); 2474 maybeMutate_impl( node->initializers, *this ); 2475 2476 MUTATE_END( Initializer, node ); 2477 } 2478 2479 //-------------------------------------------------------------------------- 2480 // ConstructorInit 2353 2481 template< typename pass_type > 2354 2482 void PassVisitor< pass_type >::visit( ConstructorInit * node ) { 2355 VISIT_BODY( node ); 2356 } 2357 2483 VISIT_START( node ); 2484 2485 maybeAccept_impl( node->ctor, *this ); 2486 maybeAccept_impl( node->dtor, *this ); 2487 maybeAccept_impl( node->init, *this ); 2488 2489 VISIT_END( node ); 2490 } 2491 2492 template< typename pass_type > 2493 Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { 2494 MUTATE_START( node ); 2495 2496 maybeMutate_impl( node->ctor, *this ); 2497 maybeMutate_impl( node->dtor, *this ); 2498 maybeMutate_impl( node->init, *this ); 2499 2500 MUTATE_END( Initializer, node ); 2501 } 2502 2503 //-------------------------------------------------------------------------- 2504 // Subrange 2358 2505 template< typename pass_type > 2359 2506 void PassVisitor< pass_type >::visit( Subrange * node ) { 2360 VISIT_BODY( node ); 2361 } 2362 2507 VISIT_START( node ); 2508 2509 VISIT_END( node ); 2510 } 2511 2512 template< typename pass_type > 2513 Subrange * PassVisitor< pass_type >::mutate( Subrange * node ) { 2514 MUTATE_START( node ); 2515 2516 MUTATE_END( Subrange, node ); 2517 } 2518 2519 //-------------------------------------------------------------------------- 2520 // Attribute 2363 2521 template< typename pass_type > 2364 2522 void PassVisitor< pass_type >::visit( Constant * node ) { 2365 VISIT_BODY( node ); 2366 } 2367 2523 VISIT_START( node ); 2524 2525 VISIT_END( node ); 2526 } 2527 2528 template< typename pass_type > 2529 Constant * PassVisitor< pass_type >::mutate( Constant * node ) { 2530 MUTATE_START( node ); 2531 2532 MUTATE_END( Constant, node ); 2533 } 2534 2535 //-------------------------------------------------------------------------- 2536 // Attribute 2368 2537 template< typename pass_type > 2369 2538 void PassVisitor< pass_type >::visit( Attribute * node ) { 2370 VISIT_BODY( node ); 2371 } 2372 2373 //--------------------------------------------------------------------------------------------------------------- 2374 2375 template< typename pass_type > 2376 Type * PassVisitor< pass_type >::mutate( TupleType * node ) { 2377 MUTATE_BODY( Type, node ); 2378 } 2379 2380 template< typename pass_type > 2381 Type * PassVisitor< pass_type >::mutate( TypeofType * node ) { 2382 MUTATE_BODY( Type, node ); 2383 } 2384 2385 template< typename pass_type > 2386 Type * PassVisitor< pass_type >::mutate( AttrType * node ) { 2387 MUTATE_BODY( Type, node ); 2388 } 2389 2390 template< typename pass_type > 2391 Type * PassVisitor< pass_type >::mutate( VarArgsType * node ) { 2392 MUTATE_BODY( Type, node ); 2393 } 2394 2395 template< typename pass_type > 2396 Type * PassVisitor< pass_type >::mutate( ZeroType * node ) { 2397 MUTATE_BODY( Type, node ); 2398 } 2399 2400 template< typename pass_type > 2401 Type * PassVisitor< pass_type >::mutate( OneType * node ) { 2402 MUTATE_BODY( Type, node ); 2403 } 2404 2405 template< typename pass_type > 2406 Initializer * PassVisitor< pass_type >::mutate( ListInit * node ) { 2407 MUTATE_BODY( Initializer, node ); 2408 } 2409 2410 template< typename pass_type > 2411 Initializer * PassVisitor< pass_type >::mutate( ConstructorInit * node ) { 2412 MUTATE_BODY( Initializer, node ); 2413 } 2414 2415 template< typename pass_type > 2416 Subrange * PassVisitor< pass_type >::mutate( Subrange * node ) { 2417 MUTATE_BODY( Subrange, node ); 2418 } 2419 2420 template< typename pass_type > 2421 Constant * PassVisitor< pass_type >::mutate( Constant * node ) { 2422 MUTATE_BODY( Constant, node ); 2539 VISIT_START( node ); 2540 2541 maybeAccept_impl( node->parameters, *this ); 2542 2543 VISIT_END( node ); 2423 2544 } 2424 2545 2425 2546 template< typename pass_type > 2426 2547 Attribute * PassVisitor< pass_type >::mutate( Attribute * node ) { 2427 MUTATE_BODY( Attribute, node ); 2428 } 2429 2548 MUTATE_START( node ); 2549 2550 maybeMutate_impl( node->parameters, *this ); 2551 2552 MUTATE_END( Attribute, node ); 2553 } 2554 2555 //-------------------------------------------------------------------------- 2556 // TypeSubstitution 2430 2557 template< typename pass_type > 2431 2558 TypeSubstitution * PassVisitor< pass_type >::mutate( TypeSubstitution * node ) {
Note: See TracChangeset
for help on using the changeset viewer.