Ignore:
Timestamp:
Jun 15, 2017, 12:18:23 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
637568b, 7b6ca2e
Parents:
f146716
Message:

Pass visitor:

  • added support for throw statment
  • now resets skip children flag after reading it
  • prototype for value guard alternative (Still un-tested)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.impl.h

    rf146716 r6e09f211  
    11#pragma once
    22
    3 #define VISIT_START( node )  \
    4         call_previsit( node ); \
    5         if( visit_children() ) { \
    6 
    7 #define VISIT_END( node )            \
    8         }                              \
    9         return call_postvisit( node ); \
    10 
    11 #define MUTATE_START( node )  \
    12         call_premutate( node ); \
    13         if( visit_children() ) { \
     3#define VISIT_START( node )                     \
     4        __attribute__((unused))                   \
     5        const auto & guard = init_guard();        \
     6        call_previsit( node );                    \
     7        if( visit_children() ) {                  \
     8                reset_visit();                      \
     9
     10#define VISIT_END( node )                       \
     11        }                                         \
     12        call_postvisit( node );                   \
     13
     14#define MUTATE_START( node )                    \
     15        __attribute__((unused))                   \
     16        const auto & guard = init_guard();        \
     17        call_premutate( node );                   \
     18        if( visit_children() ) {                  \
     19                reset_visit();                      \
    1420
    1521#define MUTATE_END( type, node )                \
     
    1824
    1925
    20 #define VISIT_BODY( node )    \
    21         VISIT_START( node );  \
    22         Visitor::visit( node ); \
    23         VISIT_END( node ); \
     26#define VISIT_BODY( node )        \
     27        VISIT_START( node );        \
     28        Visitor::visit( node );     \
     29        VISIT_END( node );          \
    2430
    2531
     
    389395
    390396//--------------------------------------------------------------------------
     397// ThrowStmt
     398
     399template< typename pass_type >
     400void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
     401        VISIT_BODY( node );
     402}
     403
     404template< typename pass_type >
     405Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
     406        MUTATE_BODY( Statement, node );
     407}
     408
     409//--------------------------------------------------------------------------
    391410// TryStmt
    392411template< typename pass_type >
Note: See TracChangeset for help on using the changeset viewer.