Ignore:
Timestamp:
Jun 1, 2017, 4:26: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:
676cc8c
Parents:
3fb9a83
Message:

Refactored PassVisitor? to properly support env and statements to add

File:
1 edited

Legend:

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

    r3fb9a83 r134322e  
    7070static inline void end_scope_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) {}
    7171
    72 // Env
    73 template<typename pass_type>
    74 static inline auto set_env_impl( pass_type& pass, TypeSubstitution * env, __attribute__((unused)) int unused ) ->decltype( pass.env, void() ) {
    75         pass.env = env;
    76 }
     72// Fields
     73#define FIELD_PTR( type, name )                                                                                                                  \
     74template<typename pass_type>                                                                                                                     \
     75static inline auto name##_impl( pass_type& pass, __attribute__((unused)) int unused ) ->decltype( &pass.name ) { return &pass.name; }          \
     76                                                                                                                                                 \
     77template<typename pass_type>                                                                                                                     \
     78static inline type * name##_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) { return nullptr;}    \
    7779
    78 template<typename pass_type>
    79 static inline void set_env_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) TypeSubstitution * env, __attribute__((unused)) long unused ) {}
     80FIELD_PTR( TypeSubstitution *, env )
     81FIELD_PTR( std::list< Statement* >, stmtsToAddBefore )
     82FIELD_PTR( std::list< Statement* >, stmtsToAddAfter  )
Note: See TracChangeset for help on using the changeset viewer.