Changes in src/AST/Pass.hpp [e67991f:e0e9a0b]
- File:
-
- 1 edited
-
src/AST/Pass.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
re67991f re0e9a0b 35 35 #include "AST/SymbolTable.hpp" 36 36 37 #include "AST/ForallSubstitutionTable.hpp" 38 37 39 // Private prelude header, needed for some of the magic tricks this class pulls off 38 40 #include "AST/Pass.proto.hpp" … … 46 48 // 47 49 // Several additional features are available through inheritance 48 // | WithTypeSubstitution - provides polymorphic const TypeSubstitution * env for the 49 // current expression 50 // | WithStmtsToAdd - provides the ability to insert statements before or after the current 51 // statement by adding new statements into stmtsToAddBefore or 52 // stmtsToAddAfter respectively. 53 // | WithDeclsToAdd - provides the ability to insert declarations before or after the current 54 // declarations by adding new DeclStmt into declsToAddBefore or 55 // declsToAddAfter respectively. 56 // | WithShortCircuiting - provides the ability to skip visiting child nodes; set visit_children 57 // to false in pre{visit,visit} to skip visiting children 58 // | WithGuards - provides the ability to save/restore data like a LIFO stack; to save, 59 // call GuardValue with the variable to save, the variable will 60 // automatically be restored to its previous value after the corresponding 61 // postvisit/postmutate teminates. 62 // | WithVisitorRef - provides an pointer to the templated visitor wrapper 63 // | WithSymbolTable - provides symbol table functionality 50 // | WithTypeSubstitution - provides polymorphic const TypeSubstitution * env for the 51 // current expression 52 // | WithStmtsToAdd - provides the ability to insert statements before or after the current 53 // statement by adding new statements into stmtsToAddBefore or 54 // stmtsToAddAfter respectively. 55 // | WithDeclsToAdd - provides the ability to insert declarations before or after the 56 // current declarations by adding new DeclStmt into declsToAddBefore or 57 // declsToAddAfter respectively. 58 // | WithShortCircuiting - provides the ability to skip visiting child nodes; set visit_children 59 // to false in pre{visit,visit} to skip visiting children 60 // | WithGuards - provides the ability to save/restore data like a LIFO stack; to save, 61 // call GuardValue with the variable to save, the variable will 62 // automatically be restored to its previous value after the 63 // corresponding postvisit/postmutate teminates. 64 // | WithVisitorRef - provides an pointer to the templated visitor wrapper 65 // | WithSymbolTable - provides symbol table functionality 66 // | WithForallSubstitutor - maintains links between TypeInstType and TypeDecl under mutation 64 67 //------------------------------------------------------------------------------------------------- 65 68 template< typename pass_t > … … 112 115 const ast::Stmt * visit( const ast::FinallyStmt * ) override final; 113 116 const ast::Stmt * visit( const ast::WaitForStmt * ) override final; 114 const ast:: Decl* visit( const ast::WithStmt * ) override final;117 const ast::Stmt * visit( const ast::WithStmt * ) override final; 115 118 const ast::NullStmt * visit( const ast::NullStmt * ) override final; 116 119 const ast::Stmt * visit( const ast::DeclStmt * ) override final; … … 201 204 container_t< ptr<node_t> > call_accept( const container_t< ptr<node_t> > & container ); 202 205 206 /// Mutate forall-list, accounting for presence of type substitution map 207 template<typename node_t> 208 void mutate_forall( const node_t *& ); 209 203 210 public: 204 211 /// Logic to call the accept and mutate the parent if needed, delegates call to accept … … 209 216 /// Internal RAII guard for symbol table features 210 217 struct guard_symtab { 211 guard_symtab( Pass<pass_t> & pass ): pass( pass ) { __pass::symtab::enter(pass , 0); }212 ~guard_symtab() { __pass::symtab::leave(pass , 0); }218 guard_symtab( Pass<pass_t> & pass ): pass( pass ) { __pass::symtab::enter(pass.pass, 0); } 219 ~guard_symtab() { __pass::symtab::leave(pass.pass, 0); } 213 220 Pass<pass_t> & pass; 214 221 }; … … 216 223 /// Internal RAII guard for scope features 217 224 struct guard_scope { 218 guard_scope( Pass<pass_t> & pass ): pass( pass ) { __pass::scope::enter(pass , 0); }219 ~guard_scope() { __pass::scope::leave(pass , 0); }225 guard_scope( Pass<pass_t> & pass ): pass( pass ) { __pass::scope::enter(pass.pass, 0); } 226 ~guard_scope() { __pass::scope::leave(pass.pass, 0); } 220 227 Pass<pass_t> & pass; 228 }; 229 230 /// Internal RAII guard for forall substitutions 231 struct guard_forall_subs { 232 guard_forall_subs( Pass<pass_t> & pass, const ParameterizedType * type ) 233 : pass( pass ), type( type ) { __pass::forall::enter(pass.pass, 0, type ); } 234 ~guard_forall_subs() { __pass::forall::leave(pass.pass, 0, type ); } 235 Pass<pass_t> & pass; 236 const ParameterizedType * type; 221 237 }; 222 238 … … 313 329 SymbolTable symtab; 314 330 }; 331 332 /// Use when the templated visitor needs to keep TypeInstType instances properly linked to TypeDecl 333 struct WithForallSubstitutor { 334 ForallSubstitutionTable subs; 335 }; 336 315 337 } 316 338
Note:
See TracChangeset
for help on using the changeset viewer.