+/* Return C++ property of T, based on given operation OP. */
+
+static int
+cpp_check (tree t, cpp_operation op)
+{
+ switch (op)
+ {
+ case IS_ABSTRACT:
+ return DECL_PURE_VIRTUAL_P (t);
+ case IS_CONSTRUCTOR:
+ return DECL_CONSTRUCTOR_P (t);
+ case IS_DESTRUCTOR:
+ return DECL_DESTRUCTOR_P (t);
+ case IS_COPY_CONSTRUCTOR:
+ return DECL_COPY_CONSTRUCTOR_P (t);
+ case IS_TEMPLATE:
+ return TREE_CODE (t) == TEMPLATE_DECL;
+ default:
+ return 0;
+ }
+}
+
+/* Collect source file references recursively, starting from NAMESPC. */
+
+static void
+collect_source_refs (tree namespc)
+{
+ tree t;
+
+ if (!namespc)
+ return;
+
+ /* Iterate over names in this name space. */
+ for (t = NAMESPACE_LEVEL (namespc)->names; t; t = TREE_CHAIN (t))
+ if (!DECL_IS_BUILTIN (t) )
+ collect_source_ref (DECL_SOURCE_FILE (t));
+
+ /* Dump siblings, if any */
+ collect_source_refs (TREE_CHAIN (namespc));
+
+ /* Dump children, if any */
+ collect_source_refs (NAMESPACE_LEVEL (namespc)->namespaces);
+}
+
+/* Collect decls relevant to SOURCE_FILE from all namespaces recursively,
+ starting from NAMESPC. */
+
+static void
+collect_ada_namespace (tree namespc, const char *source_file)
+{
+ if (!namespc)
+ return;
+
+ /* Collect decls from this namespace */
+ collect_ada_nodes (NAMESPACE_LEVEL (namespc)->names, source_file);
+
+ /* Collect siblings, if any */
+ collect_ada_namespace (TREE_CHAIN (namespc), source_file);
+
+ /* Collect children, if any */
+ collect_ada_namespace (NAMESPACE_LEVEL (namespc)->namespaces, source_file);
+}
+