Changes in src/AST/Pass.hpp [e0e9a0b:e67991f]
- File:
-
- 1 edited
-
src/AST/Pass.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
re0e9a0b re67991f 35 35 #include "AST/SymbolTable.hpp" 36 36 37 #include "AST/ForallSubstitutionTable.hpp"38 39 37 // Private prelude header, needed for some of the magic tricks this class pulls off 40 38 #include "AST/Pass.proto.hpp" … … 48 46 // 49 47 // Several additional features are available through inheritance 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 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 67 64 //------------------------------------------------------------------------------------------------- 68 65 template< typename pass_t > … … 115 112 const ast::Stmt * visit( const ast::FinallyStmt * ) override final; 116 113 const ast::Stmt * visit( const ast::WaitForStmt * ) override final; 117 const ast:: Stmt* visit( const ast::WithStmt * ) override final;114 const ast::Decl * visit( const ast::WithStmt * ) override final; 118 115 const ast::NullStmt * visit( const ast::NullStmt * ) override final; 119 116 const ast::Stmt * visit( const ast::DeclStmt * ) override final; … … 204 201 container_t< ptr<node_t> > call_accept( const container_t< ptr<node_t> > & container ); 205 202 206 /// Mutate forall-list, accounting for presence of type substitution map207 template<typename node_t>208 void mutate_forall( const node_t *& );209 210 203 public: 211 204 /// Logic to call the accept and mutate the parent if needed, delegates call to accept … … 216 209 /// Internal RAII guard for symbol table features 217 210 struct guard_symtab { 218 guard_symtab( Pass<pass_t> & pass ): pass( pass ) { __pass::symtab::enter(pass .pass, 0); }219 ~guard_symtab() { __pass::symtab::leave(pass .pass, 0); }211 guard_symtab( Pass<pass_t> & pass ): pass( pass ) { __pass::symtab::enter(pass, 0); } 212 ~guard_symtab() { __pass::symtab::leave(pass, 0); } 220 213 Pass<pass_t> & pass; 221 214 }; … … 223 216 /// Internal RAII guard for scope features 224 217 struct guard_scope { 225 guard_scope( Pass<pass_t> & pass ): pass( pass ) { __pass::scope::enter(pass .pass, 0); }226 ~guard_scope() { __pass::scope::leave(pass .pass, 0); }218 guard_scope( Pass<pass_t> & pass ): pass( pass ) { __pass::scope::enter(pass, 0); } 219 ~guard_scope() { __pass::scope::leave(pass, 0); } 227 220 Pass<pass_t> & pass; 228 };229 230 /// Internal RAII guard for forall substitutions231 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;237 221 }; 238 222 … … 329 313 SymbolTable symtab; 330 314 }; 331 332 /// Use when the templated visitor needs to keep TypeInstType instances properly linked to TypeDecl333 struct WithForallSubstitutor {334 ForallSubstitutionTable subs;335 };336 337 315 } 338 316
Note:
See TracChangeset
for help on using the changeset viewer.