Ignore:
Timestamp:
Oct 29, 2019, 4:01:24 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
773db65, 9421f3d8
Parents:
7951100 (diff), 8364209 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r7951100 rb067d9b  
    118118static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    119119
     120template<typename pass_type, typename node_type>
     121static inline auto previsit_impl( pass_type& pass, const node_type * node, __attribute__((unused)) int unused ) -> decltype( pass.previsit( node ), void() ) {
     122        pass.previsit( node );
     123}
     124
     125template<typename pass_type, typename node_type>
     126static inline void previsit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) const node_type * node, __attribute__((unused)) long unused ) {}
     127
     128
     129template<typename pass_type, typename node_type>
     130static inline auto postvisit_impl( pass_type& pass, const node_type * node, __attribute__((unused)) int unused ) -> decltype( pass.postvisit( node ), void() ) {
     131        pass.postvisit( node );
     132}
     133
     134template<typename pass_type, typename node_type>
     135static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) const node_type * node, __attribute__((unused)) long unused ) {}
     136
    120137//---------------------------------------------------------
    121138// Mutate
     
    165182static inline type * name##_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) { return nullptr;}    \
    166183
    167 FIELD_PTR( TypeSubstitution *, env )
     184FIELD_PTR( const TypeSubstitution *, env )
    168185FIELD_PTR( std::list< Statement* >, stmtsToAddBefore )
    169186FIELD_PTR( std::list< Statement* >, stmtsToAddAfter  )
     
    174191FIELD_PTR( PassVisitor<pass_type> * const, visitor )
    175192
     193#undef FIELD_PTR
     194
    176195//---------------------------------------------------------
    177196// Indexer
     
    198217        pass.indexer.func( arg );                                                                                                \
    199218}                                                                                                                              \
    200                                                                                                                                \
    201 template<typename pass_type>                                                                                                   \
    202 static inline void indexer_impl_##func ( pass_type &, long, type ) { }                                                          \
     219template<typename pass_type>                                                                                                   \
     220static inline void indexer_impl_##func ( pass_type &, long, type ) { }
    203221
    204222#define INDEXER_FUNC2( func, type1, type2 )                                                                                             \
     
    207225        pass.indexer.func( arg1, arg2 );                                                                                                \
    208226}                                                                                                                              \
    209                                                                                                                                \
    210227template<typename pass_type>                                                                                                   \
    211228static inline void indexer_impl_##func ( pass_type &, long, type1, type2 ) { }
    212229
    213230
    214 INDEXER_FUNC1( addId     , DeclarationWithType *       );
    215 INDEXER_FUNC1( addType   , NamedTypeDecl *             );
    216 INDEXER_FUNC1( addStruct , StructDecl *                );
    217 INDEXER_FUNC1( addEnum   , EnumDecl *                  );
    218 INDEXER_FUNC1( addUnion  , UnionDecl *                 );
    219 INDEXER_FUNC1( addTrait  , TraitDecl *                 );
    220 INDEXER_FUNC2( addWith   , std::list< Expression * > &, BaseSyntaxNode * );
    221 
    222 
    223 template<typename pass_type>
    224 static inline auto indexer_impl_addStructFwd( pass_type & pass, int, StructDecl * decl ) -> decltype( pass.indexer.addStruct( decl ), void() ) {
     231INDEXER_FUNC1( addId     , const DeclarationWithType *       );
     232INDEXER_FUNC1( addType   , const NamedTypeDecl *             );
     233INDEXER_FUNC1( addStruct , const StructDecl *                );
     234INDEXER_FUNC1( addEnum   , const EnumDecl *                  );
     235INDEXER_FUNC1( addUnion  , const UnionDecl *                 );
     236INDEXER_FUNC1( addTrait  , const TraitDecl *                 );
     237INDEXER_FUNC2( addWith   , const std::list< Expression * > &, const Declaration * );
     238
     239#undef INDEXER_FUNC1
     240#undef INDEXER_FUNC2
     241
     242template<typename pass_type>
     243static inline auto indexer_impl_addStructFwd( pass_type & pass, int, const StructDecl * decl ) -> decltype( pass.indexer.addStruct( decl ), void() ) {
    225244        StructDecl * fwd = new StructDecl( decl->name );
    226245        cloneAll( decl->parameters, fwd->parameters );
     
    229248
    230249template<typename pass_type>
    231 static inline auto indexer_impl_addStructFwd( pass_type &, long, StructDecl * ) {}
    232 
    233 template<typename pass_type>
    234 static inline auto indexer_impl_addUnionFwd( pass_type & pass, int, UnionDecl * decl ) -> decltype( pass.indexer.addUnion( decl ), void() ) {
     250static inline auto indexer_impl_addStructFwd( pass_type &, long, const StructDecl * ) {}
     251
     252template<typename pass_type>
     253static inline auto indexer_impl_addUnionFwd( pass_type & pass, int, const UnionDecl * decl ) -> decltype( pass.indexer.addUnion( decl ), void() ) {
    235254        UnionDecl * fwd = new UnionDecl( decl->name );
    236255        cloneAll( decl->parameters, fwd->parameters );
     
    239258
    240259template<typename pass_type>
    241 static inline auto indexer_impl_addUnionFwd( pass_type &, long, UnionDecl * ) {}
     260static inline auto indexer_impl_addUnionFwd( pass_type &, long, const UnionDecl * ) {}
    242261
    243262template<typename pass_type>
Note: See TracChangeset for help on using the changeset viewer.