Changes in src/Common/PassVisitor.h [d7dc824:4eb31f2b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.h
rd7dc824 r4eb31f2b 54 54 virtual void visit( BranchStmt *branchStmt ) override final; 55 55 virtual void visit( ReturnStmt *returnStmt ) override final; 56 virtual void visit( ThrowStmt *throwStmt ) override final; 56 57 virtual void visit( TryStmt *tryStmt ) override final; 57 58 virtual void visit( CatchStmt *catchStmt ) override final; … … 139 140 virtual Statement* mutate( BranchStmt *branchStmt ) override final; 140 141 virtual Statement* mutate( ReturnStmt *returnStmt ) override final; 142 virtual Statement* mutate( ThrowStmt *throwStmt ) override final; 141 143 virtual Statement* mutate( TryStmt *returnStmt ) override final; 142 144 virtual Statement* mutate( CatchStmt *catchStmt ) override final; … … 230 232 std::list< Statement* > * get_afterStmts () { return stmtsToAddAfter_impl ( pass, 0); } 231 233 bool visit_children() { bool* skip = skip_children_impl(pass, 0); return ! (skip && *skip); } 232 }; 234 void reset_visit() { bool* skip = skip_children_impl(pass, 0); if(skip) *skip = false; } 235 236 guard_value_impl init_guard() { 237 guard_value_impl guard; 238 auto at_cleanup = at_cleanup_impl(pass, 0); 239 if( at_cleanup ) { 240 *at_cleanup = [&guard]( cleanup_func_t && func, void* val ) { 241 guard.push( std::move( func ), val ); 242 }; 243 } 244 return guard; 245 } 246 }; 247 248 template<typename pass_type, typename T> 249 void GuardValue( pass_type * pass, T& val ) { 250 pass->at_cleanup( [ val ]( void * newVal ) { 251 * static_cast< T * >( newVal ) = val; 252 }, static_cast< void * >( & val ) ); 253 } 254 255 class WithTypeSubstitution { 256 protected: 257 WithTypeSubstitution() = default; 258 ~WithTypeSubstitution() = default; 259 260 public: 261 TypeSubstitution * env; 262 }; 263 264 class WithStmtsToAdd { 265 protected: 266 WithStmtsToAdd() = default; 267 ~WithStmtsToAdd() = default; 268 269 public: 270 std::list< Statement* > stmtsToAddBefore; 271 std::list< Statement* > stmtsToAddAfter; 272 }; 273 274 class WithShortCircuiting { 275 protected: 276 WithShortCircuiting() = default; 277 ~WithShortCircuiting() = default; 278 279 public: 280 bool skip_children; 281 }; 282 283 class WithScopes { 284 protected: 285 WithScopes() = default; 286 ~WithScopes() = default; 287 288 public: 289 at_cleanup_t at_cleanup; 290 291 template< typename T > 292 void GuardValue( T& val ) { 293 at_cleanup( [ val ]( void * newVal ) { 294 * static_cast< T * >( newVal ) = val; 295 }, static_cast< void * >( & val ) ); 296 } 297 }; 298 233 299 234 300 #include "PassVisitor.impl.h"
Note:
See TracChangeset
for help on using the changeset viewer.