Changeset 4eb31f2b


Ignore:
Timestamp:
Jun 16, 2017, 3:22:50 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:
f522618
Parents:
7bd712d
Message:

Added base clases for passes to improve ease of use of the pass visitor

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r7bd712d r4eb31f2b  
    258258        ~WithTypeSubstitution() = default;
    259259
     260public:
    260261        TypeSubstitution * env;
    261 
    262         template<typename pass_type>
    263         friend class PassVisitor< pass_type>;
    264262};
    265263
     
    269267        ~WithStmtsToAdd() = default;
    270268
     269public:
    271270        std::list< Statement* > stmtsToAddBefore;
    272271        std::list< Statement* > stmtsToAddAfter;
    273 
    274         template<typename pass_type>
    275         friend class PassVisitor< pass_type>;
    276272};
    277273
     
    281277        ~WithShortCircuiting() = default;
    282278
     279public:
    283280        bool skip_children;
    284 
    285         template<typename pass_type>
    286         friend class PassVisitor< pass_type>;
    287281};
    288282
     
    292286        ~WithScopes() = default;
    293287
     288public:
    294289        at_cleanup_t at_cleanup;
    295290
     291        template< typename T >
    296292        void GuardValue( T& val ) {
    297293                at_cleanup( [ val ]( void * newVal ) {
     
    299295                }, static_cast< void * >( & val ) );
    300296        }
    301 
    302         template<typename pass_type>
    303         friend class PassVisitor< pass_type>;
    304297};
    305298
  • src/InitTweak/GenInit.cc

    r7bd712d r4eb31f2b  
    4444        }
    4545
    46         class ReturnFixer {
     46        class ReturnFixer : public WithStmtsToAdd, public WithScopes {
    4747          public:
    4848                /// consistently allocates a temporary variable for the return value
     
    5353                void premutate( FunctionDecl *functionDecl );
    5454                void premutate( ReturnStmt * returnStmt );
    55 
    56                 at_cleanup_t at_cleanup;
    57                 std::list< Statement * > stmtsToAddBefore;
    5855
    5956          protected:
     
    160157
    161158        void ReturnFixer::premutate( FunctionDecl *functionDecl ) {
    162                 GuardValue( this, ftype );
    163                 GuardValue( this, funcName );
     159                GuardValue( ftype );
     160                GuardValue( funcName );
    164161
    165162                ftype = functionDecl->get_functionType();
Note: See TracChangeset for help on using the changeset viewer.