Changes in src/Common/PassVisitor.impl.h [712348a:2f86ddf]
- File:
-
- 1 edited
-
src/Common/PassVisitor.impl.h (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.impl.h
r712348a r2f86ddf 20 20 21 21 #define MUTATE_END( type, node ) \ 22 auto __return = call_postmutate< type * >( node ); \ 23 assert( __return ); \ 24 return __return; 22 return call_postmutate< type * >( node ); \ 25 23 26 24 … … 69 67 SemanticErrorException errors; 70 68 71 pass_visitor_stats.depth++;72 pass_visitor_stats.max->push(pass_visitor_stats.depth);73 pass_visitor_stats.avg->push(pass_visitor_stats.depth);74 69 for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { 75 76 77 70 // splice in new declarations after previous decl 78 71 if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); } … … 90 83 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } 91 84 } 92 pass_visitor_stats.depth--;93 85 if ( ! errors.isEmpty() ) { 94 86 throw errors; … … 102 94 SemanticErrorException errors; 103 95 104 pass_visitor_stats.depth++;105 pass_visitor_stats.max->push(pass_visitor_stats.depth);106 pass_visitor_stats.avg->push(pass_visitor_stats.depth);107 96 for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) { 108 97 // splice in new declarations after previous decl … … 120 109 if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); } 121 110 } 122 pass_visitor_stats.depth--;123 111 if ( ! errors.isEmpty() ) { 124 112 throw errors; … … 138 126 if ( ! visitor.get_visit_children() ) return; 139 127 SemanticErrorException errors; 140 141 pass_visitor_stats.depth++;142 pass_visitor_stats.max->push(pass_visitor_stats.depth);143 pass_visitor_stats.avg->push(pass_visitor_stats.depth);144 128 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { 145 129 try { … … 151 135 } 152 136 } 153 pass_visitor_stats.depth--;154 137 if ( ! errors.isEmpty() ) { 155 138 throw errors; … … 168 151 template< typename Container, typename pass_type > 169 152 inline void maybeMutate_impl( Container & container, PassVisitor< pass_type > & mutator ) { 170 171 153 if ( ! mutator.get_visit_children() ) return; 172 154 SemanticErrorException errors; 173 174 pass_visitor_stats.depth++;175 pass_visitor_stats.max->push(pass_visitor_stats.depth);176 pass_visitor_stats.avg->push(pass_visitor_stats.depth);177 155 for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) { 178 156 try { … … 185 163 } // try 186 164 } // for 187 pass_visitor_stats.depth--;188 165 if ( ! errors.isEmpty() ) { 189 166 throw errors; … … 208 185 DeclList_t* afterDecls = get_afterDecls(); 209 186 210 pass_visitor_stats.depth++;211 pass_visitor_stats.max->push(pass_visitor_stats.depth);212 pass_visitor_stats.avg->push(pass_visitor_stats.depth);213 187 for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) { 214 188 … … 218 192 try { 219 193 func( *i ); 220 assert( *i );221 194 assert(( empty( beforeStmts ) && empty( afterStmts )) 222 195 || ( empty( beforeDecls ) && empty( afterDecls )) ); … … 229 202 if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); } 230 203 } 231 pass_visitor_stats.depth--;232 204 233 205 if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); } … … 257 229 258 230 // don't want statements from outer CompoundStmts to be added to this CompoundStmt 259 ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() );231 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr () ); 260 232 ValueGuardPtr< DeclList_t > oldBeforeDecls( get_beforeDecls() ); 261 233 ValueGuardPtr< DeclList_t > oldAfterDecls ( get_afterDecls () ); … … 1806 1778 VISIT_START( node ); 1807 1779 1808 indexerScopedAccept( node->result , *this ); 1809 maybeAccept_impl ( node->callExpr , *this ); 1810 maybeAccept_impl ( node->tempDecls , *this ); 1811 maybeAccept_impl ( node->returnDecls, *this ); 1812 maybeAccept_impl ( node->dtors , *this ); 1780 indexerScopedAccept( node->result , *this ); 1781 maybeAccept_impl ( node->callExpr , *this ); 1813 1782 1814 1783 VISIT_END( node ); … … 1819 1788 MUTATE_START( node ); 1820 1789 1821 indexerScopedMutate( node->env , *this ); 1822 indexerScopedMutate( node->result , *this ); 1823 maybeMutate_impl ( node->callExpr , *this ); 1824 maybeMutate_impl ( node->tempDecls , *this ); 1825 maybeMutate_impl ( node->returnDecls, *this ); 1826 maybeMutate_impl ( node->dtors , *this ); 1790 indexerScopedMutate( node->env , *this ); 1791 indexerScopedMutate( node->result , *this ); 1792 maybeMutate_impl ( node->callExpr , *this ); 1827 1793 1828 1794 MUTATE_END( Expression, node ); … … 1999 1965 2000 1966 // don't want statements from outer CompoundStmts to be added to this StmtExpr 2001 ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() );1967 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr() ); 2002 1968 ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); 2003 1969 ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); … … 2016 1982 2017 1983 // don't want statements from outer CompoundStmts to be added to this StmtExpr 2018 ValueGuardPtr< typename std::remove_pointer<decltype(get_env_ptr())>::type > oldEnv( get_env_ptr() );1984 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr() ); 2019 1985 ValueGuardPtr< std::list< Statement* > > oldBeforeStmts( get_beforeStmts() ); 2020 1986 ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () ); … … 2712 2678 2713 2679 //-------------------------------------------------------------------------- 2680 // Subrange 2681 template< typename pass_type > 2682 void PassVisitor< pass_type >::visit( Subrange * node ) { 2683 VISIT_START( node ); 2684 2685 VISIT_END( node ); 2686 } 2687 2688 template< typename pass_type > 2689 Subrange * PassVisitor< pass_type >::mutate( Subrange * node ) { 2690 MUTATE_START( node ); 2691 2692 MUTATE_END( Subrange, node ); 2693 } 2694 2695 //-------------------------------------------------------------------------- 2714 2696 // Attribute 2715 2697 template< typename pass_type >
Note:
See TracChangeset
for help on using the changeset viewer.