Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r134322e r0661678  
    2020#include <unordered_map>
    2121#include <unordered_set>
    22 
    2322#include "InitTweak.h"
    2423#include "GenInit.h"
    2524#include "FixInit.h"
    2625#include "FixGlobalInit.h"
    27 #include "CodeGen/GenType.h"  // for warning/error messages
    28 #include "Common/PassVisitor.h"
    29 #include "GenPoly/DeclMutator.h"
    30 #include "GenPoly/PolyMutator.h"
    3126#include "ResolvExpr/Resolver.h"
    3227#include "ResolvExpr/typeops.h"
    33 #include "SymTab/Autogen.h"
    34 #include "SymTab/Indexer.h"
    35 #include "SynTree/AddStmtVisitor.h"
     28#include "SynTree/Declaration.h"
     29#include "SynTree/Type.h"
     30#include "SynTree/Expression.h"
    3631#include "SynTree/Attribute.h"
    37 #include "SynTree/Declaration.h"
    38 #include "SynTree/Expression.h"
     32#include "SynTree/Statement.h"
    3933#include "SynTree/Initializer.h"
    4034#include "SynTree/Mutator.h"
    41 #include "SynTree/Statement.h"
    42 #include "SynTree/Type.h"
     35#include "SymTab/Indexer.h"
     36#include "SymTab/Autogen.h"
     37#include "GenPoly/PolyMutator.h"
     38#include "GenPoly/DeclMutator.h"
     39#include "SynTree/AddStmtVisitor.h"
     40#include "CodeGen/GenType.h"  // for warning/error messages
    4341#include "Tuples/Tuples.h"
    4442
     
    5654                typedef std::unordered_map< int, int > UnqCount;
    5755
    58                 class InsertImplicitCalls {
     56                class InsertImplicitCalls final : public GenPoly::PolyMutator {
    5957                public:
    6058                        /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which
     
    6361
    6462                        InsertImplicitCalls( EnvMap & envMap ) : envMap( envMap ) {}
    65 
    66                         Expression * postmutate( ApplicationExpr * appExpr );
    67                         void premutate( StmtExpr * stmtExpr );
     63                        typedef GenPoly::PolyMutator Parent;
     64                        using Parent::mutate;
     65                        virtual Expression * mutate( ApplicationExpr * appExpr ) override;
     66                        virtual Expression * mutate( StmtExpr * stmtExpr ) override;
    6867
    6968                        // collects environments for relevant nodes
    7069                        EnvMap & envMap;
    71                         TypeSubstitution * env; //Magically populated by the PassVisitor
    7270                };
    7371
     
    302300        namespace {
    303301                void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit, EnvMap & envMap ) {
    304                         PassVisitor<InsertImplicitCalls> inserter( envMap );
     302                        InsertImplicitCalls inserter( envMap );
    305303                        mutateAll( translationUnit, inserter );
    306304                }
     
    352350                }
    353351
    354                 Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) {
     352                Expression * InsertImplicitCalls::mutate( ApplicationExpr * appExpr ) {
     353                        appExpr = dynamic_cast< ApplicationExpr * >( Parent::mutate( appExpr ) );
    355354                        assert( appExpr );
    356355
     
    394393                }
    395394
    396                 void InsertImplicitCalls::premutate( StmtExpr * stmtExpr ) {
     395                Expression * InsertImplicitCalls::mutate( StmtExpr * stmtExpr ) {
    397396                        assert( env );
    398397                        envMap[stmtExpr] = env;
     398                        return Parent::mutate( stmtExpr );
    399399                }
    400400
Note: See TracChangeset for help on using the changeset viewer.