Index: src/InitTweak/RemoveInit.cc
===================================================================
--- src/InitTweak/RemoveInit.cc	(revision 083cf3181fe3a210bc837e36dd40f9dc8d3ae198)
+++ src/InitTweak/RemoveInit.cc	(revision 1e9d87b8a6182e544c2e7efcbc6743cac619b9a4)
@@ -5,11 +5,11 @@
 // file "LICENCE" distributed with Cforall.
 //
-// RemoveInit.cc -- 
+// RemoveInit.cc --
 //
 // Author           : Rob Schluntz
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Dec 15 15:37:26 2015
-// Update Count     : 15
+// Last Modified By : Rob Schluntz
+// Last Modified On : Thu Jan 07 11:34:33 2016
+// Update Count     : 23
 //
 
@@ -21,4 +21,5 @@
 #include "SynTree/Initializer.h"
 #include "SynTree/Mutator.h"
+#include "GenPoly/PolyMutator.h"
 
 namespace InitTweak {
@@ -26,6 +27,6 @@
 		const std::list<Label> noLabels;
 	}
-	
-	class RemoveInit : public Mutator {
+
+	class RemoveInit : public GenPoly::PolyMutator {
 	  public:
 		RemoveInit();
@@ -34,12 +35,8 @@
 
 		virtual Statement * mutate( ReturnStmt * returnStmt );
-		
+
 		virtual CompoundStmt * mutate(CompoundStmt * compoundStmt);
-		
+
 	  protected:
-		std::list< Statement* > stmtsToAddBefore;
-		std::list< Statement* > stmtsToAddAfter;
-		void mutateStatementList( std::list< Statement* > &statements );
-
 		std::list<DeclarationWithType*> returnVals;
 		UniqueName tempNamer;
@@ -53,19 +50,4 @@
 
 	RemoveInit::RemoveInit() : tempNamer( "_retVal" ) {}
-	
-	void RemoveInit::mutateStatementList( std::list< Statement* > &statements ) {
-		for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
-			if ( ! stmtsToAddAfter.empty() ) {
-				statements.splice( i, stmtsToAddAfter );
-			} // if
-			*i = (*i)->acceptMutator( *this );
-			if ( ! stmtsToAddBefore.empty() ) {
-				statements.splice( i, stmtsToAddBefore );
-			} // if
-		} // for
-		if ( ! stmtsToAddAfter.empty() ) {
-			statements.splice( statements.end(), stmtsToAddAfter );
-		} // if
-	}
 
 	CompoundStmt *RemoveInit::mutate(CompoundStmt *compoundStmt) {
@@ -95,10 +77,10 @@
 		if ( returnStmt->get_expr() && returnVals.size() == 1 && funcName != "?=?" && ! returnVals.front()->get_type()->get_isLvalue()  ) {
 			ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, returnVals.front()->get_type()->clone(), 0 );
-			stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
-			
+			stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
+
 			UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
 			assign->get_args().push_back( new AddressExpr (new NameExpr( newObj->get_name() ) ) );
 			assign->get_args().push_back( returnStmt->get_expr() );
-			stmtsToAddBefore.push_back(new ExprStmt(noLabels, assign));
+			stmtsToAdd.push_back(new ExprStmt(noLabels, assign));
 
 			returnStmt->set_expr( new VariableExpr( newObj ) );
@@ -110,5 +92,5 @@
 		std::list<DeclarationWithType*> oldReturnVals = returnVals;
 		std::string oldFuncName = funcName;
-		
+
 		FunctionType * type = functionDecl->get_functionType();
 		returnVals = type->get_returnVals();
