Changeset c28ea4e for src/AST/Pass.hpp


Ignore:
Timestamp:
Nov 4, 2020, 2:56:30 PM (5 years ago)
Author:
Colby Alexander Parsons <caparsons@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
eeb5023
Parents:
4b30e8cc (diff), a3f5208a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.hpp

    r4b30e8cc rc28ea4e  
    103103        /// Construct and run a pass on a translation unit.
    104104        template< typename... Args >
    105         static void run( std::list< ptr<Decl> > & decls, Args &&... args ) {
     105        static void run( TranslationUnit & decls, Args &&... args ) {
    106106                Pass<core_t> visitor( std::forward<Args>( args )... );
    107107                accept_all( decls, visitor );
     
    119119        // Versions of the above for older compilers.
    120120        template< typename... Args >
    121         static void run( std::list< ptr<Decl> > & decls ) {
     121        static void run( TranslationUnit & decls ) {
    122122                Pass<core_t> visitor;
    123123                accept_all( decls, visitor );
     
    228228        template<typename core_type>
    229229        friend void accept_all( std::list< ptr<Decl> > & decls, Pass<core_type>& visitor );
     230
     231        bool isInFunction() const {
     232                return inFunction;
     233        }
     234
    230235private:
    231236
     
    235240        const ast::Stmt * call_accept( const ast::Stmt * );
    236241        const ast::Expr * call_accept( const ast::Expr * );
     242
     243        // requests WithStmtsToAdd directly add to this statement, as if it is a compound.
     244
     245        const ast::Stmt * call_accept_as_compound(const ast::Stmt *);
    237246
    238247        template< typename node_t >
     
    257266        template<typename node_t, typename parent_t, typename child_t>
    258267        void maybe_accept(const node_t * &, child_t parent_t::* child);
     268
     269        template<typename node_t, typename parent_t, typename child_t>
     270        void maybe_accept_as_compound(const node_t * &, child_t parent_t::* child);
    259271
    260272private:
     
    284296private:
    285297        bool inFunction = false;
     298        bool atFunctionTop = false;
    286299};
    287300
     
    289302template<typename core_t>
    290303void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<core_t> & visitor );
     304
     305template<typename core_t>
     306void accept_all( ast::TranslationUnit &, ast::Pass<core_t> & visitor );
    291307
    292308//-------------------------------------------------------------------------------------------------
     
    371387struct WithVisitorRef {
    372388        Pass<core_t> * const visitor = nullptr;
     389
     390        bool isInFunction() const {
     391                return visitor->isInFunction();
     392        }
    373393};
    374394
Note: See TracChangeset for help on using the changeset viewer.