Changeset 3fb9a83 for src/Common


Ignore:
Timestamp:
Jun 1, 2017, 3:18:58 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:
134322e
Parents:
5013c62
Message:

Fixed implementation of env, some optim needed

Location:
src/Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Common/PassVisitor.h

    r5013c62 r3fb9a83  
    218218        void call_endScope  () { end_scope_impl  ( pass, 0 ); }
    219219
     220        void set_env( TypeSubstitution * env ) { set_env_impl( pass, env, 0); }
     221
    220222        void mutateStatementList( std::list< Statement* > &statements );
    221223        Statement * mutateStatement( Statement * stmt );
  • src/Common/PassVisitor.impl.h

    r5013c62 r3fb9a83  
    5151        ValueGuard< std::list< Statement* > > oldStmtsToAddAfter( stmtsToAddAfter );
    5252        ValueGuard< TypeSubstitution * > oldEnv( env );
     53        set_env( env );
     54
    5355        stmtsToAdd.clear();
    5456        stmtsToAddAfter.clear();
     
    7375        if ( expr->get_env() ) {
    7476                env = expr->get_env();
     77                set_env( env );
    7578        }
    7679        // xxx - should env be cloned (or moved) onto the result of the mutate?
     
    488491        ValueGuard< std::list< Statement* > > oldStmtsToAddAfter( stmtsToAddAfter );
    489492        ValueGuard< TypeSubstitution * > oldEnv( env );
     493        set_env( env );
    490494
    491495        // xxx - not sure if this is needed, along with appropriate reset, but I don't think so...
  • src/Common/PassVisitor.proto.h

    r5013c62 r3fb9a83  
    6969template<typename pass_type>
    7070static inline void end_scope_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) {}
     71
     72// Env
     73template<typename pass_type>
     74static inline auto set_env_impl( pass_type& pass, TypeSubstitution * env, __attribute__((unused)) int unused ) ->decltype( pass.env, void() ) {
     75        pass.env = env;
     76}
     77
     78template<typename pass_type>
     79static inline void set_env_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) TypeSubstitution * env, __attribute__((unused)) long unused ) {}
Note: See TracChangeset for help on using the changeset viewer.