Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r4eb31f2b rd7dc824  
    5454        virtual void visit( BranchStmt *branchStmt ) override final;
    5555        virtual void visit( ReturnStmt *returnStmt ) override final;
    56         virtual void visit( ThrowStmt *throwStmt ) override final;
    5756        virtual void visit( TryStmt *tryStmt ) override final;
    5857        virtual void visit( CatchStmt *catchStmt ) override final;
     
    140139        virtual Statement* mutate( BranchStmt *branchStmt ) override final;
    141140        virtual Statement* mutate( ReturnStmt *returnStmt ) override final;
    142         virtual Statement* mutate( ThrowStmt *throwStmt ) override final;
    143141        virtual Statement* mutate( TryStmt *returnStmt ) override final;
    144142        virtual Statement* mutate( CatchStmt *catchStmt ) override final;
     
    232230        std::list< Statement* > *       get_afterStmts () { return stmtsToAddAfter_impl ( pass, 0); }
    233231        bool visit_children() { bool* skip = skip_children_impl(pass, 0); return ! (skip && *skip); }
    234         void reset_visit() { bool* skip = skip_children_impl(pass, 0); if(skip) *skip = false; }
    235 
    236         guard_value_impl init_guard() {
    237                 guard_value_impl guard;
    238                 auto at_cleanup = at_cleanup_impl(pass, 0);
    239                 if( at_cleanup ) {
    240                         *at_cleanup = [&guard]( cleanup_func_t && func, void* val ) {
    241                                 guard.push( std::move( func ), val );
    242                         };
    243                 }
    244                 return guard;
    245         }
    246232};
    247233
    248 template<typename pass_type, typename T>
    249 void GuardValue( pass_type * pass, T& val ) {
    250         pass->at_cleanup( [ val ]( void * newVal ) {
    251                 * static_cast< T * >( newVal ) = val;
    252         }, static_cast< void * >( & val ) );
    253 }
    254 
    255 class WithTypeSubstitution {
    256 protected:
    257         WithTypeSubstitution() = default;
    258         ~WithTypeSubstitution() = default;
    259 
    260 public:
    261         TypeSubstitution * env;
    262 };
    263 
    264 class WithStmtsToAdd {
    265 protected:
    266         WithStmtsToAdd() = default;
    267         ~WithStmtsToAdd() = default;
    268 
    269 public:
    270         std::list< Statement* > stmtsToAddBefore;
    271         std::list< Statement* > stmtsToAddAfter;
    272 };
    273 
    274 class WithShortCircuiting {
    275 protected:
    276         WithShortCircuiting() = default;
    277         ~WithShortCircuiting() = default;
    278 
    279 public:
    280         bool skip_children;
    281 };
    282 
    283 class WithScopes {
    284 protected:
    285         WithScopes() = default;
    286         ~WithScopes() = default;
    287 
    288 public:
    289         at_cleanup_t at_cleanup;
    290 
    291         template< typename T >
    292         void GuardValue( T& val ) {
    293                 at_cleanup( [ val ]( void * newVal ) {
    294                         * static_cast< T * >( newVal ) = val;
    295                 }, static_cast< void * >( & val ) );
    296         }
    297 };
    298 
    299 
    300234#include "PassVisitor.impl.h"
Note: See TracChangeset for help on using the changeset viewer.