Changeset 9dcb653
- Timestamp:
- Sep 13, 2017, 2:13:59 PM (7 years ago)
- 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:
- 9f5ecf5
- Parents:
- aa72198
- Location:
- src/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
raa72198 r9dcb653 807 807 808 808 maybeAccept( node->block , *this ); 809 maybeAccept 809 maybeAccept( node->handlers , *this ); 810 810 maybeAccept( node->finallyBlock, *this ); 811 811 … … 818 818 819 819 maybeMutateRef( node->block , *this ); 820 maybeMutateRef 820 maybeMutateRef( node->handlers , *this ); 821 821 maybeMutateRef( node->finallyBlock, *this ); 822 822 … … 918 918 indexerScopedAccept( node->result , *this ); 919 919 maybeAccept ( node->function, *this ); 920 maybeAccept 920 maybeAccept ( node->args , *this ); 921 921 922 922 VISIT_END( node ); … … 930 930 indexerScopedMutate( node->result , *this ); 931 931 maybeMutateRef ( node->function, *this ); 932 maybeMutateRef 932 maybeMutateRef ( node->args , *this ); 933 933 934 934 MUTATE_END( Expression, node ); … … 1467 1467 indexerScopedAccept( node->result , *this ); 1468 1468 maybeAccept ( node->callExpr , *this ); 1469 maybeAccept 1470 maybeAccept 1471 maybeAccept 1469 maybeAccept ( node->tempDecls , *this ); 1470 maybeAccept ( node->returnDecls, *this ); 1471 maybeAccept ( node->dtors , *this ); 1472 1472 1473 1473 VISIT_END( node ); … … 1481 1481 indexerScopedMutate( node->result , *this ); 1482 1482 maybeMutateRef ( node->callExpr , *this ); 1483 maybeMutateRef 1484 maybeMutateRef 1485 maybeMutateRef 1483 maybeMutateRef ( node->tempDecls , *this ); 1484 maybeMutateRef ( node->returnDecls, *this ); 1485 maybeMutateRef ( node->dtors , *this ); 1486 1486 1487 1487 MUTATE_END( Expression, node ); … … 1566 1566 1567 1567 indexerScopedAccept( node->result, *this ); 1568 maybeAccept ( node->exprs , *this ); 1569 1570 VISIT_END( node ); 1571 } 1572 1573 template< typename pass_type > 1574 Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) { 1575 MUTATE_START( node ); 1576 1577 indexerScopedMutate( node->env , *this ); 1578 indexerScopedMutate( node->result, *this ); 1579 maybeMutateRef ( node->exprs , *this ); 1580 1581 MUTATE_END( Expression, node ); 1582 } 1583 1584 //-------------------------------------------------------------------------- 1585 // TupleExpr 1586 template< typename pass_type > 1587 void PassVisitor< pass_type >::visit( TupleExpr * node ) { 1588 VISIT_START( node ); 1589 1590 indexerScopedAccept( node->result, *this ); 1568 1591 maybeAccept ( node->exprs , *this ); 1569 1592 … … 1572 1595 1573 1596 template< typename pass_type > 1574 Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {1575 MUTATE_START( node );1576 1577 indexerScopedMutate( node->env , *this );1578 indexerScopedMutate( node->result, *this );1579 maybeMutateRef ( node->exprs , *this );1580 1581 MUTATE_END( Expression, node );1582 }1583 1584 //--------------------------------------------------------------------------1585 // TupleExpr1586 template< typename pass_type >1587 void PassVisitor< pass_type >::visit( TupleExpr * node ) {1588 VISIT_START( node );1589 1590 indexerScopedAccept( node->result, *this );1591 maybeAccept ( node->exprs , *this );1592 1593 VISIT_END( node );1594 }1595 1596 template< typename pass_type >1597 1597 Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) { 1598 1598 MUTATE_START( node ); … … 1600 1600 indexerScopedMutate( node->env , *this ); 1601 1601 indexerScopedMutate( node->result, *this ); 1602 maybeMutateRef 1602 maybeMutateRef ( node->exprs , *this ); 1603 1603 1604 1604 MUTATE_END( Expression, node ); … … 1664 1664 indexerScopedAccept( node->result , *this ); 1665 1665 maybeAccept ( node->statements , *this ); 1666 maybeAccept 1667 maybeAccept 1666 maybeAccept ( node->returnDecls, *this ); 1667 maybeAccept ( node->dtors , *this ); 1668 1668 1669 1669 VISIT_END( node ); … … 1681 1681 indexerScopedMutate( node->result , *this ); 1682 1682 maybeMutateRef ( node->statements , *this ); 1683 maybeMutateRef 1684 maybeMutateRef 1683 maybeMutateRef ( node->returnDecls, *this ); 1684 maybeMutateRef ( node->dtors , *this ); 1685 1685 1686 1686 MUTATE_END( Expression, node ); -
src/Common/PassVisitor.proto.h
raa72198 r9dcb653 61 61 template< typename TreeType, typename VisitorType > 62 62 inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) { 63 //auto guard = makeFuncGuard(64 //[&visitor]() { visitor.indexerScopeEnter(); },65 //[&visitor]() { visitor.indexerScopeLeave(); }66 //);63 auto guard = makeFuncGuard( 64 [&visitor]() { visitor.indexerScopeEnter(); }, 65 [&visitor]() { visitor.indexerScopeLeave(); } 66 ); 67 67 maybeAccept( tree, visitor ); 68 68 } … … 70 70 template< typename TreeType, typename MutatorType > 71 71 inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) { 72 //auto guard = makeFuncGuard(73 //[&mutator]() { mutator.indexerScopeEnter(); },74 //[&mutator]() { mutator.indexerScopeLeave(); }75 //);72 auto guard = makeFuncGuard( 73 [&mutator]() { mutator.indexerScopeEnter(); }, 74 [&mutator]() { mutator.indexerScopeLeave(); } 75 ); 76 76 tree = maybeMutate( tree, mutator ); 77 77 } … … 175 175 template<typename pass_type> 176 176 static inline auto indexer_impl_enterScope( pass_type & pass, int ) -> decltype( pass.indexer.enterScope(), void() ) { 177 //pass.indexer.enterScope();177 pass.indexer.enterScope(); 178 178 } 179 179 … … 183 183 template<typename pass_type> 184 184 static inline auto indexer_impl_leaveScope( pass_type & pass, int ) -> decltype( pass.indexer.leaveScope(), void() ) { 185 //pass.indexer.leaveScope();185 pass.indexer.leaveScope(); 186 186 } 187 187 … … 193 193 template<typename pass_type> \ 194 194 static inline auto indexer_impl_##func ( pass_type & pass, int, type arg ) -> decltype( pass.indexer.func( arg ), void() ) { \ 195 /*pass.indexer.func( arg );*/\195 pass.indexer.func( arg ); \ 196 196 } \ 197 197 \ … … 209 209 template<typename pass_type> 210 210 static inline auto indexer_impl_addStructFwd( pass_type & pass, int, StructDecl * decl ) -> decltype( pass.indexer.addStruct( decl ), void() ) { 211 //StructDecl * fwd = new StructDecl( decl->name );212 //cloneAll( decl->parameters, fwd->parameters );213 //pass.indexer.addStruct( fwd );211 StructDecl * fwd = new StructDecl( decl->name ); 212 cloneAll( decl->parameters, fwd->parameters ); 213 pass.indexer.addStruct( fwd ); 214 214 } 215 215 … … 219 219 template<typename pass_type> 220 220 static inline auto indexer_impl_addUnionFwd( pass_type & pass, int, UnionDecl * decl ) -> decltype( pass.indexer.addUnion( decl ), void() ) { 221 //UnionDecl * fwd = new UnionDecl( decl->name );222 //cloneAll( decl->parameters, fwd->parameters );223 //pass.indexer.addUnion( fwd );221 UnionDecl * fwd = new UnionDecl( decl->name ); 222 cloneAll( decl->parameters, fwd->parameters ); 223 pass.indexer.addUnion( fwd ); 224 224 } 225 225 … … 229 229 template<typename pass_type> 230 230 static inline auto indexer_impl_addStruct( pass_type & pass, int, const std::string & str ) -> decltype( pass.indexer.addStruct( str ), void() ) { 231 //if ( ! pass.indexer.lookupStruct( str ) ) {232 //pass.indexer.addStruct( str );233 //}231 if ( ! pass.indexer.lookupStruct( str ) ) { 232 pass.indexer.addStruct( str ); 233 } 234 234 } 235 235 … … 239 239 template<typename pass_type> 240 240 static inline auto indexer_impl_addUnion( pass_type & pass, int, const std::string & str ) -> decltype( pass.indexer.addUnion( str ), void() ) { 241 //if ( ! pass.indexer.lookupUnion( str ) ) {242 //pass.indexer.addUnion( str );243 //}241 if ( ! pass.indexer.lookupUnion( str ) ) { 242 pass.indexer.addUnion( str ); 243 } 244 244 } 245 245
Note: See TracChangeset
for help on using the changeset viewer.