diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 52a85bfb783..b829cdbfe28 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -950,7 +950,6 @@ extern bool c_common_post_options (const char **); extern bool c_common_init (void); extern void c_common_finish (void); extern void c_common_parse_file (void); -extern FILE *get_dump_info (int, dump_flags_t *); extern alias_set_type c_common_get_alias_set (tree); extern void c_register_builtin_type (tree, const char*); extern bool c_promoting_integer_type_p (const_tree); diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc index a00b0a02dcc..a6f26c9b0d3 100644 --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "c-ubsan.h" #include "tree-nested.h" +#include "context.h" /* The gimplification pass converts the language-dependent trees (ld-trees) emitted by the parser into language-independent trees @@ -552,6 +553,7 @@ c_genericize_control_r (tree *stmt_p, int *walk_subtrees, void *data) void c_genericize (tree fndecl) { + dump_file_info *dfi; FILE *dump_orig; dump_flags_t local_dump_flags; struct cgraph_node *cgn; @@ -581,7 +583,9 @@ c_genericize (tree fndecl) do_warn_duplicated_branches_r, NULL); /* Dump the C-specific tree IR. */ - dump_orig = get_dump_info (TDI_original, &local_dump_flags); + dfi = g->get_dumps ()->get_dump_file_info (TDI_original); + dump_orig = dfi->pstream; + local_dump_flags = dfi->pflags; if (dump_orig) { fprintf (dump_orig, "\n;; Function %s", diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc index a341a061758..09a16b20f36 100644 --- a/gcc/c-family/c-opts.cc +++ b/gcc/c-family/c-opts.cc @@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see #include "mkdeps.h" #include "dumpfile.h" #include "file-prefix-map.h" /* add_*_prefix_map() */ +#include "context.h" #ifndef DOLLARS_IN_IDENTIFIERS # define DOLLARS_IN_IDENTIFIERS true @@ -100,10 +101,6 @@ static size_t deferred_count; /* Number of deferred options scanned for -include. */ static size_t include_cursor; -/* Dump files/flags to use during parsing. */ -static FILE *original_dump_file = NULL; -static dump_flags_t original_dump_flags; - /* Whether any standard preincluded header has been preincluded. */ static bool done_preinclude; @@ -1226,15 +1223,13 @@ c_common_init (void) void c_common_parse_file (void) { - unsigned int i; - - i = 0; - for (;;) + auto dumps = g->get_dumps (); + for (unsigned int i = 0;;) { c_finish_options (); /* Open the dump file to use for the original dump output here, to be used during parsing for the current file. */ - original_dump_file = dump_begin (TDI_original, &original_dump_flags); + dumps->dump_start (TDI_original, &dump_flags); pch_init (); push_file_scope (); c_parse_file (); @@ -1248,29 +1243,15 @@ c_common_parse_file (void) cpp_clear_file_cache (parse_in); this_input_filename = cpp_read_main_file (parse_in, in_fnames[i]); - if (original_dump_file) - { - dump_end (TDI_original, original_dump_file); - original_dump_file = NULL; - } /* If an input file is missing, abandon further compilation. cpplib has issued a diagnostic. */ if (!this_input_filename) break; + dumps->dump_finish (TDI_original); } c_parse_final_cleanups (); -} - -/* Returns the appropriate dump file for PHASE to dump with FLAGS. */ - -FILE * -get_dump_info (int phase, dump_flags_t *flags) -{ - gcc_assert (phase == TDI_original); - - *flags = original_dump_flags; - return original_dump_file; + dumps->dump_finish (TDI_original); } /* Common finish hook for the C, ObjC and C++ front ends. */ diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 4bb9e7ba6af..d5c0e559f89 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -538,6 +538,7 @@ cgraph_node::get_create (tree decl) return first_clone; cgraph_node *node = cgraph_node::create (decl); + if (first_clone) { first_clone->clone_of = node; @@ -545,12 +546,12 @@ cgraph_node::get_create (tree decl) node->order = first_clone->order; symtab->symtab_prevail_in_asm_name_hash (node); node->decl->decl_with_vis.symtab_node = node; - if (dump_file) + if (dump_file && symtab->state != PARSING) fprintf (dump_file, "Introduced new external node " "(%s) and turned into root of the clone tree.\n", node->dump_name ()); } - else if (dump_file) + else if (dump_file && symtab->state != PARSING) fprintf (dump_file, "Introduced new external node " "(%s).\n", node->dump_name ()); return node;