+2019-12-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-ada-spec.h (decl_sloc): Delete.
+ * c-ada-spec.c (decl_sloc): Make static.
+
2019-12-19 Julian Brown <julian@codesourcery.com>
* c-common.h (c_omp_map_clause_name): Add prototype.
/* Return sloc of DECL, using sloc of last field if LAST is true. */
-location_t
+static location_t
decl_sloc (const_tree decl, bool last)
{
tree field;
IS_TRIVIAL
};
-extern location_t decl_sloc (const_tree, bool);
extern void collect_ada_nodes (tree, const char *);
extern void collect_source_ref (const char *);
extern void dump_ada_specs (void (*)(const char *),
+2019-12-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-decl.c (collect_source_ref_cb): Delete.
+ (for_each_global_decl): Rename into...
+ (collect_source_refs): ...this. Call collect_source_ref directly.
+ (c_parse_final_cleanups): Always call collect_source_ref on the main
+ input filename.
+
2019-12-19 Julian Brown <julian@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
while (reconsider);
}
-/* Callback to collect a source_ref from a DECL. */
-
-static void
-collect_source_ref_cb (tree decl)
-{
- if (!DECL_IS_BUILTIN (decl))
- collect_source_ref (LOCATION_FILE (decl_sloc (decl, false)));
-}
-
/* Preserve the external declarations scope across a garbage collect. */
static GTY(()) tree ext_block;
collect_ada_nodes (BLOCK_VARS (ext_block), source_file);
}
-/* Iterate over all global declarations and call CALLBACK. */
+/* Collect source file references at global level. */
static void
-for_each_global_decl (void (*callback) (tree decl))
+collect_source_refs (void)
{
tree t;
tree decls;
{
decls = DECL_INITIAL (t);
for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl))
- callback (decl);
+ if (!DECL_IS_BUILTIN (decl))
+ collect_source_ref (DECL_SOURCE_FILE (decl));
}
for (decl = BLOCK_VARS (ext_block); decl; decl = TREE_CHAIN (decl))
- callback (decl);
+ if (!DECL_IS_BUILTIN (decl))
+ collect_source_ref (DECL_SOURCE_FILE (decl));
}
/* Perform any final parser cleanups and generate initial debugging
if (flag_dump_ada_spec || flag_dump_ada_spec_slim)
{
/* Build a table of files to generate specs for */
- if (flag_dump_ada_spec_slim)
- collect_source_ref (main_input_filename);
- else
- for_each_global_decl (collect_source_ref_cb);
+ collect_source_ref (main_input_filename);
+ if (!flag_dump_ada_spec_slim)
+ collect_source_refs ();
dump_ada_specs (collect_all_refs, NULL);
}
+2019-12-20 Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl2.c (c_parse_final_cleanups): Always call collect_source_ref on
+ the main input filename.
+
2019-12-19 Julian Brown <julian@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
/* Handle -fdump-ada-spec[-slim] */
if (flag_dump_ada_spec || flag_dump_ada_spec_slim)
{
- if (flag_dump_ada_spec_slim)
- collect_source_ref (main_input_filename);
- else
+ collect_source_ref (main_input_filename);
+ if (!flag_dump_ada_spec_slim)
collect_source_refs (global_namespace);
dump_ada_specs (collect_all_refs, cpp_check);