Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.hpp

    re0e9a0b re67991f  
    3535#include "AST/SymbolTable.hpp"
    3636
    37 #include "AST/ForallSubstitutionTable.hpp"
    38 
    3937// Private prelude header, needed for some of the magic tricks this class pulls off
    4038#include "AST/Pass.proto.hpp"
     
    4846//
    4947// 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
    6764//-------------------------------------------------------------------------------------------------
    6865template< typename pass_t >
     
    115112        const ast::Stmt *             visit( const ast::FinallyStmt          * ) override final;
    116113        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;
    118115        const ast::NullStmt *         visit( const ast::NullStmt             * ) override final;
    119116        const ast::Stmt *             visit( const ast::DeclStmt             * ) override final;
     
    204201        container_t< ptr<node_t> > call_accept( const container_t< ptr<node_t> > & container );
    205202
    206         /// Mutate forall-list, accounting for presence of type substitution map
    207         template<typename node_t>
    208         void mutate_forall( const node_t *& );
    209 
    210203public:
    211204        /// Logic to call the accept and mutate the parent if needed, delegates call to accept
     
    216209        /// Internal RAII guard for symbol table features
    217210        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); }
    220213                Pass<pass_t> & pass;
    221214        };
     
    223216        /// Internal RAII guard for scope features
    224217        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); }
    227220                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;
    237221        };
    238222
     
    329313        SymbolTable symtab;
    330314};
    331 
    332 /// Use when the templated visitor needs to keep TypeInstType instances properly linked to TypeDecl
    333 struct WithForallSubstitutor {
    334         ForallSubstitutionTable subs;
    335 };
    336 
    337315}
    338316
Note: See TracChangeset for help on using the changeset viewer.