Changes in src/InitTweak/FixInit.cc [134322e:0661678]
- File:
-
- 1 edited
-
src/InitTweak/FixInit.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r134322e r0661678 20 20 #include <unordered_map> 21 21 #include <unordered_set> 22 23 22 #include "InitTweak.h" 24 23 #include "GenInit.h" 25 24 #include "FixInit.h" 26 25 #include "FixGlobalInit.h" 27 #include "CodeGen/GenType.h" // for warning/error messages28 #include "Common/PassVisitor.h"29 #include "GenPoly/DeclMutator.h"30 #include "GenPoly/PolyMutator.h"31 26 #include "ResolvExpr/Resolver.h" 32 27 #include "ResolvExpr/typeops.h" 33 #include "Sy mTab/Autogen.h"34 #include "Sy mTab/Indexer.h"35 #include "SynTree/ AddStmtVisitor.h"28 #include "SynTree/Declaration.h" 29 #include "SynTree/Type.h" 30 #include "SynTree/Expression.h" 36 31 #include "SynTree/Attribute.h" 37 #include "SynTree/Declaration.h" 38 #include "SynTree/Expression.h" 32 #include "SynTree/Statement.h" 39 33 #include "SynTree/Initializer.h" 40 34 #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 43 41 #include "Tuples/Tuples.h" 44 42 … … 56 54 typedef std::unordered_map< int, int > UnqCount; 57 55 58 class InsertImplicitCalls {56 class InsertImplicitCalls final : public GenPoly::PolyMutator { 59 57 public: 60 58 /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which … … 63 61 64 62 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; 68 67 69 68 // collects environments for relevant nodes 70 69 EnvMap & envMap; 71 TypeSubstitution * env; //Magically populated by the PassVisitor72 70 }; 73 71 … … 302 300 namespace { 303 301 void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit, EnvMap & envMap ) { 304 PassVisitor<InsertImplicitCalls>inserter( envMap );302 InsertImplicitCalls inserter( envMap ); 305 303 mutateAll( translationUnit, inserter ); 306 304 } … … 352 350 } 353 351 354 Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) { 352 Expression * InsertImplicitCalls::mutate( ApplicationExpr * appExpr ) { 353 appExpr = dynamic_cast< ApplicationExpr * >( Parent::mutate( appExpr ) ); 355 354 assert( appExpr ); 356 355 … … 394 393 } 395 394 396 void InsertImplicitCalls::premutate( StmtExpr * stmtExpr ) {395 Expression * InsertImplicitCalls::mutate( StmtExpr * stmtExpr ) { 397 396 assert( env ); 398 397 envMap[stmtExpr] = env; 398 return Parent::mutate( stmtExpr ); 399 399 } 400 400
Note:
See TracChangeset
for help on using the changeset viewer.