Index: src/Common/CodeLocationTools.cpp
===================================================================
--- src/Common/CodeLocationTools.cpp	(revision 4559b34425030aa5ff5e6be7a0d6e46d70ae6fec)
+++ src/Common/CodeLocationTools.cpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
@@ -9,7 +9,7 @@
 // Author           : Andrew Beach
 // Created On       : Fri Dec  4 15:42:00 2020
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Feb  1 09:14:39 2022
-// Update Count     : 3
+// Last Modified By : Andrew Beach
+// Last Modified On : Mon Mar 14 15:14:00 2022
+// Update Count     : 4
 //
 
@@ -112,11 +112,11 @@
     macro(ForStmt, Stmt) \
     macro(SwitchStmt, Stmt) \
-    macro(CaseStmt, Stmt) \
+    macro(CaseClause, CaseClause) \
     macro(BranchStmt, Stmt) \
     macro(ReturnStmt, Stmt) \
     macro(ThrowStmt, Stmt) \
     macro(TryStmt, Stmt) \
-    macro(CatchStmt, Stmt) \
-    macro(FinallyStmt, Stmt) \
+    macro(CatchClause, CatchClause) \
+    macro(FinallyClause, FinallyClause) \
     macro(SuspendStmt, Stmt) \
     macro(WaitForStmt, Stmt) \
@@ -239,4 +239,25 @@
 };
 
+class LocalFillCore : public ast::WithGuards {
+	CodeLocation const * parent;
+public:
+	LocalFillCore( CodeLocation const & location ) : parent( &location ) {
+		assert( location.isSet() );
+	}
+
+	template<typename node_t>
+	auto previsit( node_t const * node )
+			-> typename std::enable_if<has_code_location<node_t>::value, node_t const *>::type {
+		if ( node->location.isSet() ) {
+			GuardValue( parent ) = &node->location;
+			return node;
+		} else {
+			node_t * mut = ast::mutate( node );
+			mut->location = *parent;
+			return mut;
+		}
+	}
+};
+
 } // namespace
 
@@ -278,2 +299,8 @@
 	ast::Pass<FillCore>::run( unit );
 }
+
+ast::Node const * localFillCodeLocations(
+		CodeLocation const & location , ast::Node const * node ) {
+	ast::Pass<LocalFillCore> visitor( location );
+	return node->accept( visitor );
+}
Index: src/Common/CodeLocationTools.hpp
===================================================================
--- src/Common/CodeLocationTools.hpp	(revision 4559b34425030aa5ff5e6be7a0d6e46d70ae6fec)
+++ src/Common/CodeLocationTools.hpp	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
@@ -10,11 +10,13 @@
 // Created On       : Fri Dec  4 15:35:00 2020
 // Last Modified By : Andrew Beach
-// Last Modified On : Wed Dec  9  9:53:00 2020
-// Update Count     : 1
+// Last Modified On : Mon Mar 14 15:14:00 2022
+// Update Count     : 2
 //
 
 #pragma once
 
+struct CodeLocation;
 namespace ast {
+	class Node;
 	class TranslationUnit;
 }
@@ -28,2 +30,7 @@
 // Assign a nearby code-location to any unset code locations in the forest.
 void forceFillCodeLocations( ast::TranslationUnit & unit );
+
+// Fill in code-locations with a parent code location,
+// using the provided CodeLocation as the base.
+ast::Node const *
+	localFillCodeLocations( CodeLocation const &, ast::Node const * );
Index: src/Common/Examine.cc
===================================================================
--- src/Common/Examine.cc	(revision 4559b34425030aa5ff5e6be7a0d6e46d70ae6fec)
+++ src/Common/Examine.cc	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
@@ -5,16 +5,18 @@
 // file "LICENCE" distributed with Cforall.
 //
-// Examine.h --
+// Examine.cc -- Helpers for examining AST code.
 //
 // Author           : Andrew Beach
 // Created On       : Wed Sept 2 14:02 2020
 // Last Modified By : Andrew Beach
-// Last Modified On : Wed Sep  8 12:15 2020
-// Update Count     : 0
+// Last Modified On : Fri Dec 10 10:27 2021
+// Update Count     : 1
 //
 
 #include "Common/Examine.h"
 
+#include "AST/Type.hpp"
 #include "CodeGen/OperatorTable.h"
+#include "InitTweak/InitTweak.h"
 
 DeclarationWithType * isMainFor( FunctionDecl * func, AggregateDecl::Aggregate kind ) {
@@ -36,4 +38,35 @@
 
 namespace {
+
+// getTypeofThis but does some extra checks used in this module.
+const ast::Type * getTypeofThisSolo( const ast::FunctionDecl * func ) {
+	if ( 1 != func->params.size() ) {
+		return nullptr;
+	}
+	auto ref = func->type->params.front().as<ast::ReferenceType>();
+	return (ref) ? ref->base : nullptr;
+}
+
+}
+
+const ast::DeclWithType * isMainFor(
+		const ast::FunctionDecl * func, ast::AggregateDecl::Aggregate kind ) {
+	if ( "main" != func->name ) return nullptr;
+	if ( 1 != func->params.size() ) return nullptr;
+
+	auto param = func->params.front();
+
+	auto type = dynamic_cast<const ast::ReferenceType *>( param->get_type() );
+	if ( !type ) return nullptr;
+
+	auto obj = type->base.as<ast::StructInstType>();
+	if ( !obj ) return nullptr;
+
+	if ( kind != obj->base->kind ) return nullptr;
+
+	return param;
+}
+
+namespace {
 	Type * getDestructorParam( FunctionDecl * func ) {
 		if ( !CodeGen::isDestructor( func->name ) ) return nullptr;
@@ -48,4 +81,11 @@
 		return nullptr;
 	}
+
+const ast::Type * getDestructorParam( const ast::FunctionDecl * func ) {
+	if ( !CodeGen::isDestructor( func->name ) ) return nullptr;
+	//return InitTweak::getParamThis( func )->type;
+	return getTypeofThisSolo( func );
+}
+
 }
 
@@ -57,2 +97,11 @@
 	return false;
 }
+
+bool isDestructorFor(
+		const ast::FunctionDecl * func, const ast::StructDecl * type_decl ) {
+	if ( const ast::Type * type = getDestructorParam( func ) ) {
+		auto stype = dynamic_cast<const ast::StructInstType *>( type );
+		return stype && stype->base.get() == type_decl;
+	}
+	return false;
+}
Index: src/Common/Examine.h
===================================================================
--- src/Common/Examine.h	(revision 4559b34425030aa5ff5e6be7a0d6e46d70ae6fec)
+++ src/Common/Examine.h	(revision 30d91e4132fb7ec560dd389474deafbfd0d57555)
@@ -5,19 +5,24 @@
 // file "LICENCE" distributed with Cforall.
 //
-// Examine.h --
+// Examine.h -- Helpers for examining AST code.
 //
 // Author           : Andrew Beach
 // Created On       : Wed Sept 2 13:57 2020
 // Last Modified By : Andrew Beach
-// Last Modified On : Wed Sep  8 12:08 2020
-// Update Count     : 0
+// Last Modified On : Fri Dec 10 10:28 2021
+// Update Count     : 1
 //
 
+#include "AST/Decl.hpp"
 #include "SynTree/Declaration.h"
 
 /// Check if this is a main function for a type of an aggregate kind.
 DeclarationWithType * isMainFor( FunctionDecl * func, AggregateDecl::Aggregate kind );
+const ast::DeclWithType * isMainFor(
+	const ast::FunctionDecl * func, ast::AggregateDecl::Aggregate kind );
 // Returns a pointer to the parameter if true, nullptr otherwise.
 
 /// Check if this function is a destructor for the given structure.
 bool isDestructorFor( FunctionDecl * func, StructDecl * type_decl );
+bool isDestructorFor(
+	const ast::FunctionDecl * func, const ast::StructDecl * type );
