Changes in src/AST/Pass.hpp [e16e27e1:be8518f]
- File:
-
- 1 edited
-
src/AST/Pass.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
re16e27e1 rbe8518f 262 262 /// Used to restore values/functions/etc. when the Pass finishes visiting this node 263 263 class WithGuards { 264 __pass::at_cleanup_t at_cleanup = [](__pass::cleanup_func_t, void*) { 265 std::cerr << "No cleanup function was set" << std::endl; 266 abort(); 267 }; 268 269 template< typename pass_t> 270 friend auto __pass::at_cleanup( pass_t & pass, int ) -> decltype( &pass.at_cleanup ); 264 __pass::at_cleanup_t at_cleanup; 265 271 266 public: 272 273 267 /// When this node is finished being visited, restore the value of a variable 274 268 template< typename T > … … 293 287 at_cleanup( [func](void *) { func(); }, nullptr ); 294 288 } 289 290 /// When this node is finished being visited, call a member of an object. 291 template<typename T> 292 void GuardMethod( T * obj, void (T::*method)() ) { 293 at_cleanup( [ method ]( void * object ) { 294 static_cast< T * >( object )->method(); 295 }, static_cast< void * >( obj ) ); 296 } 295 297 }; 296 298
Note:
See TracChangeset
for help on using the changeset viewer.