Index: src/Common/CodeLocationTools.cpp
===================================================================
--- src/Common/CodeLocationTools.cpp	(revision c9e09916c73ec58be205cc286ab8d8e812ece871)
+++ src/Common/CodeLocationTools.cpp	(revision 1a2a49bb7c95d052f316a624485b846d86dd1b05)
@@ -10,6 +10,6 @@
 // Created On       : Fri Dec  4 15:42:00 2020
 // Last Modified By : Andrew Beach
-// Last Modified On : Mon Dec  7 15:15:00 2020
-// Update Count     : 0
+// Last Modified On : Wed Dec  9  9:42:00 2020
+// Update Count     : 1
 //
 
@@ -24,4 +24,8 @@
 namespace {
 
+// There are a lot of helpers in this file that could be used much more
+// generally if anyone has another use for them.
+
+// Check if a node type has a code location.
 template<typename node_t>
 struct has_code_location : public std::is_base_of<ast::ParseNode, node_t> {};
@@ -83,4 +87,136 @@
 };
 
+// ALL_VISITS(macro)
+// Expands `macro(node_type, return_type)` for every visit method of the
+// ast::Visitor class where node_type is the name of the parameter and
+// return_type is the name of the return type; not including the namespace,
+// pointer or const qualifiers.
+#define ALL_VISITS(macro) \
+    macro(ObjectDecl, DeclWithType) \
+    macro(FunctionDecl, DeclWithType) \
+    macro(StructDecl, Decl) \
+    macro(UnionDecl, Decl) \
+    macro(EnumDecl, Decl) \
+    macro(TraitDecl, Decl) \
+    macro(TypeDecl, Decl) \
+    macro(TypedefDecl, Decl) \
+    macro(AsmDecl, AsmDecl) \
+    macro(StaticAssertDecl, StaticAssertDecl) \
+    macro(CompoundStmt, CompoundStmt) \
+    macro(ExprStmt, Stmt) \
+    macro(AsmStmt, Stmt) \
+    macro(DirectiveStmt, Stmt) \
+    macro(IfStmt, Stmt) \
+    macro(WhileStmt, Stmt) \
+    macro(ForStmt, Stmt) \
+    macro(SwitchStmt, Stmt) \
+    macro(CaseStmt, Stmt) \
+    macro(BranchStmt, Stmt) \
+    macro(ReturnStmt, Stmt) \
+    macro(ThrowStmt, Stmt) \
+    macro(TryStmt, Stmt) \
+    macro(CatchStmt, Stmt) \
+    macro(FinallyStmt, Stmt) \
+    macro(SuspendStmt, Stmt) \
+    macro(WaitForStmt, Stmt) \
+    macro(WithStmt, Decl) \
+    macro(NullStmt, NullStmt) \
+    macro(DeclStmt, Stmt) \
+    macro(ImplicitCtorDtorStmt, Stmt) \
+    macro(ApplicationExpr, Expr) \
+    macro(UntypedExpr, Expr) \
+    macro(NameExpr, Expr) \
+    macro(AddressExpr, Expr) \
+    macro(LabelAddressExpr, Expr) \
+    macro(CastExpr, Expr) \
+    macro(KeywordCastExpr, Expr) \
+    macro(VirtualCastExpr, Expr) \
+    macro(UntypedMemberExpr, Expr) \
+    macro(MemberExpr, Expr) \
+    macro(VariableExpr, Expr) \
+    macro(ConstantExpr, Expr) \
+    macro(SizeofExpr, Expr) \
+    macro(AlignofExpr, Expr) \
+    macro(UntypedOffsetofExpr, Expr) \
+    macro(OffsetofExpr, Expr) \
+    macro(OffsetPackExpr, Expr) \
+    macro(LogicalExpr, Expr) \
+    macro(ConditionalExpr, Expr) \
+    macro(CommaExpr, Expr) \
+    macro(TypeExpr, Expr) \
+    macro(AsmExpr, Expr) \
+    macro(ImplicitCopyCtorExpr, Expr) \
+    macro(ConstructorExpr, Expr) \
+    macro(CompoundLiteralExpr, Expr) \
+    macro(RangeExpr, Expr) \
+    macro(UntypedTupleExpr, Expr) \
+    macro(TupleExpr, Expr) \
+    macro(TupleIndexExpr, Expr) \
+    macro(TupleAssignExpr, Expr) \
+    macro(StmtExpr, Expr) \
+    macro(UniqueExpr, Expr) \
+    macro(UntypedInitExpr, Expr) \
+    macro(InitExpr, Expr) \
+    macro(DeletedExpr, Expr) \
+    macro(DefaultArgExpr, Expr) \
+    macro(GenericExpr, Expr) \
+    macro(VoidType, Type) \
+    macro(BasicType, Type) \
+    macro(PointerType, Type) \
+    macro(ArrayType, Type) \
+    macro(ReferenceType, Type) \
+    macro(QualifiedType, Type) \
+    macro(FunctionType, Type) \
+    macro(StructInstType, Type) \
+    macro(UnionInstType, Type) \
+    macro(EnumInstType, Type) \
+    macro(TraitInstType, Type) \
+    macro(TypeInstType, Type) \
+    macro(TupleType, Type) \
+    macro(TypeofType, Type) \
+    macro(VarArgsType, Type) \
+    macro(ZeroType, Type) \
+    macro(OneType, Type) \
+    macro(GlobalScopeType, Type) \
+    macro(Designation, Designation) \
+    macro(SingleInit, Init) \
+    macro(ListInit, Init) \
+    macro(ConstructorInit, Init) \
+    macro(Attribute, Attribute) \
+    macro(TypeSubstitution, TypeSubstitution)
+
+// These could even go into the ast namespace.
+enum class LeafKind {
+#define VISIT(node_type, return_type) node_type,
+	ALL_VISITS(VISIT)
+#undef VISIT
+};
+
+struct LeafKindVisitor : public ast::Visitor {
+	LeafKind kind;
+
+#define VISIT(node_type, return_type) \
+	const ast::return_type * visit( const ast::node_type * ) final { \
+		kind = LeafKind::node_type; \
+		return nullptr; \
+	}
+	ALL_VISITS(VISIT)
+#undef VISIT
+};
+
+constexpr size_t leaf_kind_count = (1 + (size_t)LeafKind::TypeSubstitution);
+
+LeafKind get_leaf_kind( ast::Node const * node ) {
+	LeafKindVisitor visitor;
+	node->accept( visitor );
+	return visitor.kind;
+}
+
+const char * leaf_kind_names[leaf_kind_count] = {
+#define VISIT(node_type, return_type) #node_type,
+	ALL_VISITS(VISIT)
+#undef VISIT
+};
+
 // Collect pointers to all the nodes with unset code locations.
 class CollectCore {
@@ -103,4 +239,8 @@
 
 void checkAllCodeLocations( ast::TranslationUnit const & unit ) {
+	checkAllCodeLocations( "unknown location", unit );
+}
+
+void checkAllCodeLocations( char const * label, ast::TranslationUnit const & unit ) {
 	std::list< ast::ptr< ast::Node > > unsetNodes;
 	{
@@ -114,7 +254,19 @@
 	}
 
+	std::cerr << "Code Location check at " << label << " failed." << std::endl;
 	std::cerr << "Total nodes without a set code location: "
 		<< unsetNodes.size() << std::endl;
 
+	size_t node_counts[leaf_kind_count] = {0};
+	for ( auto unset : unsetNodes ) {
+		node_counts[(size_t)get_leaf_kind(unset)] += 1;
+	}
+	for ( size_t i = 0 ; i < leaf_kind_count ; ++i ) {
+		if ( node_counts[i] ) {
+			std::cerr << '\t' << node_counts[i]
+				<< " of type " << leaf_kind_names[i] << std::endl;
+		}
+	}
+
 	assert( unsetNodes.empty() );
 }
Index: src/Common/CodeLocationTools.hpp
===================================================================
--- src/Common/CodeLocationTools.hpp	(revision c9e09916c73ec58be205cc286ab8d8e812ece871)
+++ src/Common/CodeLocationTools.hpp	(revision 1a2a49bb7c95d052f316a624485b846d86dd1b05)
@@ -10,11 +10,9 @@
 // Created On       : Fri Dec  4 15:35:00 2020
 // Last Modified By : Andrew Beach
-// Last Modified On : Fri Dec  4 16:18:00 2020
-// Update Count     : 0
+// Last Modified On : Wed Dec  9  9:53:00 2020
+// Update Count     : 1
 //
 
 #pragma once
-
-// Additional tools for code locations.
 
 namespace ast {
@@ -22,7 +20,9 @@
 }
 
-/// Search the translation unit for unset code locations and print information
-/// on them. Abort if any unset code locations are found.
+// Search the translation unit for unset code locations and print information
+// on them, and where the check was run if provided. Abort if any unset code
+// locations are found.
 void checkAllCodeLocations( ast::TranslationUnit const & unit );
+void checkAllCodeLocations( char const *, ast::TranslationUnit const & );
 
 // Assign a nearby code-location to any unset code locations in the forest.
