aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-decl.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-12-20 17:41:06 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2019-12-20 17:41:06 +0000
commit39292e25076e1048b2aaa89ac60c28f3f61a78a0 (patch)
tree14d790f6ae6c3e85fd4ba2d1f7763bd61a026494 /gcc/c/c-decl.c
parent02e8542795c4321a76783b8f419435696bfed9f1 (diff)
downloadgcc-39292e25076e1048b2aaa89ac60c28f3f61a78a0.zip
gcc-39292e25076e1048b2aaa89ac60c28f3f61a78a0.tar.gz
gcc-39292e25076e1048b2aaa89ac60c28f3f61a78a0.tar.bz2
c-ada-spec.h (decl_sloc): Delete.
c-family/ * c-ada-spec.h (decl_sloc): Delete. * c-ada-spec.c (decl_sloc): Make static. c/ * 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. cp/ * decl2.c (c_parse_final_cleanups): Always call collect_source_ref on the main input filename. From-SVN: r279670
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r--gcc/c/c-decl.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 0450fcd..01f85e2 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -11787,15 +11787,6 @@ c_write_global_declarations_1 (tree globals)
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;
@@ -11813,10 +11804,10 @@ collect_all_refs (const char *source_file)
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;
@@ -11827,11 +11818,13 @@ for_each_global_decl (void (*callback) (tree decl))
{
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
@@ -11865,10 +11858,9 @@ c_parse_final_cleanups (void)
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);
}