diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2015-06-05 18:44:53 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2015-06-05 18:44:53 +0000 |
commit | d7438551ff5ffa0afeca2aa3efd13035b26bee34 (patch) | |
tree | 906774b04a2315e6e0109ec866407a4b6ee1195f /gcc/cp/decl2.c | |
parent | 46ba128114d3fd892b94c3767fb7a681088c7d79 (diff) | |
download | gcc-d7438551ff5ffa0afeca2aa3efd13035b26bee34.zip gcc-d7438551ff5ffa0afeca2aa3efd13035b26bee34.tar.gz gcc-d7438551ff5ffa0afeca2aa3efd13035b26bee34.tar.bz2 |
Merge debug-early branch into mainline.
* dwarf2out.c: Remove deferred_locations*.
(dwarf2_debug_hooks): Add early_finish hook.
Remove global_decl hook.
Add early_global_decl and late_global_decl hook.
New global early_dwarf.
New structure set_early_dwarf.
(output_die): Indicate whether a DIE was generated early
when generating assembly with -dA.
(struct limbo_die_struct): Document created_for field.
Remove file_table_last_lookup.
(remove_AT): Return TRUE if successful.
(remove_child_TAG): Clear die_parent.
(reparent_child): New function abstracted from...
(splice_child_die): ...here.
(new_die): ICE if a DIE ends up in limbo too late.
(check_die): New.
(defer_location): Remove.
(add_subscript_info): Reuse DW_TAG_subrange_type if available.
(fill_variable_array_bounds): New.
(decl_start_label): Call fill_variable_array_bounds.
(gen_formal_parameter_die): Rewrite to reuse previously generated
DIEs.
(gen_subprogram_die): Same.
(gen_variable_die): Same.
(gen_const_die): Same.
(gen_label_die): Same.
(gen_lexical_block_die): Same.
(decl_will_get_specification_p): New.
(local_function_static): New.
(gen_struct_or_union_type_die): Fill in variable-length fields.
(gen_typedef_die): Fill in variable-length typedefs.
(gen_tagged_type_die): Gracefully return on error_mark_node.
Handle re-entrancy.
(gen_type_die_with_usage): Handle variable-length types.
Remove duplicate code for ARRAY_TYPE case.
(process_scope_var): Only process imported modules during early
dwarf.
(dwarf2out_early_global_decl): New.
(dwarf2out_late_global_decl): Rename from dwarf2out_global_decl.
(dwarf2out_type_decl): Set early_dwarf while calling
dwarf2out_decl.
(dwarf2out_decl): Verify that we did not recreate a previously
generated DIE.
Do not return on DECL_EXTERNALs in VAR_DECLs.
Abstract some code to local_function_static.
(lookup_filename): Remove use of file_table_last_lookup.
Gracefully exit on missing file_name.
(dwarf2out_finish): Verify limbo list.
Remove deferred_locations_list use.
Move deferred_asm_name and limbo flushing to...
(dwarf2out_early_finish): ...here. New.
(dwarf2out_c_finalize): Remove set of deferred_location_list,
deferred_asm_name, and file_table_last_lookup.
* cgraph.h (referred_to_p): Add default argument.
* cgraphunit.c (referred_to_p): Add and handle include_self
argument.
(analyze_functions): Add first_time argument.
Call check_global_declaration for all symbols.
Call late_global_decl for nodes for moribund nodes.
(finalize_compilation_unit): Add new argument to
analyze_functions.
Call early_global_decl for functions.
Call early_finish debug hook.
* dbxout.c (dbxout_early_global_decl): New.
(dbxout_late_global_decl): New. Adapted from dbxout_global_decl.
(dbx_debug_hooks): Add new hooks.
(xcoff_debug_hooks): Same.
* debug.c (do_nothing_debug_hooks): Add early_finish field.
Add early and late debug hooks.
Remove global_decl hook.
* debug.h (struct gcc_debug_hooks): Add early_finish,
early_global_decl, and late_global_decl fields.
Remove global_decl field.
Document gcc_debug_hooks.
* gengtype.c (output_typename): Remove.
* godump.c (go_early_global_decl): New.
(go_late_global_decl): New.
(go_global_decl): Remove.
(dump_go_spec_init): Remove global_decl. Add
{early,late}_global_decl.
* langhooks-def.h (LANG_HOOKS_WRITE_GLOBALS): Remove.
(LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS): New.
* langhooks.c (lhd_warn_unused_global_decl): Adjust comment.
(write_global_declarations): Remove.
(global_decl_processing): New.
* langhooks.h (struct lang_hooks_for_decls): Remove
final_write_globals field.
Add post_compilation_parsing_cleanups field.
* passes.c (rest_of_decl_compilation): Call early_global_decl.
* sdbout.c: Add early and late_global_decl hooks. Remove
sdbout_global_decl hook.
Add early_finish field for sdb_debug_hooks.
(sdbout_global_decl): Remove.
(sdbout_early_global_decl): New.
(sdbout_late_global_decl): New.
* timevar.def (TV_PHASE_LATE_PARSING_CLEANUPS): New.
* toplev.c (check_global_declaration): Rename from
check_global_declaration_1.
Adapt to use symtab infrastructure.
(check_global_declarations): Remove.
(emit_debug_global_declarations): Remove.
(compile_file): Remove call to final_write_globals langhook.
Run the actual compilation process.
Perform any post compilation parser cleanups.
Generate late debug info.
* toplev.h (check_global_declaration): New.
(check_global_declaration_1): Remove.
(check_global_declarations): Remove.
(write_global_declarations): Remove.
(emit_debug_global_declarations): Remove.
(global_decl_processing): New.
* tree-core.h (struct tree_block): Add DIE field.
* tree.h (BLOCK_DIE): New.
* vmsdbgout.c (vmsdbgout_global_decl): Remove function and its use
throughout.
(vmsdbgout_early_global_decl): New.
(vmsdbgout_late_global_decl): New.
Add early_finish debug hook field to vmsdbg_debug_hooks.
Remove vmsdbgout_decl to vmsdbgout_function_decl.
Add early and late_global_decl debug hooks.
From-SVN: r224161
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a6a628d..c1b568b 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4389,6 +4389,8 @@ dump_tu (void) } } +static location_t locus_at_end_of_parsing; + /* Check the deallocation functions for CODE to see if we want to warn that only one was defined. */ @@ -4436,17 +4438,16 @@ maybe_warn_sized_delete () first, since that way we only need to reverse the decls once. */ void -cp_write_global_declarations (void) +c_parse_final_cleanups (void) { tree vars; bool reconsider; size_t i; - location_t locus; unsigned ssdf_count = 0; int retries = 0; tree decl; - locus = input_location; + locus_at_end_of_parsing = input_location; at_eof = 1; /* Bad parse errors. Just forget about it. */ @@ -4463,6 +4464,9 @@ cp_write_global_declarations (void) return; } + timevar_stop (TV_PHASE_PARSING); + timevar_start (TV_PHASE_DEFERRED); + symtab->process_same_body_aliases (); /* Handle -fdump-ada-spec[-slim] */ @@ -4478,8 +4482,6 @@ cp_write_global_declarations (void) /* FIXME - huh? was input_line -= 1;*/ - timevar_start (TV_PHASE_DEFERRED); - /* We now have to write out all the stuff we put off writing out. These include: @@ -4575,7 +4577,7 @@ cp_write_global_declarations (void) /* Set the line and file, so that it is obviously not from the source file. */ - input_location = locus; + input_location = locus_at_end_of_parsing; ssdf_body = start_static_storage_duration_function (ssdf_count); /* Make sure the back end knows about all the variables. */ @@ -4601,7 +4603,7 @@ cp_write_global_declarations (void) /* Finish up the static storage duration function for this round. */ - input_location = locus; + input_location = locus_at_end_of_parsing; finish_static_storage_duration_function (ssdf_body); /* All those initializations and finalizations might cause @@ -4609,7 +4611,7 @@ cp_write_global_declarations (void) instantiations, etc. */ reconsider = true; ssdf_count++; - /* ??? was: locus.line++; */ + /* ??? was: locus_at_end_of_parsing.line++; */ } /* Now do the same for thread_local variables. */ @@ -4752,7 +4754,7 @@ cp_write_global_declarations (void) (template_for_substitution (decl))))) { warning (0, "inline function %q+D used but never defined", decl); - /* Avoid a duplicate warning from check_global_declaration_1. */ + /* Avoid a duplicate warning from check_global_declaration. */ TREE_NO_WARNING (decl) = 1; } } @@ -4779,12 +4781,13 @@ cp_write_global_declarations (void) if (priority_info_map) splay_tree_foreach (priority_info_map, generate_ctor_and_dtor_functions_for_priority, - /*data=*/&locus); + /*data=*/&locus_at_end_of_parsing); else if (c_dialect_objc () && objc_static_init_needed_p ()) /* If this is obj-c++ and we need a static init, call generate_ctor_or_dtor_function. */ generate_ctor_or_dtor_function (/*constructor_p=*/true, - DEFAULT_INIT_PRIORITY, &locus); + DEFAULT_INIT_PRIORITY, + &locus_at_end_of_parsing); /* We're done with the splay-tree now. */ if (priority_info_map) @@ -4800,9 +4803,6 @@ cp_write_global_declarations (void) /* Generate Java hidden aliases. */ build_java_method_aliases (); - timevar_stop (TV_PHASE_DEFERRED); - timevar_start (TV_PHASE_OPT_GEN); - if (flag_vtable_verify) { vtv_recover_class_info (); @@ -4810,32 +4810,6 @@ cp_write_global_declarations (void) vtv_build_vtable_verify_fndecl (); } - symtab->finalize_compilation_unit (); - - if (flag_vtable_verify) - { - /* Generate the special constructor initialization function that - calls __VLTRegisterPairs, and give it a very high - initialization priority. This must be done after - finalize_compilation_unit so that we have accurate - information about which vtable will actually be emitted. */ - vtv_generate_init_routine (); - } - - timevar_stop (TV_PHASE_OPT_GEN); - timevar_start (TV_PHASE_CHECK_DBGINFO); - - /* Now, issue warnings about static, but not defined, functions, - etc., and emit debugging information. */ - walk_namespaces (wrapup_globals_for_namespace, /*data=*/&reconsider); - if (vec_safe_length (pending_statics) != 0) - { - check_global_declarations (pending_statics->address (), - pending_statics->length ()); - emit_debug_global_declarations (pending_statics->address (), - pending_statics->length ()); - } - perform_deferred_noexcept_checks (); finish_repo (); @@ -4849,13 +4823,37 @@ cp_write_global_declarations (void) dump_tree_statistics (); dump_time_statistics (); } - input_location = locus; + + timevar_stop (TV_PHASE_DEFERRED); + timevar_start (TV_PHASE_PARSING); +} + +/* Perform any post compilation-proper cleanups for the C++ front-end. + This should really go away. No front-end should need to do + anything past the compilation process. */ + +void +cxx_post_compilation_parsing_cleanups (void) +{ + timevar_start (TV_PHASE_LATE_PARSING_CLEANUPS); + + if (flag_vtable_verify) + { + /* Generate the special constructor initialization function that + calls __VLTRegisterPairs, and give it a very high + initialization priority. This must be done after + finalize_compilation_unit so that we have accurate + information about which vtable will actually be emitted. */ + vtv_generate_init_routine (); + } + + input_location = locus_at_end_of_parsing; #ifdef ENABLE_CHECKING validate_conversion_obstack (); #endif /* ENABLE_CHECKING */ - timevar_stop (TV_PHASE_CHECK_DBGINFO); + timevar_stop (TV_PHASE_LATE_PARSING_CLEANUPS); } /* FN is an OFFSET_REF, DOTSTAR_EXPR or MEMBER_REF indicating the |