Index: src/Validate/FindSpecialDecls.cc
===================================================================
--- src/Validate/FindSpecialDecls.cc	(revision 933f32f2ae9703d54327e4727aceb5746433092d)
+++ src/Validate/FindSpecialDecls.cc	(revision 933f32f2ae9703d54327e4727aceb5746433092d)
@@ -0,0 +1,100 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// FindSpecialDecls.cc --
+//
+// Author           : Rob Schluntz
+// Created On       : Thu Aug 30 09:49:43 2018
+// Last Modified By : Rob Schluntz
+// Last Modified On : Thu Aug 30 09:55:25 2018
+// Update Count     : 2
+//
+
+#include "FindSpecialDecls.h"
+
+#include "Common/PassVisitor.h"
+#include "SynTree/Declaration.h"
+#include "SynTree/Type.h"
+
+// NOTE: currently, it is assumed that every special declaration occurs at the top-level,
+// so function bodies, aggregate bodies, object initializers, etc. are not visited.
+// If this assumption changes, e.g., with the introduction of namespaces, remove the visit_children assignments.
+
+namespace Validate {
+	Type * SizeType = nullptr;
+  FunctionDecl * dereferenceOperator = nullptr;
+  StructDecl * dtorStruct = nullptr;
+  FunctionDecl * dtorStructDestroy = nullptr;
+
+	namespace {
+		struct FindSpecialDecls final : public WithShortCircuiting {
+			void previsit( ObjectDecl * objDecl );
+			void previsit( FunctionDecl * funcDecl );
+			void previsit( StructDecl * structDecl );
+			void previsit( UnionDecl * unionDecl );
+			void previsit( EnumDecl * enumDecl );
+			void previsit( TraitDecl * traitDecl );
+		};
+	} // namespace
+
+	void findSpecialDecls( std::list< Declaration * > &translationUnit ) {
+		PassVisitor<FindSpecialDecls> finder;
+		acceptAll( translationUnit, finder );
+		// TODO: conditionally generate 'fake' declarations for missing features, so that
+		// translation can proceed in the event that builtins, prelude, etc. are missing.
+	}
+
+	namespace {
+		void FindSpecialDecls::previsit( ObjectDecl * ) {
+			visit_children = false;
+		}
+
+		void FindSpecialDecls::previsit( FunctionDecl * funcDecl ) {
+			visit_children = false;
+			if ( ! dereferenceOperator && funcDecl->name == "*?" && funcDecl->linkage == LinkageSpec::Intrinsic ) {
+				// find and remember the intrinsic dereference operator for object pointers
+				FunctionType * ftype = funcDecl->type;
+				if ( ftype->parameters.size() == 1 ) {
+					PointerType * ptrType = strict_dynamic_cast<PointerType *>( ftype->parameters.front()->get_type() );
+					if ( ptrType->base->get_qualifiers() == Type::Qualifiers() ) {
+						TypeInstType * inst = dynamic_cast<TypeInstType *>( ptrType->base );
+						if ( inst && ! inst->get_isFtype() ) {
+							dereferenceOperator = funcDecl;
+						}
+					}
+				}
+			} else if ( ! dtorStructDestroy && funcDecl->name == "__destroy_Destructor" ) {
+				dtorStructDestroy = funcDecl;
+			}
+		}
+
+		void FindSpecialDecls::previsit( StructDecl * structDecl ) {
+			visit_children = false;
+			if ( ! dtorStruct && structDecl->name == "__Destructor" ) {
+				dtorStruct = structDecl;
+			}
+		}
+
+		void FindSpecialDecls::previsit( UnionDecl * ) {
+			visit_children = false;
+		}
+
+		void FindSpecialDecls::previsit( EnumDecl * ) {
+			visit_children = false;
+		}
+
+		void FindSpecialDecls::previsit( TraitDecl * ) {
+			visit_children = false;
+		}
+
+	} // namespace
+} // namespace Validate
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/FindSpecialDecls.h
===================================================================
--- src/Validate/FindSpecialDecls.h	(revision 933f32f2ae9703d54327e4727aceb5746433092d)
+++ src/Validate/FindSpecialDecls.h	(revision 933f32f2ae9703d54327e4727aceb5746433092d)
@@ -0,0 +1,46 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// FindSpecialDeclarations.h --
+//
+// Author           : Rob Schluntz
+// Created On       : Thu Aug 30 09:49:02 2018
+// Last Modified By : Rob Schluntz
+// Last Modified On : Thu Aug 30 09:51:12 2018
+// Update Count     : 2
+//
+
+#pragma once
+
+#include <list>  // for list
+
+class Declaration;
+class FunctionDecl;
+class StructDecl;
+class Type;
+
+namespace Validate {
+	/// size_t type - set when size_t typedef is seen. Useful in a few places,
+	/// such as in determining array dimension type
+	extern Type * SizeType;
+
+	/// intrinsic dereference operator for unqualified types - set when *? function is seen in FindSpecialDeclarations.
+	/// Useful for creating dereference ApplicationExprs without a full resolver pass.
+	extern FunctionDecl * dereferenceOperator;
+
+	/// special built-in functions and data structures necessary for destructor generation
+	extern StructDecl * dtorStruct;
+	extern FunctionDecl * dtorStructDestroy;
+
+	/// find and remember some of the special declarations that are useful for generating code, so that they do not have to be discovered multiple times.
+	void findSpecialDecls( std::list< Declaration * > & translationUnit );
+} // namespace Validate
+
+// Local Variables: //
+// tab-width: 4 //
+// mode: c++ //
+// compile-command: "make install" //
+// End: //
Index: src/Validate/module.mk
===================================================================
--- src/Validate/module.mk	(revision 7abee383f06a7fe5690784e7676edcdf68ff7660)
+++ src/Validate/module.mk	(revision 933f32f2ae9703d54327e4727aceb5746433092d)
@@ -15,4 +15,4 @@
 ###############################################################################
 
-SRC += Validate/HandleAttributes.cc
-SRCDEMANGLE += Validate/HandleAttributes.cc
+SRC += Validate/HandleAttributes.cc Validate/FindSpecialDecls.cc
+SRCDEMANGLE += Validate/HandleAttributes.cc Validate/FindSpecialDecls.cc
