Index: src/Common/PassVisitor.h
===================================================================
--- src/Common/PassVisitor.h	(revision 65dc8635169a69696916835b7ef9060318cc4904)
+++ src/Common/PassVisitor.h	(revision b73bd709bb788f60341596dfaa40285cf1dc0a13)
@@ -37,5 +37,11 @@
 	PassVisitor(Args &&... args)
 		: pass( std::forward<Args>( args )... )
-	{}
+	{
+		typedef PassVisitor<pass_type> this_t;
+		this_t * const * visitor = visitor_impl(pass, 0);
+		if(visitor) {
+			*const_cast<this_t **>( visitor ) = this;
+		}
+	}
 
 	virtual ~PassVisitor() = default;
@@ -240,6 +246,6 @@
 	std::list< Declaration* > * 	get_beforeDecls() { return declsToAddBefore_impl( pass, 0); }
 	std::list< Declaration* > * 	get_afterDecls () { return declsToAddAfter_impl ( pass, 0); }
-	bool visit_children() { bool* skip = skip_children_impl(pass, 0); return ! (skip && *skip); }
-	void reset_visit() { bool* skip = skip_children_impl(pass, 0); if(skip) *skip = false; }
+
+	void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
 
 	guard_value_impl init_guard() {
@@ -280,5 +286,4 @@
 	std::list< Statement* > stmtsToAddAfter;
 };
-
 class WithShortCircuiting {
 protected:
@@ -287,5 +292,5 @@
 
 public:
-	bool skip_children;
+	bool_ref visit_children;
 };
 
@@ -306,4 +311,13 @@
 };
 
+template<typename pass_type>
+class WithVisitorRef {
+protected:
+	WithVisitorRef() = default;
+	~WithVisitorRef() = default;
+
+public:
+	PassVisitor<pass_type> * const visitor;
+};
 
 #include "PassVisitor.impl.h"
Index: src/Common/PassVisitor.impl.h
===================================================================
--- src/Common/PassVisitor.impl.h	(revision 65dc8635169a69696916835b7ef9060318cc4904)
+++ src/Common/PassVisitor.impl.h	(revision b73bd709bb788f60341596dfaa40285cf1dc0a13)
@@ -4,10 +4,11 @@
 	__attribute__((unused))                   \
 	const auto & guard = init_guard();        \
+	bool visit_children = true;               \
+	set_visit_children( visit_children );	\
 	call_previsit( node );                    \
-	if( visit_children() ) {                  \
+	if( visit_children ) {                    \
 
 #define VISIT_END( node )                       \
 	}                                         \
-	reset_visit();                            \
 	call_postvisit( node );                   \
 
@@ -15,10 +16,11 @@
 	__attribute__((unused))                   \
 	const auto & guard = init_guard();        \
+	bool visit_children = true;               \
+	set_visit_children( visit_children );	\
 	call_premutate( node );                   \
-	if( visit_children() ) {                  \
+	if( visit_children ) {                    \
 
 #define MUTATE_END( type, node )                \
 	}                                         \
-	reset_visit();                            \
 	return call_postmutate< type * >( node ); \
 
Index: src/Common/PassVisitor.proto.h
===================================================================
--- src/Common/PassVisitor.proto.h	(revision 65dc8635169a69696916835b7ef9060318cc4904)
+++ src/Common/PassVisitor.proto.h	(revision b73bd709bb788f60341596dfaa40285cf1dc0a13)
@@ -1,3 +1,6 @@
 #pragma once
+
+template<typename pass_type>
+class PassVisitor;
 
 typedef std::function<void( void * )> cleanup_func_t;
@@ -31,4 +34,22 @@
 
 typedef std::function< void( cleanup_func_t, void * ) > at_cleanup_t;
+
+class bool_ref {
+public:
+	bool_ref() = default;
+	~bool_ref() = default;
+
+	operator bool() { return *m_ref; }
+	bool operator=( bool val ) { return *m_ref = val; }
+
+private:
+
+	template<typename pass>
+	friend class PassVisitor;
+
+	void set( bool & val ) { m_ref = &val; };
+
+	bool * m_ref;
+};
 
 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -114,4 +135,5 @@
 FIELD_PTR( std::list< Declaration* >, declsToAddBefore )
 FIELD_PTR( std::list< Declaration* >, declsToAddAfter  )
-FIELD_PTR( bool, skip_children )
+FIELD_PTR( bool_ref, visit_children )
 FIELD_PTR( at_cleanup_t, at_cleanup )
+FIELD_PTR( PassVisitor<pass_type> * const, visitor )
