Index: src/Common/PassVisitor.h
===================================================================
--- src/Common/PassVisitor.h	(revision cc3e4d0fba2ab4dcc1616c82569b8f30a199e333)
+++ src/Common/PassVisitor.h	(revision d33bc7cf35bb09492981e1dc6d31b0c998fbf5f0)
@@ -253,3 +253,48 @@
 }
 
+class WithTypeSubstitution {
+protected:
+	WithTypeSubstitution() = default;
+	~WithTypeSubstitution() = default;
+
+public:
+	TypeSubstitution * env;
+};
+
+class WithStmtsToAdd {
+protected:
+	WithStmtsToAdd() = default;
+	~WithStmtsToAdd() = default;
+
+public:
+	std::list< Statement* > stmtsToAddBefore;
+	std::list< Statement* > stmtsToAddAfter;
+};
+
+class WithShortCircuiting {
+protected:
+	WithShortCircuiting() = default;
+	~WithShortCircuiting() = default;
+
+public:
+	bool skip_children;
+};
+
+class WithScopes {
+protected:
+	WithScopes() = default;
+	~WithScopes() = default;
+
+public:
+	at_cleanup_t at_cleanup;
+
+	template< typename T >
+	void GuardValue( T& val ) {
+		at_cleanup( [ val ]( void * newVal ) {
+			* static_cast< T * >( newVal ) = val;
+		}, static_cast< void * >( & val ) );
+	}
+};
+
+
 #include "PassVisitor.impl.h"
Index: src/InitTweak/GenInit.cc
===================================================================
--- src/InitTweak/GenInit.cc	(revision cc3e4d0fba2ab4dcc1616c82569b8f30a199e333)
+++ src/InitTweak/GenInit.cc	(revision d33bc7cf35bb09492981e1dc6d31b0c998fbf5f0)
@@ -44,5 +44,5 @@
 	}
 
-	class ReturnFixer {
+	class ReturnFixer : public WithStmtsToAdd, public WithScopes {
 	  public:
 		/// consistently allocates a temporary variable for the return value
@@ -53,7 +53,4 @@
 		void premutate( FunctionDecl *functionDecl );
 		void premutate( ReturnStmt * returnStmt );
-
-		at_cleanup_t at_cleanup;
-		std::list< Statement * > stmtsToAddBefore;
 
 	  protected:
@@ -160,6 +157,6 @@
 
 	void ReturnFixer::premutate( FunctionDecl *functionDecl ) {
-		GuardValue( this, ftype );
-		GuardValue( this, funcName );
+		GuardValue( ftype );
+		GuardValue( funcName );
 
 		ftype = functionDecl->get_functionType();
