Index: src/CodeGen/FixNames.cc
===================================================================
--- src/CodeGen/FixNames.cc	(revision 55d6e8de222270bc01df132ae38161e27cfebe86)
+++ src/CodeGen/FixNames.cc	(revision 905841490d678a3d943dc7f6adfb4b619fd97434)
@@ -19,4 +19,5 @@
 #include <string>                  // for string, operator!=, operator==
 
+#include "Common/PassVisitor.h"
 #include "Common/SemanticError.h"  // for SemanticError
 #include "FixMain.h"               // for FixMain
@@ -32,10 +33,10 @@
 
 namespace CodeGen {
-	class FixNames : public Visitor {
+	class FixNames : public WithGuards {
 	  public:
-		virtual void visit( ObjectDecl *objectDecl );
-		virtual void visit( FunctionDecl *functionDecl );
+		void postvisit( ObjectDecl *objectDecl );
+		void postvisit( FunctionDecl *functionDecl );
 
-		virtual void visit( CompoundStmt *compoundStmt );
+		void previsit( CompoundStmt *compoundStmt );
 	  private:
 		int scopeLevel = 1;
@@ -93,10 +94,10 @@
 	}
 
-	void fixNames( std::list< Declaration* > translationUnit ) {
-		FixNames fixer;
+	void fixNames( std::list< Declaration* > & translationUnit ) {
+		PassVisitor<FixNames> fixer;
 		acceptAll( translationUnit, fixer );
 	}
 
-	void FixNames::fixDWT( DeclarationWithType *dwt ) {
+	void FixNames::fixDWT( DeclarationWithType * dwt ) {
 		if ( dwt->get_name() != "" ) {
 			if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) {
@@ -107,11 +108,9 @@
 	}
 
-	void FixNames::visit( ObjectDecl *objectDecl ) {
-		Visitor::visit( objectDecl );
+	void FixNames::postvisit( ObjectDecl * objectDecl ) {
 		fixDWT( objectDecl );
 	}
 
-	void FixNames::visit( FunctionDecl *functionDecl ) {
-		Visitor::visit( functionDecl );
+	void FixNames::postvisit( FunctionDecl * functionDecl ) {
 		fixDWT( functionDecl );
 
@@ -121,13 +120,12 @@
 				throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
 			}
-			functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) );
+			functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( new ConstantExpr( Constant::from_int( 0 ) ) ) );
 			CodeGen::FixMain::registerMain( functionDecl );
 		}
 	}
 
-	void FixNames::visit( CompoundStmt *compoundStmt ) {
+	void FixNames::previsit( CompoundStmt * ) {
 		scopeLevel++;
-		Visitor::visit( compoundStmt );
-		scopeLevel--;
+		GuardAction( [this](){ scopeLevel--; } );
 	}
 } // namespace CodeGen
Index: src/CodeGen/FixNames.h
===================================================================
--- src/CodeGen/FixNames.h	(revision 55d6e8de222270bc01df132ae38161e27cfebe86)
+++ src/CodeGen/FixNames.h	(revision 905841490d678a3d943dc7f6adfb4b619fd97434)
@@ -5,5 +5,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// FixNames.h -- 
+// FixNames.h --
 //
 // Author           : Richard C. Bilson
@@ -22,5 +22,5 @@
 namespace CodeGen {
 	/// mangles object and function names
-	void fixNames( std::list< Declaration* > translationUnit );
+	void fixNames( std::list< Declaration* > & translationUnit );
 } // namespace CodeGen
 
