Files
gcc/ChangeLog.modules
Nathan Sidwell a85bdfd1dd modules.c (trees_{in,out}::tree_binfo): Delete.
gcc/cp/
	* modules.c (trees_{in,out}::tree_binfo): Delete.
	(module_state::{read,write}_binfos): New.
	(module_state::{read,write}_class_def): Use them.

From-SVN: r259170
2018-04-06 13:18:31 +00:00

4355 lines
145 KiB
Plaintext

2018-04-06 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* modules.c (trees_{in,out}::tree_binfo): Delete.
(module_state::{read,write}_binfos): New.
(module_state::{read,write}_class_def): Use them.
2018-04-05 Nathan Sidwell <nathan@acm.org>
gcc/
* doc/invoke.texi (C++ Modules): New section.
gcc/c-family/
* c.opt (-fmodule-lazy): New option.
gcc/cp/
* module.c (module_state::read_decls): Prepare for laziness.
gcc/cp/
* module.c (module_state::tng_*): Rename.
gcc/cp/
* module.c (enum tree_tag): Delete tt_definition, tt_binding.
(trees_in::tag_{binding,definition}): Delete.
(trees_out::{,maybe_}tag_definition): Delete.
(trees_{in,out}::define_{function,var,class,enum}): Delete.
(trees_in::tree_node): Remove tt_definition handling.
(trees_in::read, trees_out::write): Delete.
gcc/cp/
* module.c (module_state::write_namespace): Delete.
(module_state::{write_bindings,read_bindings}): Likewise.
gcc/cp/
* module.c (TNG): Delete.
(module_state::{tng_read_bindings,write): Constant fold TNG.
(trees_out::tree_node, trees_in::finish_type): Likewise.
gcc/cp/
* module.c (refs_tng): Replace with TNG.
Switch over to new binding scheme.
gcc/cp/
* module.c (TNG): Enable.
gcc/cp/
* module.c (module_state::{read,write,mark}_template_def): Deal
with CLASSTYPE_DECL_LIST.
(trees_out::tree_node): Check implicit TEMPLATE_DECLs.
gcc/cp/
* module.c (trees_out::tree_node): Reorder by-name checks.
* name-lookup.c (pushdecl_top_level): Replace IS_FRIEND parm with
MAYBE_INIT. Set DECL_CONTEXT. Finish if requested.
(pushdecl_top_level_and_finish): Use pushdecl_top_level.
* name-lookup.h (pushdecl_top_leve): Adjust declaration.
2018-04-04 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (module_state::{read,write,mark}_template_def): New.
(module_state::{read_write_mark}_definition): Call them.
(depset::hash::add_dependency): Don't depend on no-context decls.
(trees_out::tree_node): Don't try and name no-context decls.
gcc/cp/
* module.c (module_state::{read,write}_class_def}): Fixup
vptr-containing logic.
(trees_in::tree_binfo): Forward walk.
gcc/cp/
* module.c (enum tree_tag): Replace tt_tinfo_pseudo with
tt_tinfo_typedef. Add tt_vtable.
(module_state::mark_class_def): Mark vtables.
(trees_out::tree_node): Move TINFO processing to decl section.
Replace tinfo_psuedo handling with tinfo_typedef handling. Add
vtable special.
(trees_in::tree_node): Likewise.
* rtti.c (struct tinfo_s): Note type is const qualified variant.
gcc/testsuite/
* g++.dg/aaa/class-3_d.C: Adjust message.
gcc/cp/
* module.c (module_state::read_definition): New.
(module_state::read_{function,var,class,enum}_def): New.
(module_state::tng_read_cluster): New.
(module_state::tng_read_bindings): Call it.
(trees_in::tree_node): Check refs_tng.
gcc/cp/
* module.c (module_state::write_var_def): Write definition.
gcc/cp/
* module.c (trees_out::mark_node): Allow preseeding.
(trees_out::tree_node): Fix as_base.
2018-04-03 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (tt_type_name, tt_named): Rename to ...
(tt_named_type, tt_named_decl): ... here. Adjust uses.
(module_state::mark_class_def): Mark fake base.
(module_state::write_class_def): Write fake base.
(trees_{in,out}::tree_node): Avoid goto again.
(trees_in::finish_type): Protect fake base serialize.
* Make-lang.in (version.o): Depend on cp dir.
gcc/testsuite/
* g++.dg/aaa/class-3_d.C: Adjust message.
gcc/cp/
* module.c (bytes_in::{use,i,u,wi,str}): Use set_overrun.
(module_state::tng_write_cluster): Sort cluster here ...
(module_state::tng_write_bindings): ... not here.
(module_state::tng_read_bindings): Set refs_tng.
(trees_{in,out}::define_class): Don't deal with refs_tng here.
(trees_out::tree_binfo): Protect from dep_walk_p. Force insert
new tag.
Reorder for better logging
gcc/cp/
* module.c (trees_{in,out}::core_vals): Stream name-like members
early.
(module_state::do_import): Set module purview before streaming.
* name-lookup.c (set_module_binding): Don't barf on null.
gcc/
* gdbinit.in: Add conditions on error catching breakpoints.
Fix enum types, more globals
gcc/cp/
* module.c (module_state::maybe_add_global): New.
(module_state::init): Use it.
(trees_{in,out}::core_vals): Special case TYPE of unscoped enum.
2018-04-02 Nathan Sidwell <nathan@acm.org>
Read new .bindings section
gcc/cp/
* module.c (elf::get_num_sections): New.
(module_state::tng_{read,write}_namespaces): Serialize section range.
(module_state::tng_read_bindings): New.
(module_State::tng_{read,write}_bindings): Adjust.
(trees_in::define_enum, trees_in::tag_binding): Adjust.
* name-lookup.h (push_module_binding): Rename to ...
(set_module_binding): ... here.
(import_module_binding): Declare.
* name-lookup.c (import_module_binding): New.
(push_module_binding): Rename to ...
(set_module_binding): ... here. Adjust.
Kill old .bindings section
gcc/cp/
* module.c (module_state::record_namespace): Delete.
(module_state::write_namespace): Remove bind parm. Adjust.
(module_state::read_namespace): Delete.
(module_state::tng_read_namespaces): New.
(module_state::write_bindings): Don't write bindings section.
(module_state::read_bindings): Use tng_read_bindings).
* name-lookup.c (make_namepace): Public namespaces are exported.
(push_namespace): Adjust.
gcc/cp/
* module.c (trees_{in,out}::define_class): Check refs_tng.
(trees_out::tree_binfo): Add definition dependency.
(trees_{in,out}::tree_node): Don't write binfos in refs_tng mode.
(trees_in::finish_type): Chek refs_tng.
gcc/cp/
* module.c (trees_{in,out}::tree_binfo): Serialize entire path.
(trees_{in,out}::tree_node): Adjust.
2018-03-30 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (has_definition): VAR_DECLs too.
{module_state::mark_{,function_,var_,class_,enum_}definition): New.
(trees_out::walk_into): Turn into ...
(trees_out::mark_node): ... this. Adjust callers.
(module_state::write{_function_,class_,var_}_def): Define.
(module_state::find_dependencies): Look in definitions.
2018-03-28 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (maybe_get_template): New.
(depset::hash::maybe_add_definition): Return a depset.
(depset::hash::add_dependency): Don't deal with template here.
(module_state::write_{function,class}): New stubs.
(module_state::write_enum): New.
(module_state::write_definition): New.
(module_state::tng_write_cluster): Write binding header.
(module_state::add_writables): Don't return a bool. No need to
nadger namespace ownership.
(module_state::find_dependencies): Adjust.
(bind_cmp, space_cmp): New.
(ns_cmp): Delete.
(module_state::tng_write_bindings): Sort here.
(trees_out::tree_node): Check dependency of containers.
(module_purview_p): Defend against early checks.
* name-lookup.c (extract_module_decls): Don't special-case
namespaces.
(push_namespace): Set EXPORT & OWNER inside a module.
gcc/testsuite/
* g++.dg/modules/namespace-2.C: Adjust.
* g++.dg/modules/namespace-3.C: New.
* g++.dg/modules/scc-1.C: Adjust.
* g++.dg/modules/scc-2.C: New.
2018-03-27 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c
(depset::hash::{add_writables,find_dependencies}): Moved to ...
(module_state::{add_writables,find_dependencies}): ... here. Adjust.
(depset::hash::write_bindings): Moved to ...
(module_state::tng_write_bindings): ... here. Adjust.
(depset::hash::{add_decls,get_work}): New.
gcc/cp/
* module.c (hash_definition): New.
(struct depset::tarjan): New.
(depset::tarjan_connect, depset::hash::find_sccs): Delete.
(depset::hash::maybe_add_definition): New.
(module_state::tng_write_namespaces): New.
(depset::hash::{maybe_namespace,write_namespaces): Delete.
(module_state::tng_write_bindings): Adjust.
gcc/cp/
* module.c (depset::traits): Hash & compare using name too.
gcc/cp
* module.c (refs_tng): Temporary modal hack.
(tree_tag): Rename tt_import to tt_named.
(module_state::write_cluster): Fix iteration.
(module_state::tng_write_bindings): Set and clear refs_tng.
(trees_out::tree_node): Refs by name when applicable.
(trees_out::tree_node): Use tt_named.
gcc/testsuite/
* g++.dg/modules/by-name-1.C: New.
* g++.dg/modules/class-3_b.C: Adjust.
* g++.dg/modules/scc-1.C: More checking.
2018-03-26 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (depset::table): Rename to ...
(depset::hash): ... here.
(trees_out::deps_only): Rename to ...
(trees_out::dep_walk_p): ... here.
gcc/cp/
* module.c (depset::table::find_exports): Renamed ...
(depset::table::add_writables): .. here. Return bool, add
exported namespaces.
(depset::table::append): Add namespaces to worklist.
(mdule_state::write_namespace): Use TREE_PUBLIC.
* name-lookup.c (extract_module_decls): Only extract decls in our
purview.
(make_namespace): Remove FIXME.
(push_namespace): Set MODULE_OWNER if exporting.
gcc/testsuite/
* g++.dg/modules/namespace-2.C: New.
gcc/testsuite/
* lib/scanlang.exp (scan-lang-dump-not): new.
gcc/cp/
* module.c (depset::visited): Use depset::cluster. Adjust users.
gcc/cp/
* module.c (elf_out::strtab::named_decl): Cope with TYPE constext.
(elf_out::strtab::write_named_decl): Likewise.
(module_state::write_cluster): Adjust dump.
(fixup_unscoped_enum_owner): New.
* decl.c (finish_enum_value_list): Call
fixup_unscoped_enum_owner, as necessary.
* cp-tree.h (fixup_unscoped_enum_owner): Declare.
gcc/testsuite/
* g++.dg/modules/scc-1.C: New.
gcc/cp/
* module.c (elf_out::strtab): Add name-by-decl.
(module_state::write_cluster): Find naming decl, and use it.
gcc/cp/
* module.c (class depset): Make a class, add accessors. Implicitly
hold name as first decl.
(depset::table::{maybe_insert,find}): New.
(depset::table::{append,find_exports,find_dependencies}): Adjust.
(depset::table::{write_bindings,write_namespaces}): Adjust.
(module_state::write_cluster): Adjust.
Add depset analysis (incomplete)
gcc/cp/
* module.c (struct depset): New.
(module_state::tng_write_bindings, write_cluster): New.
(trees_out::{decls,mark_decls,mark_trees,unmark_trees): New.
(trees_out::{begin,end,walk_into,force_insert): New.
(module_state::write): Call tng_write_bindings.
(trees_out::{core_vals,lang_decl_vals,lang_type_vals,tree_node_raw,
tree_node): Deal with deps_only.
2018-03-23 Nathan Sidwell <nathan@acm.org>
Allow dump '-'
gcc/
* dumpfile.c (dump_open): New. Allow '-' for stdout.
(dump_open_alternate_stream, dump_start, dump_begin): Call it.
(dump_finish): Identify std{out,err} by stream.
* doc/invoke.texi (fdump-rtl): Document stdout/stderr.
2018-03-16 Nathan Sidwell <nathan@acm.org>
Remove -fmodules, forcing -fmodules-{ts,atom}
gcc/cp/
* parser.c (cp_parser_diagnose_invalid_type_name): Adjust error.
gcc/c-family/
* c.opt (fmodules): Remove.
gcc/
* doc/invoke (fmodules): Remove.
gcc/testsuite/
* g++.dg/modules/modules.exp: Iterate over -fmodules-{ts,atom}.
* g++.dg/modules: Mark tests that are -fmodules-ts only.
2018-03-15 Nathan Sidwell <nathan@acm.org>
Implement Atom module & import placement
gcc/
* doc/invoke.texi (-fmodules): Document -fmodules-atom.
gcc/c-family/
* c.opt (fmodules-atom): Renamed from fmodules++.
gcc/cp/
* cp-tree.h (import_module): Add parameter.
* module.c (import_module): Add exporting param.
(handle_module_option): Adjust.
* parser.c (cp_parser_module_declaration): Remove fmodules++
global module parsing.
(cp_parser_import_declaration): Adjust.
(cp_parser_declaration_seq_opt): Parse imports under -fmodules++ ...
(cp_parser_declaration): and not here.
gcc/testsuite/
* g++.dg/modules/mod++-decl-0_[abc].C: Adjust.
* g++.dg/modules/mod++-decl-2.C: Adjust.
* g++.dg/modules/mod++-decl-3.C: New.
Implement p0713 - identifiying module source
gcc/cp/
* parser.c (cp_parser_module_declaration): Allow global module
preamble. Return bool.
(cp_parser_declaration_seq_opt): Adjust.
gcc/testsuite/
* g++.dg/modules/circ-1_d.C: Adjust.
* g++.dg/modules/global-1_a.C: Adjust.
* g++.dg/modules/main-[123]-aux.cc: Adjust.
* g++.dg/modules/main-aux.cc: Adjust.
* g++.dg/modules/mod-decl-[13].C: Adjust.
* g++.dg/modules/mod-decl-5_b.C: Adjust.
* g++.dg/modules/mod-exp-1_b.C: Adjust.
* g++.dg/modules/mod-sym-2.C: Adjust.
* g++.dg/modules/proclaim-1.C: Adjust.
* g++.dg/modules/static-1_a.C: Adjust.
* g++.dg/modules/p0713-[123].C: New: Adjust.
2018-03-01 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (add_module_mapping): Fix double increment.
2018-02-28 Nathan Sidwell <nathan@acm.org>
Merge trunk r258084.
gcc/
* Makefile.in (REVISION_c): Don't exec REVISION.
* REVISION: Simple text file.
gcc/cp/
* Make-lang.in (MODULE_STAMP): New var.
(REVISION_s): Wedge stamp into it here.
(CFLAGS-cp/module.o): Adjust.
Using flags on overloads.
gcc/cp/
* cp-tree.h (OVL_HAS_USING_P): New.
* tree.c (alloc_ovl): New, broken out of ...
(ovl_make): ... this. Use it. Maybe set OVL_HAS_USING_P.
(ovl_copy): Use alloc_ovl. Copy OVL_HAS_USING_P.
(ovl_insert): Set OVL_HAS_USING_P appropriately.
(lookup_maybe_add): Comment on OVL_HAS_USING_P.
* name-lookup.c (name_lookup::add_overload)
(get_class_binding_direct): Check OVL_HAS_USING_P.
gcc/testsuite/
* g++.dg/lookup/using60.C: New.
gcc/
* Makefile.in: Exec REVISION maybe.
* REVISION: New.
gcc/cp/
* Make-lang.in: Directly set MODULE_STAMP.
Map tag recognised in and out of comments
gcc/cp/
* module.c
gcc/testsuite/
* g++.dg/modules/hello.cc: Clone to ...
* g++.dg/modules/main{,-[123]}-aux.cc: ... here.
* g++.dg/modules/main-[123]_a.C: New.
* g++.dg/modules/main-[123]-map: New.
* g++.dg/modules/main-map: Delete.
* g++.dg/modules/main_a.C: Update.
2018-02-27 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (version_string): Rename.
(module_state::write_context): Write compiler version.
2018-02-16 Nathan Sidwell <nathan@acm.org>
Use TREE_VISITED
gcc/cp/
* module.c (trees_out::fixed_refs): New.
(trees_out::{begin,end}): New.
(module_state::init): Use TREE_VISITED.
(trees_out::{maybe_insert,tree_node}): Likewise.
gcc/cp/
* module.c: More commenting.
(trees_{in,out}::define_class): Don't do AsBase here.
(trees_in::finish_type, trees_out::tree_node}: Do it here.
(get_module_owner): Cleanup.
2018-02-15 Nathan Sidwell <nathan@acm.org>
Module ownership on containers
gcc/cp/
* cp-tree.h (decl_set_module, module_context): Delete.
(get_module_owner, set_module_owner)
(set_implicit_module_owner): Declare.
* decl.c (grokfndecl, grokvardecl, grokdeclarator): Call
set_module_owner.
* error.c (dump_module_suffix): Use get_module_owner.
* mangle.c (maybe_write_module): Likewise.
* method.c (implicitly_declare_fn): Use set_implicit_module_owner.
* module.c (module_context, decl_set_module): Delete.
(trees_in::define_function): Adjust.
(trees_{in,out}::lang_decl_bools): Set module_owner.
(trees_{in,out}::tree_node_raw): Adjust.
(trees_out::tree_node): Adjust.
(get_module_owner, set_module_owner)
(set_implicit_module_owner): Define.
* name-lookup.c (do_pushtag): Use set_module_owner.
* pt.c (lookup_template_class_1, instanitate_decl): Use
set_implicit_module_owner.
gcc/cp/
* module.c (trees_out::tree_node): Reorder.
gcc/cp/
* module.c: Commenting and a few cleanups.
gcc/cp/
* module.c (elf): Make more constants private.
(elf_in::find): Swap args, default to PROGBITS.
(elf_out::add): Replace type and flags with string_p arg.
(bytes_in::begin, bytes_out::end): Adjust.
(data::set_crc): Store zero for no-crc.
Module map files have more syntax
gcc/cp/
* cxx-module-wrapper.sh: Accept src filename, don't search
MODULE_PATH.
* module.c (module_state::srcname): New.
(module_state::print_map): New.
(make_module_name): Rename to ...
(make_module_filename): ... here. Don't assume trailing NUL.
(find_module_file): Pass srcname.
(parse_module_mapping): New.
(add_module_mapping): Call it. Detect too-deeply nested.
gcc/c-family/
* c.opt (fmodule-map-dump): New.
gcc/
doc/invoke.texi: Document new module-map file syntax
gcc/testsuite/
* g++.dg/modules/hello.c: Adjust.
* g++.dg/modules/main_a.c: Adjust.
* g++.dg/modules/main-map: New.
* g++.dg/modules/modules.exp: Set CXX_MODULE_PATH.
2018-02-13 Nathan Sidwell <nathan@acm.org>
Module path is for mapping files. Replace -fmodule-root with
-fmodule-prefix.
gcc/cp/
* cxx-module-wrapper.sh: Adjust.
* module.c (module_state::lazy_{init,fini}): Drop the lazy.
(module_state::maybe_early_init): Move into init.
(module_prefix, module_file_args, module_wrapper): New.
(make_module_name): New.
(module_state::occupy): Call it.
(module_to_filename): Delete.
(search_module_path): Adjust for finding module-maps.
(find_module_file): New.
(add_module_mapping): Reimplement.
(init_module_processing): Process module_file_args array.
(module_state::do_import, finish_module): Adjust.
(maybe_prepend_dir): Delete.
(handle_module_option): Adjust.
gcc/c-family/
* c-opts.c (c_common_post_options): Adjust clean_cxx_module_path
call.
* c.opt (fmodule-root=): Delete.
(fmodule-prefix=): New.
gcc/
* doc/invoke.texi (fmodule-root): Replace with ...
(fmodule-prefix): ... this.
* incpath.c (clean_cxx_module_path): Drop root appending. Drop
multilib handling.
* incpath.h (clean_cxx_module_path): Adjust.
gcc/testsuite/
* g++.dg/modules/fmod-file-1_b.C: Adjust.
* g++.dg/modules/main_a.C: Adjust.
* g++.dg/modules/modules.exp: Adjust.
2018-02-12 Nathan Sidwell <nathan@acm.org>
AS_BASE is by reference.
gcc/cp/
* module.c (trees_out::define_class): Break AS_BASE loop during
streaming.
(trees_{in,out}::tree_node): Use tt_as_base.
Mapping files are recursive.
gcc/cp/
* module.c (maybe_prepend_dir): New.
(add_module_mapping): Recurse. Deal with relative paths.
(handle_module_option): Move file reading into add_module_mapping.
gcc/
* doc/invoke.texi (fmodule-file): Document.
BINFOs imported by reference.
gcc/cp/
* module.c (trees_{in_out}::tree_binfo): New.
(trees_out::maybe_insert): New.
(trees_out::insert): Use it.
(trees_{in,out}::define_class): Stream remaining binfo contents.
(trees_{in,out}::start): Don't expect BINFOs.
(trees_{in,out}::core_vals): Likewise.
(trees_{in,out}::tree_node): Use tt_binfo.
(trees_out::tree_node): Stream a class's child binfos.
(trees_in::finish_type): Likewise.
2018-02-11 Nathan Sidwell <nathan@acm.org>
Add module map file reading.
gcc/cp/
* module.c (add_module_mapping): New, swallow ...
(add_module_file): ... insertion bits. Move other bits to ...
(handle_module_option): ... here. Read module map file.
gcc/c-family/
* c.opt (fmodule-file): Document new semantics.
gcc/
* doc/invoke.texi (fmodule-file): Document new semantics.
gcc/testsuite/
* g++.dg/modules/fmod-file-1_[ab].C: New.
* g++.dg/modules/fmod-out-1_[ab].C: New.
* g++.dg/modules/modules.exp (decode_mod_spec): Augment.
Keep module-file map in module hash.
gcc/cp/
* module.c (module_state): Add empty_p, get_module members.
Rename set_name, delete set_location.
(module_file_map, module_file): Delete.
(module_state::do_import): Use get_module, set filename here.
(declare_module): No need to set filename here.
(add_module_file): Use module_state::get_module.
Move module option processing into module.c.
gcc/cp/
* cp-objcp-common.c (add_module_file): Move to module.c
(cp_handle_option): Call handle_module_option.
* cp-tree.h (module_output, module_files_map, module_files): Move
to module.c
* module.c (module_state::maybe_early_init): New.
(module_output, module_files): Make static.
(module_files_map): From cp-tree.h.
(init_module_processing): Call maybe_early_init.
(add_module): Moved from cp-objcp-common.c.
(handle_module_option): New.
Move module option processing out of c-common.c.
gcc/c-family/
* c-common.h (module_output, module_files_map, module_files): Move
to cp-tree.h.
* c-common.c (module_output, module_files): Move to module.c
* c-opts.c (add_module_file): Move to cp-objcp-common.c.
(c_common_handle_option): Move modules options to
cp-objcp-common.c.
gcc/cp/
* cp-objcp-common.c (add_module_file): Moved from c-opts.c.
(cp_handle_option): New, from c_common_handle_option.
* cp-objcp-common.h (LANG_HOOKS_HANDLE_OPTION): Point at
cp_handle_option.
* cp-tree.h (module_output, module_files_map, module_files): Moved
from c-common.h.
* cp-module.c (module_output, module_files): Moved from c-common.c.
2018-02-09 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c: Update more comments.
gcc/cp/
* module.c: Update a lot of comments.
2018-02-07 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (trees_in::tree_node): Absorb ...
(trees_in::tree_node_special): ... this.
gcc/cp/
* module.c (trees_in::tree_node_special): Deserialize tt_node here ...
(trees_in::tree_node): ... not here.
2018-02-06 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (trees_out::tree_node_special): Move into tree_node.
gcc/cp/
* module.c (trees_{in,out}::core_vals): Serialize decl name &
context here.
(trees_in::tree_node_raw): Don't set name & context here.
(trees_{in,out}::tree_node): Don't serialize decl name and context
here.
Remove old import machinery.
gcc/cp/
* module.c (trees_in::tree_node_raw): Set module owner.
(trees_{in,out}::tree_node): Remove importing here.
Imports use special tags
gcc/cp/
* module.c (module_context): Cope with C++ anon types.
(trees_{in,out}::tree_node_special): Deal with imports here ...
(trees_{in,out}::tree_node): ... not here.
gcc/testsuite/
* g++.dg/modules/class-3_[bd].C: Adjust.
Kill namespace module slot hackery
gcc/cp/
* name-lookup.c (module_binding_slot): Make CREATE a bool. Remove
namespace hackery.
(find_namespace_partition): Delete.
(merge_global_decl): Do not expect a namespace. Remove such
handling.
(push_module_binding): Likewise.
Namespaces use special tags
gcc/cp/
* module.c (trees_{in,out}::tree_node_special): Deal with
namespaces.
* name-lookup.h (find_imported_namespace): Declare.
* name-lookup.c (find_imported_namespace): New.
Less implicit tree numbering, negative indices for back refs
gcc/cp/
* module.c (ptr_uint_traits, ptr_uint_hash_map): Rename ...
(ptr_int_traits, ptr_int_hash_map): ... here. Map to ints.
(uint_ptr_traits, uint_ptr_hash_map): Delete.
(enum record_tag): Delete.
(enum tree_tag): New.
(trees_{in,out}::insert): Return int.
(trees_{in,out}::tree_node_special): Adjust.
(trees_{in,out}::tree_node): Adjust.
(trees_out::write, trees_in::read): Adjust.
gcc/testsuite/
* g++.dg/modules/class-3_[bd].C: Adjust.
2018-02-05 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* decl2 (c_parse_final_cleanups): Only finish_module if we started
it.
* module.c (module_hash_state): Move earlier.
(module_state): Add hash and modules static members.
(module_state::set_import): Replace do_import.
(module_state::lazy_init): Create the hash table and default
module.
(trees_in::tree_node_raw): Don't remap a public namespace.
(module_purview_p, module_interface_p): Adjust.
(module_state::do_import): Move more stuff to lazy_init.
(import_module): Deal with setting current module flags.
(finish_module): Adjust.
Fix bootstrap
gcc/cp/
* module.c (elf): Clean up consts.
(module_state::record_namespace): Comment args.
(module_state::read_namespace): Comment unused vars.
(trees_in::finish_tree): Fix logic error.
(trees_in::tree_node_special): Fix undefined var.
2018-02-04 Nathan Sidwell <nathan@acm.org>
Module purview is implicit.
gcc/cp/
* cp-tree.h (lang_decl): Remove module_purview_p field.
* mangle.c (maybe_write_module): Fix signed/unsigned mismatch.
* module.c (trees_in::finish): Adjust.
(trees{in,out}::lang_decl_bools): Drom module_purview_p field.
(decl_set_module): Done set DECL_MODULE_PURVIEW_P.
* name-lookup.c (extract_module_decls): check MODULE_PURVIEW_P.
(make_namespace_finish): Remove inline_p arg. Adjust callers.
* pt.c (build_template_decl): Don't copy MODULE_PURVIEW_P.
* rtti.c (tinfo_base_init): Don't clear MODULE_PURVIEW_P.
gcc/cp/
* name-lookup.c (make_namespace_finish): Always create the scope.
(add_imported_namespace): Check namespace inlineness here.
gcc/cp/
* module.c (decl_set_module): Set DECL_MODULE_OWNER.
* rtti.c (tinfo_base_init): Clear DECL_MODULE_OWNER.
gcc/cp/
* decl.c (grokfndecl): Protect decl_set_module call.
* name-lookup,c (do_pushtag): Likewise.
* module.c (decl_set_module): Assert namespace context.
2018-02-03 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h: Adjust comments.
* module.c (module_purview_p, module_interface_p): Adjust.
Deserializing uses an array (Nathan is a dumbass)
gcc/cp/
* module.c (trees_in): Delete count and tree_map. Add back_refs.
(trees_in::next): Delete.
(trees_in::insert): Append to array.
(trees_in::tree_node_special): Adjust.
(trees_in::tree_node): Likewise.
2018-02-02 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (nodel_ptr_hash): New.
(non_null_hash): Delete.
(ptr_uint_traits, uint_ptr_traits): Adjust.
(module_state_hash): Use nodel_ptr_hash.
(module_hash): Do not GTY.
(module_state::do_import, finish_module): Adjust.
Use TREE_VEC for structured module names.
gcc/cp/
* cp-tree.h (module_name_parts): Replace with ...
(module_vec_name): ... this.
* mangle.c (maybe_write_modules): Adjust.
* module.c (module_state): Replace name_parts with vec_name.
(module_state::set_name): Add maybe_vec parm, construct TREE_VEC.
(module_vec_name): Replace ...
(module_name_parts): ... this.
(module_state::do_import): Construct flat name.
* parser.c (cp_parser_module_name): Construct TREE_VEC.
gcc/testsuite/
* g++.dg/modules/mod-decl-1.C: Add error.
MODULE_PURVIEW bug fixing.
gcc/cp/
* decl2.c (c_parse_final_cleanups): Reset current_module.
* module.c (module_state::do_import): New, swallow ...
(do_module_import): ... this. Update callers.
* name-lookup.c (name_lookup::search_namespace_only): Fix search
of SLOT_CURRENT.
(do_pushdecl): Fix assert.
(merge_global_decl, push_module_binding, lookup_by_ident): Fix
module remap thinko.
Module purview has MODULE_PURVIEW number.
gcc/cp/
* module.c (module_state::read): Use MODULE_PURVIEW.
(trees_{in,out}::tree_node): Adjust.
(do_module_import, import_module): Likewise.
* name-lookup.c (module_binding_slot): Adjust.
(do_pushdecl): Always push to MODULE_SLOT_CURRENT.
(merge_global_decl): Remap MODULE_PURVIEW.
(lookup_by_ident, add_imported_namespace): Likewise.
Rename MODULE_INDEX->MODULE_OWNER
gcc/cp/
* cp-tree.h (MODULE_NONE, MODULE_PURVIEW, MODULE_IMPORT_BASE)
(MODULE_LIMIT): New, renamed from MODULE_INDEX_$FOO.
(DECL_MODULE_OWNER): New, renamed from DECL_MODULE_INDEX.
(MAYBE_DECL_MODULE_OWNER): Likewise.
(struct lang_decl_base): Rename module_index to module_owner.
* error.c, mangle.c, module.c, name-lookup.c, pt.c: Adjust.
Keep namespaces on global slot.
gcc/cp/
* cp-tree.h (MODULE_SLOT_CURRENT, MODULE_SLOT_GLOBAL): Renamed
from MODULE_SLOT_TU, MODULE_SLOT_GLOBALS.
* name-lookup.h (set_module_namespace): Undeclare.
(add_imported_namespace): Declare.
* name-lookup.c (module_binding_slot): Remove assert, propagate
external namespace to GLOBAL slot on creation.
(update_binding): Don't add namespaces to level.
(reuse_namespace): New.
(make_namespace): New, absorb ...
(create_namespace): ... this. Delete.
(make_namespace_finish): New.
(push_namespace): Adjust.
(add_imported_namespace): New. Absorb ...
(set_module_namespace): ... this. Delete.
* module.c (module_state::read_namespace): Adjust.
gcc/testsuite/
* g++.dg/modules/namespace-1_[abc].C: New.
Fix circularity detection, and other errors
gcc/cp/
* module.c (elf::E_BAD_DATA, elf::E_BAD_IMPORT): New.
(elf::set_error): Default to E_BAD_DATA.
(elf::end, elf_out::end): Return error string.
(module_state::set_location): New.
(module_state::{push,pop}_location): Adjust.
(do_module_import): Fixup circularity and other errors.
(declare_module, finish_module): Adjust.
gcc/testsuite/
* g++.dg/modules/circ-1_[abcd].C: New.
* g++.dg/modules/mod-decl-1.C: Adjust errors.
* g++.dg/modules/mod-decl-2_b.C: Adjust errors.
* g++.dg/modules/mod-decl-5_b.C: Adjust errors.
* g++.dg/modules/mod-stamp-1-d.C: Adjust errors.
2018-02-01 Nathan Sidwell <nathan@acm.org>
Alloc a slot for global module
gcc/cp/
* cp-tree.h (MODULE_INDEX_NONE, MODULE_INDEX_PURVIEW): New.
(MODULE_SLOT_TU, MODULE_SLOT_GLOBALS): New.
(MODULE_INDEX_IMPORT_BASE): Increment.
* module.c (do_module_import): Push reserved slot.
* name-lookup.c (module_binding_slot): Reserve slots below
MODULE_INDEX_IMPORT_BASE.
Bindings point to decls
gcc/cp/
* module.c (data::check_crc): Only check.
(data::get_crc): New.
(elf_in::find): Return section index.
(bytes_in::begin): Add by-section-number variant.
(module_state): Add lazy counter (unused).
(module_state::write_bindings): Emit decl section number.
(module_state::read_bindings): Adjust, swallow ...
(module_state::read_decls): ... this. Delete.
Read and parse the binding section in module_state.
gcc/cp/
* module.c (modules_state::record_namespace): New.
(module_state::write_namespace): Adjust, renamed from ...
(module_state::walk_namespace): ... here.
(module_state::read_namespace): New.
(module_state::{read,write}_bindings): Adjust.
(module_state::finish_module): Adjust.
* name-lookup.h (set_module_namespace): Declare.
* name-lookup.c (merge_global_decl): Adjust.
(create_namespace): New.
(set_module_namespace): New, use it.
(push_namespace): Use create_namespace.
Write binding section in module_state.
gcc/cp/
* name-lookup.h (extract_module_decls): Renamed from
extract_module_bindings. Adjust signature.
* name-lookup.c (extract_module_decls): Likewise.
* module.c (module_state::walk_namespace): New, absorb ...
(trees_out::walk_namespace): ... this. Delete.
(trees_out::write): Reimplement, absorb ...
(trees_out::{tag_binding,bindings}): ... these. Delete.
(module_state::write_bindings): Adjust.
Merge trunk r257292.
2018-01-31 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (cpms_{in,out}): Rename to ...
(trees_in, trees_out): ... here.
gcc/cp/
* module.c (module_state::global_{trees,vec,crc}): New, moved from ...
(globals{,_arys,_crc}): ... these globale scope vars.
(cpms_in): Add global_vec member.
Derive cpm_{in,out} from bytes_{in,out}
gcc/cp/
* module.c (cpms_{in,out}): Derive from bytes_{in,out}. Adjust
all uses of r & w.
Kill cpm_stream.
gcc/cp/
* module.c (class cpm_stream): Delete.
(class cpms_{in,out}): Adjust.
Move elf out of cpms_in, cpms_out.
gcc/cp/
* module.c (module_state::{read,write}_bindings): New.
(module_stste::read_decls): New.
(cpms_{in,out}::get_elf): Delete.
(cpms_out::{write,bindings}): Adjust.
(cpms_in::read): Adjust.
Add module_stat read & write
gcc/cp/
* module.c (module_state::{read,write}): New.
(cpms_in::read): Adjust.
(do_import_module, finish_module): Adjust.
gcc/cp/
* module.c: Move cpm_stream, cpms_in, cpms_out earlier.
Move some reading to module_state.
gcc/cp/
* module.c (module_state::read_{context,config}): New, swallow ...
(cpms_in::imports,header): ... these. Delete.
(cpms_in::read): Adjust.
(do_import_module): Adjust.
Move some writing to module_state.
gcc/cp/
* module.c (module_state::write_{context,config}): New, swallow ...
(cpms_out::imports,header): ... these. Delete.
(cpms_out::write): Adjust.
(finish_module): Adjust.
Move global tree init.
gcc/cp/
* module.c (module_state::lazy_init): New, swallow ...
(cpm_serial::lazy_globals): ... this. Adjust callers.
Reorder class declarations
gcc/cp/
* module.c (bytes, bytes_in, bytes_out): Move before module_state.
Simplify import interface
gcc/cp/
* module.c (MODULE_INDEX_IMPORTING, MODULE_INDEX_ERROR): Delete.
(MODULE_INDEX_UNKNOWN): New.
(module_state): Initialize mod to MODULE_INDEX_UNKNOWN.
(cpms_in::read): Return void.
(do_module_import): Return pointer to module object.
(cpms_in::imports): Adjust.
(import_module, declare_module, finish_module): Adjust.
Module_state owns elf and elf owns stream
gcc/cp/
* module.c (elf): Add begin, end members.
(elf_in, elf_out): Adjust.
(module_state::announce): New.
(cpms_{in,out}::get_elf): Adjust.
(cpms_{in,out}::{begin,end}): Delete.
(do_module_import, finish_module): Adjust.
Commonize module location
gcc/cp/
* module.c (module_state::{push,pop}_location): Set and restore
input_location.
(make_module_file): Lose module_root prepending.
(do_module_import): Always set module location.
(declare_module): Create location and filename.
(finish_module): Adjust.
Staticize instrumentation
gcc/cp/
* module.c (bytes_out): Staticize spans, lengths, is_set.
(bytes_out::instrument): Make static.
(cpms_out): Staticize unique, refs, nulls, records.
(cpms_out::instrument): Make static. Adjust.
Separate dumper object
gcc/cp/
* cp-tree.h (dump, print_other_binding_stack): Undeclare.
* name-lookup.c (print_other_binding_stack): Make static.
* module.c (class dumper): New.
(cpm_serial): Remove dumping machinery here. Adjust all uses.
gcc/testsuite/
* g++.dg/modules/mod-imp-1_[abcd].C: Adjust dump scans.
Start refactoring cpm_serial
gcc/cp/
* module.c (cpms_{in,out}::elf): Pointer to elf object,
(cpms_{in,out}::get_elf): New. Use it.
(do_module_import, finish_module): Adjust.
2018-01-30 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (data::release): Return NULL, update users.
(cpms_in::{mod_ix,crc}): Delete, adjust users.
Reorder source
gcc/cp/
* module.c (struct data): First.
(class elf, elf_in & elf_out): Next.
gcc/cp/
* module.c (module_state): Remove name_hash, crc_known, set_crc,
set_location.
(cpms_in::{read,header}): Add crc_ptr arg.
(do_module_import): Expected CRC is a pointer.
(cpms_in::imports): Adjust.
Push remaps as they happen.
gcc/cp/
* module.c (cpms_{in,out}::imports): Write in ascending order.
Move remap vector into module state.
gcc/cp/
* module.c (module_state): Add remap;
(cpms_in): Remove remap_num, remap_vec.
(module_state::release): New.
(cpms_in::{imports,tree_node,read}): Adjust.
(finish_module): Release module state.
gcc/cp/
* module.c (bytes_out::end): Create PROGBITS or STRTAB.
(cpms_out::write): README is a STRTAB.
Remove SYMTAB knowledge, the README is better.
gcc/cp/
* module.c (elf_out::symtab): Delete.
(elf_out::end): Adjust.
(cpms_out::imports): Don't create symtab.
Section structure completish.
gcc/cp/
* module.c (elf::isection): Add flags.
(elf_out::add): Add section flags.
(bytes_out::end): Likewise,
(elf_out::end): Adjust.
(cpms_out::bindings): Generate bindings section too.
(cpms_out::write): Add imports to README. Make string section.
(cpms_in::read): Adjust.
Config in header
gcc/cp/
* module.c (cpms_{in,out}::tag_conf): Delete.
(cpms_{in,out}::header): Serialize host & target conf.
(cpms_in::read, cpms_out::write): Adjust.
Globals in header
gcc/cp/
* module.c (module_state::set_name): Kill string names.
(cpms_{in,out}::tag_globals): Delete.
(cpms_{in,out}::header): Do globals. Add outer crc.
(cpms_in::read): Absorb cpms_in::read_item.
(search_module_path, do_module_import): Kill string names.
2018-01-29 Nathan Sidwell <nathan@acm.org>
Import table is separate section
gcc/cp/
* module.c (bytes): Reorganize CRC calcs.
(struct elf::symbol): New.
(struct elf_out::symtab): New.
(elf_out::end): Deal with symbol table.
(bytes_{in,out}::{begin,end}): Adjust crc calcs.
(cpms_{in,out}::imports): New.
(cpms_{in,out}::tag_import): Delete.
(cpms_in::read, cpms_out::write): Adjust.
Header is separate section
gcc/cp/
* module.c (module_state_hash::equal): Remove string names.
(elf_in::find): Find by name.
(elf_in::name): New.
(class elf_out::strtab): Rename type.
(elf_out::strings): New member.
(elf_in::begin): Veriy string table. Create default.
(elf_out::end): Write string table here.
(bytes_in::begin, bytes_out::end): Always PROGBITS.
(cpm_stream::rt_eof): Delete.
(cpms_{in,out}::header): Reimplement.
(cpms_in::read, cpms_out::write): Adjust.
Remove string-literal module names :(
gcc/cp/
* cp-tree.h (validate_module_name): Remove.
* module.c (validate_module_name): Delete.
(bytes_{in,out}::module_name): Delete, adjust callers.
* parser.c (cp_parser_module_name): Adjust.
(cp_parser_module_declaration, cp_parser_import_declaration)
(cp_parser_module_proclamation): Adjust.
gcc/testsuite/
* g++.dg/modules/mod++-decl-3_[ab].C: Delete.
{read,write}_module become member fns
gcc/cp/
* module.c (cpms_{in,out}::elf}: Direct member. Adjust ctors.
(cpms_{in,out}::{begin,end}): New.
(cpms_in::read, cpms_out::write): New.
(read_module, write_module): Delete.
(do_module_import, finish_module): Adjust.
README section
gcc/cp/
* module.c (version2date, version2time, version2string): Moved
from cpm_serial.
(struct_data): Broken out of elf.
(struct elf::isection): Remove link field. Adjust all uses.
(class elf_out::strings): New.
(elf_out::add): New.
(bytes_out::printf): New.
(cpm_stream::dump, cpms_in::header): Adjust version handling.
(write_module): Write README section.
Fix layering violation
gcc/cp/
* module.c (elf): Rename bad -> set_error.
(elf_out, elf_in): Update.
(cpm_serial, cpm_writer, cpm_reader): Rename to ...
(bytes, bytes_out, bytes_in): ... here.
(bytes_{in,out}): Remove source, sink members.
(bytes_in): Rename overran -> get_overrun. Add end, set_overrun.
Delete bad, get_error. Adjust users.
(cpms_in, cpms_out): Add elf field. Adjust.
2018-01-26 Nathan Sidwell <nathan@acm.org>
Simplify buffer filling & drainging
gcc/cp/
* module.c (cpm_serial): Add begin, end, use, unuse.
(cpm_writer): Add use, unuse, begin, end. Delete reserve, flush,
seek, tell, checkpoint.
(cpm_reader): Add overrun, use, begin, overran. Delete fill,
checkpoint.
(cpm_{reader,writer}): Update all seralizers.
(cpms_{in,out}): Remove checkpointing.
CRC at section level
gcc/cp/
* module.c (elf::data): Add crc routines.
(cpm_serial): Remove crc routines.
(cpm_in, cpm_out): Don't calculate crcs.
(read_module, write_module): Adjust (incomplete).
BMI is ELF
gcc/cp/
* module.c (get_version): Moved from cpm_stream::version.
(struct non_null_hash, ptr_uint_traits, ptr_uint_hash_map)
uint_ptr_traits, uint_ptr_hash_map): New.
(elf, elf_in, elf_out): New classes.
(cpm_serial, cpm_in, cpm_out): Modify (incomplete).
(cpms_in, cpms_out): Adjust.
(read_module, write_module, finish_module): Adjust.
2018-01-24 Nathan Sidwell <nathan@acm.org>
Global tree via crc
gcc/cp/
* module.c (cpm_stream): Add globals & globals_crc.
(cpm_stream::next): Add default arg.
(cpm_stream::cpm_stream): Lazily init globals vector.
(cpms_{in,out}::mark_present, globals): Delete.
(cpms_{in,out}::tag_globals): Reimplement.
(cpms_in::tree_node_special): Read global tree directly.
* name-lookup.c (extract_module_bindings): Skip RTTI types.
gcc/cp/
* module.c (module_state): Replace direct_import with imported &
exported flags.
(module_state::do_import): Adjust.
(enum import_kind): Delete.
(do_module_import): Adjust.
(cpms_{in.out}::tag_import): Adjust.
(module_interface_p, import_module, declare_module)
(finish_module): Adjust.
2018-01-23 Nathan Sidwell <nathan@acm.org>
Static bindings not visible in imports
gcc/cp/
* name-lookup.h (decapsulate_binding): Delete.
(module_binding_vec, extract_module_bindings): Declare.
* module.c (cpms_{in,out}::tag_binding): Reimplement.
(cpms_out::bindings): Likewise.
* name-lookup.c (decapsulate_binding): Delete.
(extract_module_bindings): New.
gcc/testsuite/
* g++.dg/modules/mod++-decl-0_c.C: Remove XFAIL.
* g++.dg/modules/static-1_[abc].C: New.
2018-01-22 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* tree.c (ovl_insert): No need to sort by USING_P.
(ovl_iterator::reveal_node): Likewise.
Update bug reporting instructions
gcc/
* configure.ac (ACX_BUGURL): Set new url
* diagnostic.c (diagnostic_action_after_output): Special ICE
instructions.
* configure: Rebuilt.
2018-01-19 Nathan Sidwell <nathan@acm.org>
Kill mangle_namespace.
gcc/cp/
* cp-tree.h (CPTI_MANGLE, mangle_namespace): Delete.
* decl.c (cxx_init_decl_processing): Don't create it.
* module.c (cpms_out::bindings): Don't skip it.
* name-lookup.c (suggest_alternatives_for): Likewise.
Import ident by type not index.
gcc/cp/
* name-lookup.h (get_ident_in_namespace, get_ident_in_class,
find_by_ident_in_namespace, find_by_ident_in_class): Delete.
(lookup_by_ident): Declare.
* name-lookup.c (get_ident_in_namespace, get_ident_in_class): Delete.
(find_by_ident_in_namespace, find_by_ident_in_class): Replace with ...
(lookup_by_ident): ... this.
* module.c (cpms_{in,out}::ident_imported_decl): Delete.
(cpms_out::tree_node): Write imported decl info directly.
(cpms_in::tree_node): Use lookup_by_ident.
gcc/cp/
* module.c (cpms_{in.out}::tree_node_special): New, broken out of ...
(cpms_{in,out}::tree_node): ... here. Call them.
Merge trunk r256894.
gcc/cp/
* Make-lang.in: Set MODULE_STAMP if non-branch experimental.
Beginnings of global module correctness
gcc/cp/
* cp-tree.h (struct mc_index): New.
(module_cluster): Use it.
(MODULE_VECTOR_SLOTS_PER_CLUSTER): New.
(GLOBAL_MODULE_INDEX, THIS_MODULE_INDEX, IMPORTED_MODULE_BASE): Delete.
(MODULE_INDEX_IMPORT_BASE): New.
(DECL_MODULE_PURVIEW_P, MAYBE_DECL_MODULE_PURVIEW_P): New.
(MAYBE_DECL_MODULE_INDEX): Adjust.
(MODULE_INDEX_BITS): New.
(struct lang_decl_base): Add module_purview_p field.
* decl2.c (c_parse_final_cleanups): Adjust.
* error.c (dump_module_suffix): Adjust.
* mangle.c (maybe_write_module): Adjust.
* module.c (MODULE_INDEX_IMPORTING, MODULE_INDEX_ERROR): New.
(module_state::freeze): Delete.
(this_module): Delete. Replace with (*modules)[0].
(cpms_in::alloc_remap_vec): Adjust.
(cpms_in::tag_import): Use MODULE_INDEX_ERROR.
(cpms_{in,out}::tag_binding): Lose MAIN_P parm. Adjust.
(cpms_in::define_function): Remove GLOBAL_MODULE_INDEX handling.
(cpms_in::read_item): Use MODULE_INDEX_IMPORTING.
(cpms_in::finish): Remove NODE_MODULE parm. use
MAYBE_DECL_MODULE_PURVIEW_P.
(cpms_{in,out}::lang_decl_bools): Read & write module_purview_p.
(cpms_in::tree_node_raw): Lose NODE_MODULE parm. Set module
directly.
(cpms_{in,out}::tree_node): Adjust module identification.
(cpms_out::bindings): Bindings are on a single slot.
(module_loc): Delete.
(decl_set_module): Set purview as needed.
(module_purview_p, module_interface_p): Adjust.
(read_module): Simplify.
(do_module_import): Adjust for lack of global module slot. Use
MODULE_INDEX_ERROR, MODULE_INDEX_IMPORTING. Detect already
declared module here.
(import_module): Adjust.
(declare_module): Don't detect already declared here.
(write_module): Adjust.
(finish_module): Adjust.
* name-lookup.c (module_binding_slot): Reimplement.
(name_lookup::process_module_binding)
(name_lookup::search_namespace_only, name_lookup::add_module_fns)
(name_lookup::adl_namespace_only, do_pushdecl): Adjust.
(merge_global_decl): Kludge into reworking.
(push_module_binding): Likewise.
* name-lookup.h (merge_global_decl): Add module parm.
* pt.c (build_template_decl): Propagate purview.
* ptree.c (cxx_print_xnode): Adjust.
* rtti.c (tinfo_base_init): Kludge into working.
(get_tinfo_desc): Drop unnecessary push/pop abi namespace.
(emit_tinfo_decl): Simplify.
gcc/testsuite/
* g++.dg/modules/global-1_[ab].C: New
* g++.dg/modules/mod++-decl-0_b.C: Remove xfail.
2018-01-18 Nathan Sidwell <nathan@acm.org>
Merge access & discriminator.
gcc/cp/
* cp-tree.h (struct lang_decl_base): Rename u2sel to spare.
(struct lang_decl_min): Replace lang_decl_u2 union with plain
tree.
(LANG_DECL_U2_CHECK): Delete.
(DECL_DISCRIMINATOR_SET_P, DECL_DISCRIMINATOR): Adjust.
(DECL_CAPTURED_VARIABLE, DECL_ACCESS, THUNK_VIRTUAL_OFFSET): Adjust.
* decl.c (push_local_name): Represent discriminator as INTEGER_CST.
(duplicate_decls): Copy DECL_ACCESS. fix formatting.
* mangle.c (discriminator_for_local_entity): Extract integer value.
* module.c (cpms_{in,out},lang_decl_bools): Drop u.base.u2sel.
(cpms_{in,out}::lang_decl_vals): Drop u.min.u2 handling.
* semantics.c (finish_omp_threadprivate): Drop u.base.u2sel copying.
2018-01-02 Nathan Sidwell <nathan@acm.org>
Merge trunk r256078.
Typedefs!
gcc/cp/
* decl.c (grokdeclarator): Set typedef's module/export.
gcc/testsuite/
* g++.dg/modules/tdef-2_[abc].C: New.
gcc/testsuite/
* g++.dg/modules/tdef-1_[ab].C: New.
2017-12-20 Nathan Sidwell <nathan@acm.org>
Variables!
gcc/cp/
* decl.c (grokvardecl): Set exporting.
* module.c (dump_nested_name): Dump integer values.
(cpms_{in,out}::define_var): New.
(cpms_{in,out}::tag_definition): Deal with vars.
(cpms_out::maybe_tag_definition): Likewise.
(cpms_out::core_bools): Externalize static vars.
(cpms_out::lang_decl_bools): Likewise for not-really-extern.
gcc/testsuite/
* g++.dg/modules/var-1_[ab].C: New.
Enumerations!
gcc/cp/
* module.c (module_state::set_name): Don't deal with crc.
(module_state::set_crc): New.
(cpm_serial::get_crc): Don't obscure zero.
(cpm_writer::tell): New.
(cpms_out::crc_tell): New.
(cpms_{in,out}::define_enum): New.
(cpms_out::header): Save crc location.
(cpms_in::header): Use set_crc.
(cpms_out::tag_eof): Adjust.
(cpms_out::maybe_tag_definition): Deal with enums.
(cpms_{in,out}::tag_definition): Deal with enums.
(cpms_{in,out}::core_vals): Do not write enum bits.
(do_module_import): Use set_crc.
* name-lookup.c (push_module_binding): Fix assert.
gcc/testsuite/
* g++.dg/modules/enum-1_[ab].C: New.
2017-12-19 Nathan Sidwell <nathan@acm.org>
Merge trunk r255836.
2017-11-27 Nathan Sidwell <nathan@acm.org>
Merge trunk r255166.
2017-11-22 Nathan Sidwell <nathan@acm.org>
Non-type template parms, & nested template classes.
gcc/cp/
* module.c (cpms_{in,out}::core_vals): Deal with CONST_DECLs.
gcc/testsuite/
* g++.dg/modules/tplmem-3_[ab].C: New.
2017-11-21 Nathan Sidwell <nathan@acm.org>
Member types
gcc/testsuite/
* g++.dg/modules/nested-2_[ab].C: New
Nested classes.
gcc/cp/
* module.c (cpm_reader::wi): Promote before shifting.
(cpms_out::define_class): Maybe define all members.
(cpms_out::maybe_tag_definition): Only implicit typedefs are
defined.
(cpms_{in.out}::core_vals): Don't stream value cache.
gcc/testsuite/
* g++.dg/modules/nested-1_[abc].C: New
2017-11-20 Nathan Sidwell <nathan@acm.org>
Merge trunk r254959.
Template member functions.
gcc/cp/
* cp-tree.h (TI_PENDING_TEMPLATE_FLAG): Add TI_CHECK.
* module.c (cpms_out::maybe_tag_definition): Check DECL_INITIAL,
write clones.
(cpms_in::tag_definition): Don't zap clones.
(cpms_in::finish): Clear TI_PENDING_TEMPLATE_FLAG.
(cpms_{in,out}::core_vals): Check tcc_unary, tcc_binary.
* optimize.c (maybe_clone_body): Don't alias when modules.
gcc/testsuite/
* g++.dg/modules/tplmem-1_[ab].C: New.
2017-11-17 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (cpms_out::tree_node): Fix conv-op identifiers.
gcc/testsuite/
* g++.dg/modules/convop-1_[ab].C: New.
2017-11-16 Nathan Sidwell <nathan@acm.org>
Constexprs!
gcc/cp/
* cp-tree.h (check_constexpr_fundef, find_constexpr_fundef): Declare.
* constexpr.c (find_constexpr_fundef): New.
(register_constexpr_fundef): Split checking off to ...
(check_constexpr_fundef): ... here. Call
register_constexpr_fundef.
* decl.c (): Adjust.
* module.c (cpms_{in,out}::define_function): Serialize constexpr
body.
(cpms_{in,out}::core_vals): Serialize function-scope var initializers.
gcc/testsuite/
* g++.dg/modules/cexpr-[12]_[ab].C: New.
Merge trunk r254823.
Merge trunk r254819.
2017-11-03 Nathan Sidwell <nathan@acm.org>
Virtual bases!
gcc/cp/
* Make-lang.in: module.o depends on revision
* class.c (layout_class_type): Unnamed types do not get base
types.
* cxx-module-wrapper.sh: Invoke make. Strip bad args.
* module.c (module_context): Allow NULL context.
(cpms_{in,out}::define_class): Deal with classtype_as_base.
(cpms_{in,out}::tag_definition): Allow raw class.
(cpms_{in,out}:ident_imported_decl: Rework class scope.
(cpms_out::tree_node): Deal with NULL module context.
* name-lookup.c (maybe_lazily_declare): Break out of ...
(get_class_binding): ... here. Call it.
(get_ident_in_class, find_by_ident_in_class): New.
* name-lookup.h (get_ident_in_class, find_by_ident_in_class): Declare.
gcc/testsuite/
* g++.dg/modules/class-7_[abc].C: New.
* g++.dg/modules/main.cc: Move to ...
* g++.dg/modules/main_a.C: ... here. Adjust.
* g++.dg/modules/modules.exp: Remove main.cc exceptionalism.
2017-10-26 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (module_state): Add filename & loc.
(module_state::{set,push,pop}_location): New.
(cpm_stream): Add state member. Adjust.
(cpms_{in,out}): Adjust.
(cpms_in::{header,tag_conf}): Adjust.
(read_module, write_module): Lose fname arg.
(search_moule_path): Don't prefix .
(do_module_import, finish_module): Set location.
gcc/
* diagnostic.c (maybe_line_and_column): New.
(diagnostic_get_location_text, diagnostic_report_current_module):
Use it.
gcc/testsuite/
Markup no-column tests.
2017-10-24 Nathan Sidwell <nathan@acm.org>
gcc/cp
* cxx-module-wrapper.sh: Cleanups.
* module.c (cpm_stream::global_tree_arys): Add integer_types.
(cpms_{in,out}::tree_node): Robustify.
(read_module): Note end of importing.
(search_module_path): Note if wrapper failed to install.
* name-lookup.c (merge_global_decl): Zap anticipated decl here ...
(push_module_binding): ... not here.
gcc/
* incpath.c (clean_cxx_module_path): Correct env var name.
gcc/c-family/
* c.opt (fmodules++): Add Driver.
gcc/testsuite/
* g++.dg/modules/{main.c,hello.cc}: New.
* g++.dg/modules/modules.exp: Special case main.cc
2017-10-23 Nathan Sidwell <nathan@acm.org>
Wrapper program
gcc/
* doc/invoke.texi (fmodule-root, fmodule-path, fmodule-wrapper):
Document.
* gcc.c (driver::maybe_putenv_CXX_MODULE_WRAPPER): New.
(driver::main): Call it.
* gcc.h (driver::maybe_putenv_CXX_MODULE_WRAPPER): Declare.
* incpath.h (clean_cxx_module_path): Add multilib parm.
* incpath.c (add_path): Initialize length.
(clean_cxx_module_path): Append multilib fragment. Add '.'.
gcc/c-family/
* c-opts.c (c_common_post_options): Pass multilib suffx to
clean_cxx_module_path.
* c.opt (fmodules): Notify driver.
(fmodule-hook): Rename to ...
(fmodule-wrapper): ... here.
gcc/cp/
* Make-lang.in (cxx-module-wrapper): New program.
* cxx-module-wrapper.sh: New.
* module.c: Include libiberty.h, tree-diagnostic.h.
(read_module): Add announcement.
(module_to_filename): Identifier mapping does not depend on
module_path.
(search_module_path): Shell out to wrapper function.
(do_module_import): Adjust.
(init_module_processing): Default flag_module_wrapper.
gcc/testsuite/
* g++.dg/modules/modules.exp: Adjust.
2017-10-20 Nathan Sidwell <nathan@acm.org>
Template class!
gcc/cp/
* decl.c (xref_tag_1): Don't decl_set_module here.
* module.c (cpms_in::define_function): Check templatedness.
(cpms_{in,out}::define_class): Add maybe_template arg. Add
templatey bits.
(cpms_out::maybe_tag_definition): Deal with template classes.
{cpms_{in,out}::tag_definition): Add maybe_template arg, adjust.
{cpms_{in,out}::core_vals): Write record template_info.
* name-lookup.c (set_class_binding): Protect against empty
member_vec.
(do_pushtag): Call decl_set_module here.
* pt.c (build_template_decl): Copy module bits here ...
(push_template_decl_real): ... not here.
gcc/testsuite/
* g++.dg/modules/mod-tpl-2_[ab].C: New.
Early CRC not time stamps.
gcc/cp/
* module.c (module_state::set_name): CRC too.
(cpm_serial::get_crc): New.
(cpm_writer::seek): New.
(cpm_{reader,writer}::bytes4): Rename to ...
(cpm_{reader,writer}::raw): ... this. Adjust all users.
(cpm_reader::get_crc): Delete.
(module_state::stamp): Replace with ...
(module_state::crc): ... this.
(cpms_in::cpms_in): Drop stamp arg.
(cpms_{in,out}::header): Deal with CRC not timestamp.
(time2str, timestamp_mismatch): Delete.
(cpms_{in,out}::tag_eof): Deal with crc.
(cpms_{in,out}::tag_import): Drop timestamp.
(read_module, do_module_import): Likewise. Use CRC.
gcc/testsuite/
* g++.dg/modules/mod-stamp-1_d.C: Adjust.
Merge trunk r253954.
2017-10-13 Nathan Sidwell <nathan@acm.org>
Template function!
gcc/
* tree.h (MARK_TS_TYPE_NON_COMMON): New.
gcc/cp/
* cp-objcp-common.c (cp_common_init_ts): Fix
TEMPLATE_TEMPLATE_PARM, TEMPLATE_TYPE_PARM,
BOUND_TEMPLATE_TEMPLATE_PARM marking.
* cp-tree.h (canonical_type_parameter): Declare.
* module.c (cpms_{in,out}::define_function): Add maybe_template
parm, adjust.
(cpms_out::maybe_tag_definition): Allow function templates.
(cpms_{in,out}:tag_definition): Allow templates.
(cpms_{in,out}::core_vals): Stream more nodes.
(cpms_{in,out}::lang_decl_vals): Stream more nodes.
(cpms_in::finish_type): Deal with TEMPLATE_TYPE_PARM,
TEMPLATE_TEMPLATE_PARM.
* pt.c (canonical_type_parameter): Make extern, simplify.
(push_template_decl_real): Propagate exportednes.
gcc/testsuite/
* g++.dg/modules/mod-tpl-1_[ab].C: New.
2017-10-12 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (TS_CP_BINDING, TS_CP_WRAPPER, LAST_TS_CP_ENUM): Delete.
(union lang_tree_node): Adjust GTY desc.
(cp_tree_node_structure): Take a tree_code.
* decl.c (cp_tree_node_structure): Take a tree_code.
* module.c (cpms_{out,in}::core_vals): Order clauses from
tree-core.h, use cp_tree_node_structure for C++.
Module name can be a string const (-fmodules++)
gcc/cp/
* cp-tree.h (cp_expr): Add constant operator* and operator->.
(validate_module_name): New.
(declare_module, import_module): Take cp_expr.
* error.c (dump_module_suffix): Adjust.
* module.c (module_state): Add name_hash. Adjust.
(module_state_hash): Allow string consts.
(module_state::set_name): Likewise.
(cpm_{writer,reader}::module_name): New.
(dump_nested_name): Name can be a string const.
(cpms_{out,in}::header): Adjust.
(cpms_{out,in}::tag_import): Adjust.
(validate_module_name): New.
(module_to_filename): Allow string consts.
(make_module_file): Adjust.
(do_module_import): Adjust.
(import_module, declare_module): Adjust.
* parser.c (cp_parser_module_name): Return cp_expr, allow
string-cst.
(cp_parser_module_declaration, cp_parser_import_declaration,
cp_parser_module_proclamation): Adjust.
gcc/testsuite/
* g++.dg/modules/modules.exp (dg-module-bmi): Renamed.
* g++.dg/modules/mod++-decl-3_[ab].C: New.
Add -fmodule-path, -fmodule-root.
gcc/
* incpath.h (INC_CXX_MPATH): New.
(clean_cxx_module_path): Declare.
* incpath.c (clean_cxx_module_path): New.
gcc/cp/
* cp-tree.h (init_module_processing): Declare.
* decl.c (cxx_init_decl_processing): Call init_module_processing.
* module.c (module_path, module_path_max): New vars.
(MOD_FNAME_PFX): Delete.
(module_to_filename): Reimplement.
(search_module_path, make_module_file): New.
(do_module_import): Adjust.
(init_module_processing): New.
(finish_module): Adjust.
gcc/c-family/
* c-opts.c (c_common_handle_option): Process OPT_fmodule_path_.
(c_common_post_options): Clean module path.
* c.opt (fmodule-root=, fmodule-path=, fmodule-hook=): New.
gcc/testsuite/
* g++.dg/modules/modules.exp: Adjust module name logic.
2017-10-11 Nathan Sidwell <nathan@acm.org>
Merge trunk r253654.
2017-10-10 Nathan Sidwell <nathan@acm.org>
Merge trunk r253585.
2017-09-25 Nathan Sidwell <nathan@acm.org>
gcc/c-family/
* c_common_handle_option: Handle fmodules++.
* c.opt (fmodules): Make Uinteger.
(fmodules++, fmodules-ts): New.
gcc/cp/
* parser.c (cp_parser_consume_semicolon_at_end_of_statement):
Return success bool.
(cp_parser_translation_unit): Adjust cp_parser_declaration_seq_opt
call.
(cp_parser_declaration_seq_opt): Add top_level parm, look for
module-decl here.
(cp_parser_module_declaration): Handle -fmodules++ syntax.
(cp_parser_module_export): No need to handle module-declaration
here ...
(cp_parser_declaration): ... or here.
gcc/
* doc/invoke.texi (-fmodules++): Document.
gcc/testsute/
* g++.dg/modules/mod++-decl-0_[abc].C: New.
* g++.dg/modules/mod++-decl-[12].C: New.
* g++.dg/modules/mod-decl-1.C: Adjust expected error.
2017-09-15 Nathan Sidwell <nathan@acm.org>
Merge trunk 252831.
2017-07-20 Boris Kolpackov <boris@codesynthesis.com>
Add -fmodule-output & -fmodule-file options.
gcc/c-family/
* c.opt (-fmodule-output): New option.
(-fmodule-file): New option.
* c-common.h (module_output): Declare.
(module_files): Declare.
* c-common.c (module_output): New variable.
(module_files): New variable.
* c-opts.c (add_module_file): New function.
* c-opts.c: Handle -fmodule-output and -fmodule-file.
gcc/cp/
* module.c (finish_module): If specified, use module_output as output
file name.
* module.c (do_module_import): Check module_files for a module name
to file mapping before falling back to default.
gcc/
* doc/invoke.texi (C++ Dialect Options): Document -fmodule-output
and -fmodule-file.
2017-07-17 Nathan Sidwell <nathan@acm.org>
Merge trunk r250272.
2017-07-13 Nathan Sidwell <nathan@acm.org>
Merge trunk r250159.
2017-07-03 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Use
lookup_fnfields_slot_nolazy.
* search.c (lookup_fnfields_idx_nolazy): Don't use
CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR.
gcc/cp/
* class.c (type_has_user_declared_move_constructor,
type_has_user_declared_move_assign): Delete, replace with:
(classtype_has_user_move_assign_or_ctor_p): ... this.
* cp-tree.h (type_has_user_declared_move_constructor,
type_has_user_declared_move_assign): Delete, replace with:
(classtype_has_user_move_assign_or_ctor_p): ... this.
* method.c (maybe_explain_implicit_delete): Update.
(lazily_declare_fn): Update.
* tree.c (type_has_nontrivial_copy_init): Update.
* search.c (lookup_fnfields_slot_nolazy): Don't try and complete
the type.
* pt.c (check_explicit_specialization): Use regular lookup.
gcc/cp/
* class.c (maybe_warn_about_overly_private_class): Ignore
copy/move ctors.
* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
lookup_fnfields_slot for ctors.
gcc/cp/
* module.c (cpms_{out,in}::start): Don't deal with identifiers
here.
(cpms_{out,in}::tree_node): Deal with identifiers specially.
Merge trunk r249852.
2017-06-30 Nathan Sidwell <nathan@acm.org>
Merge trunk r249835.
2017-06-29 Nathan Sidwell <nathan@acm.org>
Merge trunk r249794.
gcc/cp/
* cp-tree.h (class_method_index_for_fn): Delete.
* decl2.c (check_classfn): Use lookup_fnfields_slot, reimplement
diagnostics.
* name-lookup.h (lookup_all_conversions): Declare.
* name-lookup.c (lookup_all_conversions): New.
* pt.c (retrieve_specialization): Use lookup_fnfields_slot,
lookup_all_conversions.
* search.c (class_method_index_for_fn): Delete.
gcc/testsuite/
* g++.dg/concepts/memfun-err.C: Adjust.
* g++.dg/cpp0x/decltype9.C: Adjust.
* g++.dg/lookup/decl1.C: Adjust.
* g++.dg/other/pr28432.C: Adjust.
* g++.dg/parse/crash12.C: Adjust.
* g++.dg/parse/enum3.C: Adjust.
* g++.dg/parse/operator6.C: Adjust.
* g++.dg/template/crash69.C: Adjust.
* g++.dg/template/error27.C: Adjust.
* g++.dg/template/error28.C: Adjust.
* g++.dg/template/memfriend6.C: Adjust.
* g++.old-deja/g++.mike/err1.C: Adjust.
* g++.old-deja/g++.mike/p811.C: Adjust.
* g++.old-deja/g++.other/crash25.C: Adjust.
* g++.old-deja/g++.other/dtor4.C: Adjust.
* g++.old-deja/g++.pt/t37.C: Adjust.
Merge trunk r249779.
gcc/cp/
* class.c (finish_struct): Use OVL_P.
* cp-tree.h (THIS_NAME, IN_CHARGE_NAME, VTBL_PTR_TYPE,
VTABLE_DELTA_NAME, VTABLE_PFN_NAME): Delete.
* decl.c (initialize_predefined_identifiers): Encode them here
directly. Rename cdtors consistently.
(cxx_init_decl_processing): Name vtbl_ptr_type directly.
* search.c (class_method_index_for_fn): No need to frob cdtor names.
2017-06-28 Nathan Sidwell <nathan@acm.org>
cdtor name cleanup. expunge lookup_fnfields_1 use.
gcc/
* builtins.c (fold_builtin_FUNCTION) Use
lang_hooks.decl_printable_name.
gcc/cp/
* call.c (build_new_method_call_1) Update cdtor handling.
* class.c (get_basefndecls): Use lookup_fnfields_slot.
* cp-tree.h (lookup_fnfields_1): Don't declare.
* decl.c (register_dtor_fn): Use lookup_fnfields_slot.
(grokfndecl): Set cdtor name.
* method.c (implicitly_declare_fn): Adjust cdtor flag setting.
* pt.c (check_explicit_specialization): Adjust cdtor checking, use
lookup_fnfields_slot_nolazy.
* search.c (lookup_fnfields_1): Make static.
* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
lookup_fnfields_slot.
gcc/testsite/
* g++.dg/cpp1y/builtin_FUNCTION.C: New.
* g++.dg/plugin/decl-plugin-test.C: Adjust.
Merge trunk r249746.
gcc/cp/
* cp-tree.h (SET_CLASS_TYPE_P): Use RECORD_OR_UNION_CHECK.
(NON_UNION_CLASS_TYPE_P): Just check for RECORD_TYPE.
* call.c (check_dtor_name): Adjust constructor_name check.
(name_as_c_string): Move const cast.
(build_new_method_call_1): Use constructor_name from basetype.
* class.c (get_vfield_name): Measure constructor_name length.
(build_self_reference): Don't use constructor_name here.
* cxx-pretty-print.c (is_destructor): Delete.
(pp_cxx_unqualified_id): Remove bogus dtor code.
* decl.c (grokdeclarator): Minor cleanup.
* method.c (implicitly_declare_fn): Use ctor_identifier and
dtor_identifier.
* name-lookup.c (constructor_name): Reimplement.
(constructor_name_p): Likewise.
(push_class_level_binding_1): Don't use constructor_name here.
* parser.c (cp_parser_direct_declarator): Reformat to avoid
nesting ifs.
* pt.c (tsubst_decl <FUNCTION_DECL>): Move var decls to
initialization point. Don't unnecessarily check for ctor name.
gcc/c-family/
* c-common.c (resort_field_decl_cmp): Don't declare.
2017-06-27 Nathan Sidwell <nathan@acm.org>
Merge trunk r249702.
gcc/c-family/
* c-common.h (field_decl_cmp, resort_sorted_fields): Delete.
* c-common.c (field_decl_cmp, resort_data,
resort_field_decl_cmp): Move to c-decl.c.
gcc/c/
* c-decl.c (field_decl_cmp, resort_data,
resort_field_decl_cmp): Moved from c-common.c
2017-06-26 Nathan Sidwell <nathan@acm.org>
Replace lang_type::sorted_fields with lang_type::bindings.
gcc/cp/
* cp-tree.h (lang_type): Delete sorted_fields. Add bindings
field.
(CLASSTYPE_SORTED_FIELDS): Replace with ...
(CLASSTYPE_BINDINGS): ... this.
* name-lookup.c (lookup_class_member): Reimplement.
(count_fields): Delete.
(sorted_fields_type_new): Delete.
(add_class_member): New.
(add_fields_to_record_type): Replace with ...
(add_class_members): ... this.
(add_enum_fields_to_record_type): Delete.
(create_classtype_sorted_fields): Replace with ...
(set_class_bindings): ... this.
(insert_late_enum_def_into_classtype_sorted_fields): Replace with ...
(insert_late_enum_def_bindings): ... this.
* name-lookup.h (create_classtype_sorted_fields,
insert_late_enum_def_into_classtype_sorted_fields): Replace with ...
(set_class_bindings, insert_late_enum_def_bindings): ... this.
* ptree.h (cxx_print_type): Don't print SORTED_FIELDS.
* search.c (lookup_field_1): Check CLASSTYPE_BINDINGS.
* decl.c (finish_enum_value_list): Use insert_late_enum_def_bindings.
* class.c (finish_struct_1): Use set_class_bindings.
* module.c (cpms_in::define_class): Likewise.
Start moving class name lookup around
gcc/cp/
* class.c (count_fields, add_fields_to_record_type,
add_enum_fields_to_record_type, sorted_fields_type_new,
create_classtype_sorted_fields,
insert_late_enum_def_into_classtype_sorted_fields): Move to ...
* name-lookup.c: ... here.
(lookup_class_member): New. Broken out of ...
* search.c (lookup_field_1): ... here. Call it.
* name-lookup.h (lookup_class_member,
create_classtype_sorted_fields,
insert_late_enum_def_into_classtype_sorted_fields): Declare.
Merge trunk r249657.
gcc/cp/
* cp-tree.h (lang_decl_fn): Remove assignment_operator_p field.
* module.c (cpms_{out,in}::lang_decl_bools: Likewise.
libcc1/
* libcp1plugin.cc (plugin_build_decl): Don't set
DECL_ASSIGNMENT_OPERATOR_P.
gcc/
* Makefile.in (MODULE_STAMP): Set here
(REVISION, REVISION_c): Override.
gcc/cp/
* Make-lang.in (MODULE_STAMP): Not here.
2017-06-23 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (DECL_COMPLETE_CONSTRUCTOR_P): Directly compare
identifier.
(DECL_BASE_CONSTRUCTOR_P, DECL_COMPLETE_DESTRUCTOR_P,
DECL_BASE_DESTRUCTOR_P, DECL_DELETING_DESTRUCTOR_P): Likewise.
(DECL_ASSIGNMENT_OPERATOR_P): Use IDENTIFIER_ASSIGN_OP_P.
* decl.c (grok_op_properties): Adjust identifier checking.
* init.c (expand_default_init): Adjust identifier descision.
* method.c (implicitly_declare_fn): Don't use
DECL_ASSIGNMENT_OPERATOR_P.
* search.c (lookup_fnfields_1): Use IDENTIFIER_CTOR_P,
IDENTIFIER_DTOR_P.
* call.c (in_charge_arg_for_name): Reimplement.
(build_special_member_call): Use IDENTIFIER_CDTOR_P,
IDENTIFIER_DTOR_P.
2017-06-22 Nathan Sidwell <nathan@acm.org>
Merge trunk r249572.
Reorder IDENTIFIER flags
gcc/cp/
* cp-tree.h (enum cp_identifier_kind): New.
(IDENTIFIER_KIND_BIT_0, IDENTIFIER_KIND_BIT_1,
IDENTIFIER_KIND_BIT_2): New.
(IDENTIFIER_MARKED): Move to TREE_LANG_FLAG_4.
(IDENTIFIER_VIRTUAL_P, IDENTIFIER_REPO_CHOSEN): Add IDENTIFIER_CHECK.
(C_IS_RESERVED_WORD): Replace with ...
(IDENTIFIER_KEYWORD_P): ... this.
(IDENTIFIER_CTOR_OR_DTOR_P): Replace with ...
(IDENTIFIER_CDTOR_P): ... this.
(IDENTIFIER_CTOR_P, IDENTIFIER_DTOR_P): New.
(IDENTIFIER_OPNAME_P): Replace with ...
(IDENTIFIER_ANY_OP_P): ... this.
(IDENTIFIER_ASSIGN_OP_P): New.
(IDENTIFIER_TYPENAME_P): Replace with ...
(IDENTIFIER_CONV_OP_P): ... this.
(NEW_DELETE_OPNAME_P): Replace with ...
(IDENTIFIER_NEWDEL_OP_P): ... this.
(DECL_CONV_FN_P, DECL_OVERLOADED_OPERATOR_P): Adjust.
(get_identifier_kind_name, set_identifier_kind): Declare.
* lex.c (get_identifier_kind_name, set_identifier_kind): New.
(init_operators): Adjust to avoid keywords, use
set_identifier_kind. Copy TYPE_EXPR slot.
(init_reswords): Call set_identifier_kind.
(unqualified_name_lookup_error): Adjust.
* operators.def (TYPE_EXPR): Remove.
* decl.c (struct predefined_identifier): Move into ...
(initialize_predefined_identifiers): ... here. Call
set_identifier_kind.
(grokfndecl, check_var_type, grokdeclarator): Adjust.
(grok_op_properties): Use IDENTIFIER_ANY_ASSIGN_OP to halve search
space. Adjust.
* call.c (name_as_c_string): Adjust.
(build_new_method_call_1): Likewise.
* cp-cilkplus.c (is_conversion_operator_function_decl_p): Likewise.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Adjust.
* dump.c (cp_dump_tree): Adjust.
* error.c (dump_decl_name): Adjust.
* mangle.c (write_unqualified_id, write_member_name,
write_expression): Adjust.
(mangle_conv_op_name_for_type): Use set_identifier_kind.
* name-lookup.c (do_class_using_decl): Adjust.
(lookup_name_fuzzy, lookup_name_real_1): Likewise.
* parser.c (cp_lexer_get_preprocessor_token,
cp_parser_direct_declarator): Likewise.
* pt.c (push_template_decl_real, tsubst_decl, tsubst_baselink,
tsubst_copy, tsubst_copy_and_build): Adjust.
* ptree.c (cxx_print_identifier): Print identifier kind.
* search.c (lookup_field_r, lookup_member,
lookup_fnfields_idx_nolazy): Adjust.
* semantics.c (finish_id_expression): Adjust..
* typeck.c (cp_build_addr_expr_1): Adjust.
2017-06-21 Nathan Sidwell <nathan@acm.org>
Merge trunk r249464.
gcc/c-family/
* c-ada-spec.c (decl_sloc): Ignore builtin fields.
gcc/cp/
* class.c (layout_class_type): Anon aggregates can never be bases.
(finish_struct_1, dump_class_hierarchy_1): CLASSTYPE_AS_BASE can
be null.
* cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
(as_base_identifier): New.
(module_context): Declare.
* decl.c (initialize_predefined_identifiers): Initialize as_base.
* error.c (dump_module_suffix): Use module_context.
* mangle.c (maybe_write_module): Likewise.
* module.c (module_context): New.
(dump_nested_name): Distingush NULL context.
(cpms_{in,out}::globals): Take array directly.
(cpms_{in,out}::tree_node_raw): New, broken out of ...
(cpms_{in,out}::tree_node): ... here. Call it. Use
module_context.
(cpms_in::finish): Add module number. Adjust.
(cpms_{in,out}::tag_trees): Write translation unit decl.
2017-06-16 Nathan Sidwell <nathan@acm.org>
Merge trunk r249268.
2017-06-15 Nathan Sidwell <nathan@acm.org>
Merge trunk r249217.
libcc1/
* libcp1plugin.c (supplement_binding): Don't call
maybe_remove_implicit_alias.
First bug report!
gcc/cp/
* cp-tree.h (CPTI_MANGLE): New.
(mangle_namespace): New.
(maybe_remove_implicit_alias): Delete.
* decl.c (cxx_init_decl_processing): Create mangle namespace.
* decl2.c (generate_mangling_alias): Use mangle_namespace.
* mangle.c (maybe_remove_implicit_alias): Delete.
(mangle_decl): Use mangle_namespace. Remove alias here.
* module.c (cpms_out::bindings): Ignore mangle_namespace.
* name-lookup.h (set_namespace_binding): Declare.
* name-lookup.c (supplement_binding_1): Don't deal with implicit
aliases here.
(set_namespace_binding): New. Broken out of ...
(set_global_binding): ... this. Call it.
(suggest_alternatives_for): Ignore mangle namespace.
gcc/testuite/
* g++.dg/module/bug-1_[ab].C: New.
2017-06-14 Nathan Sidwell <nathan@acm.org>
Classes complete - Vcall indices and friends added.
gcc/cp/
* module.c (cpms_{out,in}::tree_pair_vec): New.
(cpms_{out,in}::define_class): Stream vcall indices and friend list.
gcc/testsuite/
* g++.dg/module/class-6_[abc].C: New.
2017-06-12 Nathan Sidwell <nathan@acm.org>
Merge trunk r249076.
2017-06-09 Nathan Sidwell <nathan@acm.org>
Vtable streaming. Change keyed_classes representation.
gcc/cp/
* class.c (finish_struct_1): Adjust keyed_classes pushing.
* cp-tree.h (CPTI_KEYED_CLASSES): Delete.
(keyed_classes): Now a vector.
* decl.c (keyed_classes): Define.
(cxx_init_decl_processing): Initialize it.
(record_key_method_defined): Adjust pushing.
* decl2.c (decl_needed_p): Formatting fixes.
(c_parse_final_cleanups): Reset current module.
Call finish_module earlier. Adjust keyed_classes iteration.
* pt.c (instantiate_class_template_1): Adjust keyed_classes pushing.
* module.c (cpms_{out,in}::define_class): Adjust key method
streaming.
(cpms_{out,in}::lang_type_bools): Don't srtream interface flags.
gcc/testsuite/
* g++.dg/modules/class-5_[abc].C: New.
Typeinfo streaming
gcc/cp/
* cp-tree.h (DECL_TINFO_P): Also for TYPE_DECLs.
(get_pseudo_tinfo_index, get_pseudo_tinfo_type): Declare.
* rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
TK_VMI_CLASS_TYPES, TK_MAX, delete TK_FIXED.
(tinfo_names): New.
(typeid_ok_p): Lool at TYPE_MAIN_VARIANT.
(get_pseudo_to_index): Only determine index, don't create type.
(get_tinfo_desc): New. Create the pseudo type. Set DCL_TINFO_P.
(create_pseudo_type_info): Delete.
(get_pseudo_ti_init): Use get_tinfo_desc.
(get_pseudo_tinfo_index, get_pseudo_tinfo_type): New.
(create_tinfo_types): Only allocate the vector.
* module.c (cpms_{out,in}::insert): New.
(cpm_stream::global_tree_arys): Add sizetype_tab.
(cpms_out::tag_binding): Don't stream DECL_TINFO_P bindings.
(cpms_{out,in}::define_class): Don't stream
CLASSTYPE_TYPEINFO_VAR. Stream CLASSTYPE_VTABLES.
(cpms_{out,in}::core_vals): Stream CONSTRUCTORs.
(cpms_{out,in}::tree_node): Detect DECL_TINFO_P things.
2017-06-08 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (cpms_in::read_item, cpms_in::tree_node): More
diagnostics.
(cpms_{out,in}::start, cpms_{out,in}::core_vals): Fix call
handling.
gcc/testsuite/
* g++.dg/modules/class-4_[ab].C: New.
gcc/cp/
* module.c: Implement dump printf.
2017-06-07 Nathan Sidwell <nathan@acm.org>
Merge trunk r248972.
gcc/cp/
* module.c (cpms_{out,in}::core_vals): Stream block vars &
abstract origin.
2017-06-06 Nathan Sidwell <nathan@acm.org>
Inline ctors/dtors
gcc/cp/
* module.c (cpms_in::define_function): Deal with non-namespace
fn definitions.
(cpms_{out,in}::define_class): Define member fns.
(cpms_in::tag_definition): Clone fn.
* semantics.c (expand_or_defer_fn_1): Keep cloned fns body when
modules.
gcc/testsuite/
* g++.dg/modules/class-3_[abcd].C: Augment.
Member functions
gcc/cp/
* class.c (resort_type_method_vec): Avoid signed/unsigned compare.
* module.c (cpms_out::maybe_tag_definition): New.
(cpms_{out,in}::tag_definition): Always tag, return tagged thing.
(cpms_{out,in}::chained_decls, tree_vec): New.
(cpms_{out,in}::define_class): Stream methods, as_base.
(cpms_{out,in}::core_vals): Stream ARGUMENTs here.
(cpms_in::tree_node): Cope with immediate definitions.
gcc/testsuite/
* g++.dg/modules/class-3_[abcd].C: Augment.
More PoD struct
gcc/cp/
* module.c (cpms_{out,in}::ident_imported_decl): New.
(cpms_{out,in}::lang_type_vals): New.
(cpms_{out,in}::core_vals): Blocks and statements.
(cpms_{out,in}::tree_node): More general import referencing.
* name-lookup.c (name_lookup::add_module_fns): New.
(name_lookup::adl_namespace_only): Use it.
gcc/testsuite/
* g++.dg/modules/class-3_[abc].C: New.
2017-06-05 Nathan Sidwell <nathan@acm.org>
More PoD struct
gcc/cp/
* cp-tree.h (default_hash_traits): Make non-deletable.
(cpms_out::non_null): New hash trait.
(cpms_in::traits): Use simple_hashmap_traits.
(cpms_in::define_class, cpms_in::finish_type): Propagate
completeness.
(cpms_in::finish_type): Deal with pointer/ref to.
(cpms_{out,in}::core_vals): Stream ints, pointer/ref to.
(cpms_{out,in}::tree_node): Interstitial typedef.
gcc/testsuite/
* g++.dg/modules/class-1_[abc].C: Extend.
* g++.dg/modules/class-2_[ab].C: New.
2017-06-02 Nathan Sidwell <nathan@acm.org>
Pod struct
gcc/cp/
* cp-tree.h (create_classtype_sorted_fields): Declare.
* class.c (finish_struct_1): Adjust sorted field call.
(insert_into_classtype_sorted_fields): Rename to ...
(create_classtype_sorted_fields): ... here. Export
* module.c (cpms_{out,in}::tree_vec): New.
(cpms_{out,in}::define_function): New.
(cpms_{out,in}::define_class): New.
(cpms_{out,in}::tag_definition): Adjust.
(cpms_{out,in}::core_vals): Stream binfo, field_decl.
gcc/testsuite/
* g++.dg/modules/class-1_[abcd].C: Add field accesses.
Merge r248828.
gcc/cp/
* modules.c (cpms_out::core_vals, cpms_in::core_vals): Don't
stream structure fields etc.
2017-06-01 Nathan Sidwell <nathan@acm.org>
Incomplete or empty classes.
gcc/cp/
* cp-tree.h (ovl_iterator::export_tail): New.
(TYPE_GET_PTRMEMFUNC_TYPE, TYPE_SET_PTRMEMFUNC_TYPE): Delete.
(TYPE_PTRMEMFUNC_TYPE): New.
(maybe_add_lang_type_raw): Add ptrmem_p arg.
(fit_ptrmem_type_decl): Declare.
(ovl_insert): Add export_tail.
* decl.c (build_ptrmemfunc_type): Use fit_ptrmem_type_decl,
adjust.
(xref_tag_1): Call decl_set_module.
* lex.c (maybe_add_lang_type_raw): Add ptrmem_p arg. Adjust.
(fit_ptrmem_type_decl): New.
(cxx_make_type): Adjust.
* module.c (name_string): New. Use it everywhere.
(cpm_reader::fill): Check ferror.
(cpms_out::tag_binding): Skip builtins. Write types.
(cpms_out::lang_type_bools, cpms_in::lang_type_bools): New.
* name-lookup.c (STAT_EXPORTS): New.
(name_lookup::process_module_binding): Use it.
(update_binding): Set it.
(newbinding_bookkeeping): New. Broken out of ...
(do_pushdecl): ... here. Call it.
(push_module_binding): And call it here. Set STAT_EXPORTS.
* rtti.c (create_pseudo_type_info): Mark as builtins.
(get_pseudo_ti_index): Likewise.
(emit_support_tinfos): Use regular lookup to find type. Set
builtins location.
* tree.c (ovl_insert): Add export_tail arg.
gcc/testsuite/
* g++.dg/modules/class-1_[abcd].C: New.
2017-05-31 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c: Instrumentation.
Merge trunk r248748.
2017-05-30 Nathan Sidwell <nathan@acm.org>
Merge trunk r248694.
gcc/cp/
* module.c (cpms_out::tag_binding, cpms_in::tag_binding): Mark
type too.
(cpms_out::bindings): Adjust.
* name-lookup.c (push_module_binding): Add type arg.
gcc/cp/
* cp-tree.h (lang_decl_base): Lose decomposition_p flag.
(lang_decl) Update GTY tags.
(enum lang_decl_selector): New. Replace magic consts with this.
(DECL_DECOMPOSITION_P): Update.
(SET_DECL_DECOMPOSITION_P): Delete.
(maybe_add_lang_decl_raw): Second arg is bool.
(retrofit_lang_decl): Lose selector arg.
(fit_decomposition_lang_decl): Declare.
* decl.c (cp_finish_decomp): Use fit_decomposition_lang_decl.
(grokdeclarator): Likewise.
* lex.c (maybe_add_lang_decl_raw): Change 2nd arg to bool. Don't
to copying here.
(set_decl_linkage, fit_decomposition_lang_decl): New.
(retrofit_lang_decl): Lose selector arg.
(cxx_dup_lang_specific_decl): Use selector directly.
* module.c (cpms_out::lang_decl_bools, cpms_in::lang_decl_bools,
cpms_out::lang_decl_vals, cpms_in::lang_decl_vals): Use
lang_decl_selector.
(cpms_in::tree_node): Adjust maybe_add_lang_decl call.
gcc/
* REVISION: Add file.
gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_modules=201704.
2017-05-29 Nathan Sidwell <nathan@acm.org>
Merge trunk r248578.
Merge trunk r248574.
Merge trunk r248571.
2017-05-26 Nathan Sidwell <nathan@acm.org>
Merge trunk r248517.
gcc/cp/
* cp-tree.h: Comment cleanup.
* name-lookup.c: Likewise.
* tree.c: Likewise.
Merge trunk 248485.
gcc/cp/
* lex.c (maybe_retrofit_lang_decl): Add sel parm.
2017-05-25 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (ovl_iterator): Make unduplicatable.
(ovl_iterator::pop): New.
(lkp_iterator::operator++): Adjust.
Merge trunk r248454.
Merge trunk r248436.
2017-05-24 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (lookup_name): Reimplement state preservation and
restoration.
* tree.c (lookup_mark): Add asserts.
gcc/testsuite/
* g++.dg/lookup/koenig14.C: New.
Merge trunk r248406.
gcc/cp/
* call.c (build_operator_new_call, build_new_op_1): Open code ADL
lookup.
* name-lookup.h (lookup_function_nonclass): Delete.
(lookup_arg_dependent): Adjust return type.
* name-lookup.c (name_lookup): Absorb adl_lookup.
(name_lookup::search_adl): New.
(lookup_function_nonclass): Delete.
(lookup_arg_dependent): Adjust.
2017-05-23 Nathan Sidwell <nathan@acm.org>
Merge trunk r248389.
gcc/cp/
* name-lookup.c (name_lookup::name_lookup): Lose F parm.
(name_lookup::ambiguous, add_value, add_type): New.
(name_lookup::merge_binding): Delete.
(name_lookup::find_and_mark): Move from adl_lookup.
(name_lookup::process_binding): Adjust.
(adl_lookup::search_adl): New.
(do_lookup_arg_dependent): Call it.
(qualified_namespace_lookup): Return found flag.
(unqualified_namespace_lookup): Delete.
(lookup_name_real_1, push_namepace): Adjust.
Merge trunk r248377.
Merge trunk r248365.
2017-05-22 Nathan Sidwell <nathan@acm.org>
Merge trunk r248338.
gcc/cp/
* name-lookup.c (add_using_namespace): Remove FROM arg.
(notify_debug_using_namespace): New.
(finish_namespace_using_directive, push_namespace): Notify debug.
gcc/testsuite/
* g++.dg/lookup/strong-using-6.C: Delete.
gcc/cp/
* config-lang.in: Update.
* name-lookup.c (add_using_directive): Rename to ...
(add_using_namespace): ... here. Add FROM arg.
(do_toplevel_using_directive): Fold into add_using_namespace.
(finish_namespace_using_directive, finish_local_using_directive,
push_namespace): Adjust.
Merge trunk r248329.
gcc/testsuite/
PR c++/80830
* g++.dg/lookup/friend20.C: New testcase.
2017-05-19 Nathan Sidwell <nathan@acm.org>
Merge trunk r248295.
gcc/cp/
* cp-tree.h: Misc cleanups.
* name-lookup.c (pushdecl_top_level): Fix description.
gcc/
* dumpfile.h: Whitespace cleanups.
* system.h (ATTRIBUTE_NTC_PURE): Delete.
gcc/testsuite/
* g++.dg/tree-ssa/ssa-dse-2.C: Restore.
Merge trunk r248285.
Merge trunk r248271.
2017-05-18 Nathan Sidwell <nathan@acm.org>
Merge trunk r248250.
LANG_HOOK_REGISTER_DUMPS
gcc/
* context.h (context::set_passes): New.
* context.c (context::context): Do not create pass manager.
* toplev.c (general_init): Create pass manager here. Call
register dump lang hook.
* doc/invoke.texi: Document -fdump-lang option family.
* dumpfile.c (dump_files): Remove module and class dumps here.
(FIRST_AUTO_NUMBERED_DUMP): Adjust.
* dumpfile.h (tree_dump_index): Remove TDI_lang, TDI_class.
* langhooks-def.h (lhd_register_dumps): Declare.
(LANG_HOOKS_REGISTER_DUMPS): Define.
(LANG_HOOKS_INITIALIZER): Add it.
* langhooks.c (lhd_register_dumps): Define.
* langhooks.h (struct lang_hooks): Add register_dumps.
gcc/c-family/
* c-opts.c (class_dump_file, class_dump_flags): Delete.
(c_common_parse_file): Remove class dump handling.
(get_dump_info): Likewise.
gcc/cp/
* class.c (class_dump_id): Define.
(dump_class_hierarchy, dump_vtable, dump_vtt): Use it.
* cp-objcp-common.c (cp_register_dumps): New.
* cp-objcp-common.h (cp_register_dumps): Declare.
(LANG_HOOKS_REGISTER_DUMPS): Override.
* cp-tree.h (class_dump_id, module_dump_id): Declare.
* module.c (module_dump_id): Define.
(read_module, write_module): Use it.
gcc/testsuite/
* g++.dg/inherit/covariant7.C: Adjust.
* g++.dg/modules/ Adjust scans.
gcc/cp/
* cp-tree.h (lookup_add, lookup_maybe_add): Swap args.
* name-lookup.c (name_lookup::merge_binding,
adl_lookup::add_functions): Adjust.
* pt.c (check_explicit_specialization, do_class_deduction): Adjust.
* tree.c (lookup_add, lookup_maybe_add): Adjust.
Merge trunk r248192.
2017-05-17 Nathan Sidwell <nathan@acm.org>
Merge trunk r248159.
Merge trunk r248151.
* cp-tree.h (ovl_insert): Swap first two args. Update all uses.
Merge trunk r248144.
2017-05-16 Nathan Sidwell <nathan@acm.org>
Merge trunk r248126.
Merge trunk r248121.
Merge trunk r248116.
Merge trunk r248109.
2017-05-15 Nathan Sidwell <nathan@acm.org>
Merge trunk r248059.
gcc/cp/
* module.c (cpms_in::tag_definition): Robustify.
2017-05-12 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (cpms_{in,out}): Rename {read,write}_tree to tree_node.
gcc/cp/
* module.c (cpms_{in,out}): Rename read/write fns.
More inline bodies
gcc/cp/
* module.c (cpms_{in,out}::write_core_vals): Read/write
statement lists & LABEL_DECLs.
gcc/testsuite/
* g++.dg/modules/fn-inline-1_c.C: More test.
Inline function bodies
gcc/cp/
* module.c (cpms_{in,out}::write_core_vals): Read/write
exprs
(cpms_in::tag_definition): Insert inline function.
gcc/testsuite/
* g++.dg/modules/fn-inline-1_[ab].C: New.
Merge trunk r247968.
gcc/cp/
* module.c (cpm_reader::read_tree): Change interface, adjust callers.
gcc/cp/
* module.c (cpm_writer): Instrument bool distribution.
(cpms_out::tag_definition, cpms_in::tag_definition): New.
(cpms_out, cpms_in): Transfer more stuff.
2017-05-11 Nathan Sidwell <nathan@acm.org>
Merge trunk r247911.
2017-05-10 Nathan Sidwell <nathan@acm.org>
Merge trunk r247864.
Merge trunk r247834.
2017-05-09 Nathan Sidwell <nathan@acm.org>
Rename -fdump-front-end to -fdump-lang.
gcc/
* dumpfile.h (TDF_KIND_MASK, TDF_KIND): New. Adjust.
* dumpfile.c (dump_files): Rename file suffix.
(get_dump_file_name, dump_enable_all): Adjust.
* doc/invoke.texi: Rename option.
gcc/testsuite/
* g++.dg/modules: Adjust tests.
gcc/cp/
* module.c (cpms_in::finish): Merge global decls.
(cpms_in::finish_function, cpms_in::finish_namespace): Delete.
* name-lookup.h (push_module_namespace): Replace with ...
(merge_global_decl): ... this.
* name-lookup.c (push_module_namespace): Morph into ...
(merge_global_decl): ... this.
(push_module_binding): Don't re-add found things.
gcc/
* tree.h (TREE_CHECK6, tree_check6): Delete.
Merge trunk r247787.
gcc/cp/
* tree.c (type_has_nontrivial_copy_init): Use ovl_iterator.
Error message module designation.
gcc/cp/
* error.c (dump_module_suffix): New.
(dump_simple_decl, dump_function_name): Use it.
gcc/testsuite/
* g++.dg/modules/err-1_[abcd].C: New.
2017-05-08 Nathan Sidwell <nathan@acm.org>
Merge trunk r247749.
Implement 'export module foo;'
gcc/cp/
* cp-tree.h (declare_module): Add interface flag.
(import_export_module): Rename to ...
(import_module): ... here. Lose export flag.
* module.c (import_module): Determine exportness from export
depth.
(declare_module): Add interface flag, don't check attribs.
* parser.c (check_module_outermost): Don't check export depth.
(cp_parser_module_declaration): Don't deal with imports.
(cp_parser_import_declaration): New.
(cp_parser_module_export, cp_parser_declaration): Adjust.
gcc/testsuite/
* g++.dg/modules/import-1_[a-g].C: New.
Implement DR2061
gcc/cp/
* name-lookup.c (push_inline_namespace): New.
(push_namespace): Use it. Check inline consistency here ...
* parser.c (cp_parser_namespace_definition): ... not here.
gcc/testsuite/
* g++.dg/cpp0x/dr2061.C: New.
* g++.dg/parse/namespace-alias-1.C: Augment.
gcc/cp/
* cp-tree.h, call.c, class.c, name-lookup.c, parser.c, pt.c,
semantics.c, tree.c: Rename ovl2_iterator to lkp_iterator.
gcc/cp/
* name-lookup.h (push_namespace): Return int.
* name-lookup.c (push_namespace): Return count of depth pushed.
* parser.c (cp_parser_namespace_definition): Accumulate depth pushed.
2017-05-05 Nathan Sidwell <nathan@acm.org>
Merge trunk r247654.
Merge trunk r247646.
Merge trunk r247636.
Indirect import lookup by tagging
gcc/cp/
* cp-tree.h (MAYBE_DECL_MODULE_INDEX): New.
(DECL_GLOBAL_MODULE_P, DECL_THIS_MODULE_P): Delete.
* mangle.c (maybe_write_module): Adjust.
* module.c (cpms_out::write_tree, cpms_in::read_tree): Mark
imported decls by tag.
* name-lookup.h (key_module_instance, find_module_instance): Declare.
* name-lookup.c (module_binding_slot): Allow search only.
(key_module_instance): New.
(find_module_instance): Use key.
gcc/testsuite/
* g++.dg/modules/mod-indirect-1_[a-e].C: New.
2017-05-04 Nathan Sidwell <nathan@acm.org>
Merge trunk r247612.
gcc/testsuite/
* g++.dg/lookup/using17.C: Adjust error message.
Overload bindings
gcc/cp/
* module.c (cpms_in::tag_binding, cpms_out::tag_binding): Binding
can be overload.
(cpms_out::write_bindings): Write whole slot.
(cpms_in::finish): Look for import match.
(cpms_in::read_lang_decl_bools, cpms_out::write_lang_decl_bools,
cpms_in::read_lang_decl_vals, cpms_out::write_lang_decl_vals):
Implement.
* name-lookup.c (push_module_binding): Binding can be overload.
(find_module_instance): New.
* name-lookup.h (find_module_instance): Declare.
gcc/testsuite/
* g++.dg/modules/mod-impl-1_[abcd]: Add overloads.
2017-05-03 Nathan Sidwell <nathan@acm.org>
Merge trunk r247593.
gcc/cp/
* cp-tree.h (LOOKUP_SEEN_P): Map to TREE_VISITED.
(LOOKUP_FOUND_P, OVL_LOOKUP_P): Move to lang_flag_4
Modules via index, working again!
gcc/cp/
* module.c (cpms_in::tag_binding): Set module index.
gcc/testsuite/
* g++.dg/modules/mod-impl-1_a.C: Remove xfail.
Namespace partitions.
gcc/cp/
* cp-tree.h (MODULE_NAMESPACE_P, GLOBAL_MODULE_NAMESPACE_P,
CURRENT_MODULE_NAMESPACE_P): Delete.
(pop_module_namespace, push_module_namespace): Delete.
* module.c (cpms_out::write_bindings, cpms_in::finish_namespace):
Remove module namespace hacks.
(push_module_namespace, pop_module_namespace): Delete.
(module_to_ext): Swallow into ...
(module_to_filename): ... here.
(declare_module): Don't create module namespace symbol.
* name-lookup.c (module_binding_slot): Fixup global module
insertion.
(is_nested_namespce, is_ancestor): Remove module namespace hacks.
* parser.c (check_module_outermost, cp_parser_module_export,
cp_parser_module_proclamation,
cp_parser_namespace_definition): Likewise
gcc/testsuite/
* g++.dg/modules/mod-sym-[123].C: Remove xfails.
* g++.dg/modules/mod-impl-1_a.C: Revert to run test.
Namespace partitions.
gcc/cp/
* cp-tree.h (OVL_EXPORT_P): New. Move OVL_LOOKUP_P.
(DECL_MODULE_EXPORT_P): Allow any DECL.
(module_import_bitmap): Declare.
* decl.c (cxx_init_decl_processing): Export global_namespace.
* module.c (module_import_bitmap): New.
(do_module_import): Install as global module, if needed.
(declare_module): Freeze global imports.
* name-lookup.c: Include bitmap.h.
(name_lookup::process_binding): Take split bindings.
(name_lookup::process_module_binding): New.
(name_lookup::search_namespace_only): Adjust.
* tree.c (ovl_insert): Sort by export_p too.
Merge trunk r247550.
Namespace partitions.
gcc/cp/
* cp-tree.h (MODULES_PER_BINDING_CLUSTER): Delete.
(MODULE_VECTOR_NUM_CLUSTERS, MODULE_VECTOR_CLUSTER_BASE,
MODULE_VECTOR_CLUSTER_LAST, MODULE_VECTOR_CLUSTER): New.
(make_module_vec): Declare.
* module.c (cpms_out::write_bindings): Look into MODULE_VECTOR.
* name-lookup.c (modue_binding_slot): New.
(name_lookup::merge_binding, name_lookup::process_binding): New.
(name_lookup::search_qualified): Add usings parm.
(name_lookup::search_namespace_only): Look into MODULE_VECTOR.
(do_pushdecl): Create module slot.
(find_namespace_partition): New, from ...
(push_module_namespace): ... here. Call it.
(push_module_binding): Create module slot.
(push_namespace): Adjust.
* ptree.c (cxx_print_xnode): Print MODULE_VECTOR.
* tree.c (make_module_vec): New.
2017-05-02 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (saved_scope): Add this_module.
(current_module): New.
* module.c (cpms_in): Add remapping vector. Remove scope.
(cpms_in::tag_import): Update remapping vector.
(cpms_out::tag_binding, cpms_in::tag_binding): Write/read module no.
* name-lookup.c (do_push_to_top_level): Set current_module.
gcc/doc/
* invoke.texi (-fdump-front-end): Document.
Read/write direct namespace bindings part 2.
gcc/cp/
* module.c (cpms_out::tag_binding): Write the tag.
(cpms_in::read_item): Detect rt_binding, set modules slot.
(cpms_out::write_context_binding): Delete.
(cpms_out::write_bindings): Simplify.
(cpms_in::finish_function): Don't push function here.
(cpms_in::finish_namespace): Adjust.
(do_module_import): Adjust.
* name-lookup.h (push_module_namespace): Declare.
* name-lookup.c (push_module_namespace): New.
Read/write direct namespace bindings part 1.
gcc/cp/
* cp-tree.def (module_vector): New tree type.
* cp-tree.h (module_cluster, tree_module_vec): New tree.
(enum cp_tree_node_structure_enum): Add TS_CP_MODULE_VECTOR.
(lang_tree_node): Add tree_module_vec.
* decl.c (cp_tree_node_structure): Detect MODULE_VECTOR.
* module.c (cpms_out::tag_binding, cpms_in::tag_binding): New.
(cpms_out::write_context_binding): New.
(cpms_out::walk_namespace): Replace with ...
(cpms_out::write_bindings): ... this.
* name-lookup.h (push_module_binding): Declare.
* name-lookup.c (push_module_binding): New.
2017-05-01 Nathan Sidwell <nathan@acm.org>
gcc/
* tree.c (type_hash_default): Adjust ARRAY_TYPE hash.
Import timestamp & crc
gcc/cp
* module.c (module_state): Add crc & stamp.
(enum import_kind): New.
(cpms_out::header, cpms_in::header): Check timestamps.
(time2str, timestamp_mismatch): New.
(cpms_out::tag_import, cpms_in::tag_import): Xfer indirect imports
too.
(read_module, do_module_import): Check timestamp & crc.
gcc/testsuite/
* g++.dg/modules/mod-stamp-1_[abcd].C: New.
Proper mangle for module. Still have namespace hack though.
gcc/cp/
* cp-tree.h (DECL_GLOBAL_MODULE_P, DECL_THIS_MODULE_P): Protect
DECL_LANG_SPECIFIC.
(decl_set_module, module_name, module_name_parts): New.
* decl.c (duplicate_decls): Check moduleness.
(grokfndecl): Set moduleness.
* mangle.c (maybe_write_module): New.
(write_name): Call it.
* module.c (module_state::set_name): New.
(decl_set_module, module_name, module_name_parts): New.
gcc/testsuite/
* g+.dg/modules.exp (dg-module-do, module_do_it): Adjust.
* g++.dg/modules/mod-impl-1_a.C: Adjust & XFAIL.
* g++.dg/modules/mod-impl-1_c.C: Likewise.
* g++.dg/modules/mod-sym-1.C: Likewise.
* g++.dg/modules/mod-sym-2.C: Likewise.
* g++.dg/modules/mod-sym-3.C: Likewise.
2017-04-28 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (struct_lang_base): Add module_index. Shrink selector.
(DECL_MODULE_INDEX, DECL_GLOBAL_MODULE_P, DECL_THIS_MODULE_P): New.
(EXPORTED_P): Rename to ..
(DECL_EXPORTED_P): ... here.
* modules.c: Adjust EXPORTED_P uses.
Module indices and separated import/export info
gcc/cp/
* cp-tree.h (GLOBAL_MODULE_INDEX, THIS_MODULE_INDEX,
IMPORTED_MODULE_BASE): New.
(import_module, export_module): Replace with ...
(import_export_module): ... this.
* module.c: #include bitmap.h.
(enum import_kind): Delete.
(struct module_state): New.
(modules, module_map, this_module): New.
(imported_modules): Delete.
(cpms_in::state): New member. Update constructor.
(cpms_in::tag_import, cpms_out::tag_import): Take is_export arg.
(cpms_in::read_item): Assign module index.
(module_user, is_interface): Delete.
(dopen, dclose): Delete. Move to call sites.
(read_module): Return module index.
(do_module_import): Reimplement.
(import_module, export_module): Replace with ...
(import_export_module): ... this.
(declare_module, write_module, finish_module): Adjust.
* parser.c (cp_parser_module_declaration): Adjust,
gcc/testsuite/
* g++.dg/modules/mod-decl-5_b.C: Adjust.
2017-04-27 Nathan Sidwell <nathan@acm.org>
Kill rt_import popping madness
gcc/cp/
* module.c (cpm_serial::rt_export): New tag.
(cpms_in::tag_import): Do the importing right now.
(cpms_in::read_item): ... not here.
(read_module): Pass in dump file name, open it if needed.
Kill walk_namespaces
gcc/cp/
* cp-tree.h (walk_namespaces): Delete.
* decl.c (walk_namespaces_r, walk_namespaces): Delete.
Rework module namespace walking
gcc/cp/
* name-lookup.h: (decapsulate_binding): Declare.
* name-lookup.c: (decapsulate_binding): New.
* module.c (cpms_out::walk_namespace): Iterate over namespace
bindings, not decls.
(imported_modules): Key by lang_identifier. Adjust
allocation/deletion.
Refix unhidden extern C
Revert 2017-04-26 extern_c_slot patch.
gcc/cp/
* name-lookup (do_pushdecl): Call check_extern_c_conflict when
unhiding.
gcc/testsuite/
* g++.dg/lookup/extern-c-redecl.C: Adjust.
* g++.dg/lookup/extern-c-hidden.C: New test.
Merge trunk r247281.
gcc/
* tree.c (type_hash_default): Hash TYPE_TYPELESS_STORAGE.
gcc/objc/
* objc-gnu-runtime-abi-01.C (objc_add_static_instance): Use
pushdecl langhook.
2017-04-26 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (extern_c_slot): New.
(check_extern_c_conflict): Use it.
(unhidden_extern_c): New.
(do_pushdecl): Call it.
gcc/cp/
* name-lookup.c (extern_c_slot): New.
(check_extern_c_conflict): Use it.
(unhidden_extern_c): New.
(do_puhdecl): Call it.
Die IDENTIFIER_GLOBAL_BINDINGS! Die!
gcc/
* ipa-devirt.c (default_hash_traits <type_pair>): Add GTY((skip))s.
gcc/cp/
* cp-tree.h (lang_identifier): Remove namespace_bindings.
(default_hash_traits<lang_identifier *>): Specialization.
(IDENTIFIER_NAMESPACE_BINDINGS): Delete.
(lang_decl_ns): Add bindings map.
(DECL_NAMESPACE_BINDINGS): New.
* lex.c (maybe_add_lang_decl_raw): Allocate namespace binding map.
* name-lookup.c (create_namespace_binding): Delete.
(find_namespace_binding): Split into ...
(find_or_create_namespace_slot, find_namespace_slot): ... these.
Update all callers.
(extern_c_fns): Change to identifier map.
* ptree.c (cxx_print_identifier): Remove IDENTIFIER_NAMESPACE_BINDINGS.
2017-04-25 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (find_namespace_binding): Return slot
pointer. Adjust all callers.
(update_binding): Add slot pointer arg. Adjust.
(check_extern_c_conflict): Cons up list of fns.
(c_linkage_bindings): Use extern_c_fns map.
gcc/cp/
* name-lookup.c (extern_c_fns): New hash.
(check_extern_c_conflict): Reimplement using hash map.
(do_pushdecl): Move check_extern_c_conflict later.
Namespace stat hack via special overload
gcc/cp/
* name-lookup.c (STAT_HACK_P, STAT_TYPE, STAT_DECL,
MAYBE_STAT_DECL, MAYBE_STAT_TYPE): New.
(stat_hack): New.
(find_namespace_value, name_lookup::search_namespace_only,
update_binding, do_pushdecl, set_identifier_type_value_with_scope,
set_global_value, lookup_type_scope_1, do_pushtag): Adjust.
2017-04-24 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (add_local_decl): Delete.
(name_lookup::add): Fold into ...
(name_lookup::search_namespace_only): ... here.
(update_binding): Allow pushing the same artificial type.
(do_pushdecl): Explicitly set namespace type.
(push_local_binding): Use add_decl_to_level.
(set_identifier_type_Value_with_scope): Use update_binding for
namespaces.
gcc/cp/
* name-lookup.c (do_nonmember_using_decl): Pass in pointers to
value and type nodes.
(do_local_using_directive): Use current_binding_level directly.
(do_toplevel_using_directive): Adjust.
(lookup_type_current_level): Delete.
gcc/cp/
* name-lookup.c (diagnose_name_conflict): Check decl context.
(do_nonmember_using_decl): Simplify.
gcc/testsuite/
* g++.dg/lookup/using13.C: Adjust error.
* g++.dg/lookup/using59.C: Likewise,
gcc/cp/
* cp-tree.h (SET_IDENTIFIER_GLOBAL_VALUE): Update.
* name-lookup.h (set_namespace_value): Rename to ....
(set_global_value): ... here.
* name-lookup.c (update_namespace_binding): Delete.
(set_namespace_value): Rename to ....
(set_global_value): ... here. Update binding directly.
2017-04-20 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (ovl_lookup_keep, ovl_lookup_mark, ovl_lookup_add,
ovl_lookup_maybe_add): Rename to ...
(lookup_keep, lookup_mark, lookup_add, lookup_maybe_add): ... these.
Keep overloads correctly ordered
gcc/cp/
* cp-tree.h (ovl_iterator::unhide): Reimplement.
(ovl_iterator::replace, ovl_iterator::ovl_unhide): Delete.
(ovl_iterator::remove_node, ovl_iterator::unhide_node): Declare.
(ovl_insert, ovl_lookup_maybe_add): Declare.
* name-lookup.c (adl_lookup::add_functions): Adjust.
(do_lookup_arg_dependent): Adjust.
(do_nonmember_using_decl): Adjust.
* pt.c (make_constrained_auto, do_class_deduction): Adjust.
* tree.c (ov_move_unhidden, ovl_add): Delete.
(ovl_copy, ovl_insert): New.
(ovl_iterator::unhide_node, ovl_iterator::remove_node): New.
(ovl_lookup_mark, ovl_lookup_add): Adjust.
(ovl_lookup_maybe_add): New.
(ovl_lookup_keep, ovl_skip_hidden): Adjust.
(ovl_iterator::ovl_unhide, ovl_iterator::replace): Delete.
* class.c (add_method): Adjust.
2017-04-14 Nathan Sidwell <nathan@acm.org>
Kill per-namespace static_decls.
gcc/cp/
* cp-tree.h (static_decls): Declare.
(wrapup_globals_for_namespace,
diagnose_inline_vars_for_namespace): Replace with ...
(wrapup_namespace_globals): ... this.
* decl.c (static_decls): Define.
(wrapup_globals_for_namespace,
diagnose_inline_vars_for_namespace): Replace with ...
(wrapup_namespace_globals): ... this.
(cxx_init_decl_processing): Initialize static_decls.
* decl2.c (c_parse_final_cleanups): Adjust.
* name-lookup.h (cp_binding_level): Remove static_decls member.
* name-lookup.c (add_decl_to_level): Adjust.
(begin_scope): Adjust.
Merge namespace and local scope binding update
gcc/cp/
* name-lookup.c (add_namespace_decl): Delete.
(namespace_push_binding, local_push_binding): Merge into ...
(update_binding): ... this.
(do_pushdecl): Adjust.
2017-04-13 Nathan Sidwell <nathan@acm.org>
Cleanups
gcc/cp/
* lex.c (unqualified_name_lookup_error): Use pushdecl.
* name-lookup.h (push_local_binding): Delete.
* name-lookup.c (add_decl_to_level): New, combining
add_namespace_decl, add_local_decl.
(namespace_push_binding, local_push_binding): Adjust.
(do_pushdecl): Adjust.
(push_local_binding): Make static.
Unify binding push part 7
gcc/cp/
* name-lookup.c (namespace_push_binding): Merge duplicate code
from local_push_binding. Chain the decl.
(do_pushdecl): Adjust.
Cleanup pushdecl interface
gcc/cp/
* cp-lang.c (cxx_pushdecl): New.
(LANG_HOOKS_PUSHDECL): Override.
* name-lookup.h (pushdecl): Remove overload. Add default arg.
* name-lookup.c (pushdecl): Likewise.
gcc/c/
* c-tree.h (pushdecl): Declare.
gcc/c-family/
* c-common.c (c_register_builtin_type): Use pushdecl lang hook.
* c-common.h (pushdecl): Don't declare.
Some cleanups
gcc/cp/
* name-lookup.c (update_local_overload): Drop oldval parm.
(replace_local_overload_binding): Delete. Fold into only caller.
(fixup_unhidden_decl): Likewise.
(augment_local_overload_binding): Likewise.
Unifying binding push part 6
gcc/cp/
* name-lookup.c (find_local_binding): New. Broken out of ...
(find_local_value): ... this. Use it.
(update_local_overload): New. Broken out of ...
(replace_local_overload_binding): ... this. Use it.
(do_pushdecl): Keep local binding around.
(local_push_binding): Consume supplement_binding, add_local_decl.
Unifying binding push part 5
gcc/cp/
* name-lookup.c (skip_anticipated_builtins): Kill.
(namespace_push_binding): Consume supplement_binding.
(do_pushdecl): Skip hidden builtin here. Adjust.
gcc/testsuite/
* g++.dg/lookup/using59.C: New.
2017-04-12 Nathan Sidwell <nathan@acm.org>
Unifying binding push part 4
gcc/cp/
* name-lookup.c (namespace_push_binding, local_push_binding):
Don't dup decls here. Deal with using.
(do_pushdecl): Adjust.
gcc/testsuite/
* g++.dg/lookup/using58.C: New.
Unifying binding push part 3
gcc/cp/
* name-lookup.c (create_local_binding) New.
(do_local_push_overload): Turn into ...
(local_push_binding): ... this.
(do_pushdecl): Adjust.
Unifying binding push part 2
gcc/cp/
* name-lookup.c (create_namespace_binding) New.
(find_namespace_binding): Use it.
(do_namespace_push_overload): Convert to ...
(namespace_push_binding): ... this.
(do_pusdecl): Adjust
Unifying binding push part 1
gcc/cp/
* name-lookup.c (do_pusdecl): Skip using decls. Retain namespace.
2017-04-11 Nathan Sidwell <nathan@acm.org>
Separating namespace bindings part 15
gcc/cp/
* cp-tree.h (PUSH_GLOBAL, PUSH_LOCAL, PUSH_USING): Delete.
* lex.c (unqualified_name_lookup_error): Adjust push_local_binding
call.
* name-lookup.h (push_local_binding): Flags is now bool.
* name-lookup.c (matching_using_decl_p): Rename to ...
(matching_fn_p): ... here. Update callers.
(set_local_extern_decl_linkage): New. Broken out of ...
(do_pushdecl): ... here. Call it.
(push_local_binding, augment_local_overload_binding,
do_local_push_overload, do_local_using_decl): Flags is now bool.
gcc/testsuite/
* g++.dg/lookup/extern-redecl1.C: New.
* g++.dg/parse/ctor9.c: tweak.
Separating namespace bindings part 14
gcc/cp/
* friend.c (do_friend): Use pushdecl directly.
* name-lookup.h (lookup_name_innermost_nonclass_level): Delete.
* name-lookup.c (find_local_value): New. Broken out of ...
(lookup_name_innermost_nonclass_level_1): ... here. Call
it. Rename to ...
(lookup_name_innermost_nonclass_level): ... this. Delete external
entry point.
(do_pushdecl): Start handling binding levels directly. Check
local class friend injection rule. More cleanup.
gcc/testsuite/
* g++.dg/lookup/friend12.C: Augment & adjust.
* g++.old-deja/g++.jason/scoping12.C: Adjust.
Separating namespace bindings part 13
gcc/cp/
* name-lookup.c (do_pushdecl): Some cleanups.
Separating namespace bindings part 12
gcc/cp/
* name-lookup.c (do_pushdecl): Move overload pushing next to
non-overload pushing.
2017-04-10 Nathan Sidwell <nathan@acm.org>
Separating namespace bindings part 11
gcc/cp/
* name-lookup.c (check_local_shadow): Move lookup code to here ...
(do_pushdecl): ... from here.
Separating namespace bindings part 10
gcc/cp/
* name-lookup.c (do_pushdecl): Reorder & delete more obsolete code.
Separating namespace bindings part 9
gcc/cp/
* name-lookup.c (do_pushdecl): Delete a tonne of obsolete code.
2017-04-07 Nathan Sidwell <nathan@acm.org>
Fix bogus scope handling
gcc/cp/
* call.c (make_temporary_var_for_ref_to_temp): Push temp into
current scope.
* decl.c (xref_tag_1): Pass ts_lambda to pushtag.
* name-lookup (do_pushtag): Deal with ts_lambda scope.
gcc/testsuite
* g++.dg/cpp0x/forw_enum9.C: Fix testcase.
2017-04-06 Nathan Sidwell <nathan@acm.org>
Separating namespace bindings part 8
gcc/cp/
* name-lookup.c (do_pushdecl): Kill obsolete C-era code!
Separating namespace bindings part 7
gcc/cp/
* name-lookup.c (check_local_shadow, set_decl_context_in_fn): Break
out and simplify from ...
(do_pushdecl): ... here. Call them.
Separating namespace bindings part 6
gcc/c-family/
* c-common.h (pushdecl_top_level): Delete.
gcc/cp/
* name-lookup.h (pushdecl_top_level): Delete non-friendly version.
* name-lookup.c (check_extern_c_conflict): New.
(lookup_extern_c_fun_in_all_ns): Delete.
(do_pushdecl): Call it. Rename variables sanely.
(pushdecl_top_level): Delete non-friendly version.
2017-04-05 Nathan Sidwell <nathan@acm.org>
Separating namespace bindings part 5
gcc/cp/
* name-lookup.h (getdecls): Rename to ...
(get_local_decls): ... here.
* name-lookup.c (pop_bindings_and_leave_scope): Adjust.
(do_pushdecl): Add some asserts.
(getdecls): Rename to ...
(get_local_decls): ... here. Assert local scope.
* decl.c (poplevel): Adjust.
(start_preparsed_function): Don't set current_function_decl, until
decl is pushed.
(store_parm_decls): Adjust.
* parser.c (synthesize_implicit_template_parm): Adjust.
Separating namespace bindings part 4
gcc/cp/
* cp-lang.c (LANG_HOOKS_GETDECLS): Override.
(get_global_decls): New.
* decl.c (poplevel): Assert not in namespace. Simplify.
* name-lookup.c (pop_binding): Rename to ...
(pop_local_binding): ... here.
(pop_bindings_and_leave_scope): Adjust.
(getdecls): Assert not in namespace.
* name-lookup.h (pop_binding): Rename to ...
(pop_local_binding): ... here.
Separating namespace bindings part 3
gcc/cp/
* name-lookup.c (do_local_push_overload): New, split out of ...
(push_overloaded_decl_1): ... this. Delete.
(push_overloaded_decl): Delete.
(do_pushdecl): Adjust.
Separating namespace bindings part 2
gcc/cp/
* name-lookup.c (compparms_for_decl_and_using_decl): Replace with ...
(matching_using_decl_p): ... this.
(do_namespace_push_overload): New, split out of ...
(push_overloaded_decl_1): ... this.
(do_pushdecl): Adjust.
(do_nonmember_using_decl): Adjust.
2017-04-04 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.h (get_global_value_if_present,
is_typename_at_global_scope): Delete.
* class.c (build_vtbl_initializer): Adjust.
* decl.c (grokdeclarator)
* except.c (do_get_exception_ptr, do_begin_catch, do_end_catch,
do_allocate_exception, do_free_exception, build_throw): Adjust.
* init.c (throw_bad_array_new_length): Adjust.
* rtti.c (throw_bad_cast, throw_bad_typeid): Adjust.
gcc/cp/
* cp-tree.h (CPTI_INIT_LIST_IDENTIFIER, init_list_identifier): New.
* decl.c (initialize_predefined_identifiers): Initialize
initializer_list identifier.
* call.c (is_std_init_list): Adjust.
* name-lookup.c (do_pushtag): Likewise.
* pt.c (listify): Likewise.
Separating namespace bindings part 1
gcc/cp/
* name-lookup.h (namespace_binding, set_namespace_binding):
Replace with ...
(get_namespace_value, set_namespace_value): ... these.
(get_global_value_if_present, is_typename_at_global_scope): Adjust.
* cp-tree.h (IDENTIFIER_GLOBAL_VALUE,
SET_IDENTIFIER_GLOBAL_VALUE): Adjust.
(IDENTIFIER_NAMESPACE_VALUE, SET_IDENTIFIER_NAMESPACE_VALUE): Delete.
* pt.c (listify): Use get_namespace_value.
* decl.c (poplevel): Use get_namespace_value.
* name-lookup.c (cp_binding_level_find_binding_for_name): Replace
with ...
(find_namespace_binding): ... this.
(update_namespace_binding, find_namespace_value,
add_namespace_decl, add_local_decl): New.
(name_lookup::search_namespace_only,
adl_lookup::assoc_namespace_only): Adjust.
(binding_for_name, add_decl_to_level): Delete.
(fixup_unhidden_decl, do_pushdecl, push_local_binding,
check_for_out_of_scope_variable,
set_identifier_type_value_with_scope, push_overloaded_decl_1): Adjust.
(namespace_binding_1, namespace_binding): Replace with ...
(get_namespace_value): ... this.
(set_namespace_binding_1, set_namespace_binding): Replace with ...
(set_namespace_value): ... this.
(do_toplevel_using_decl, lookup_type_scope_1,
lookup_name_innermost_nonclass_level_1, do_push_nested_namespace,
push_namespace): Adjust.
2017-04-03 Nathan Sidwell <nathan@acm.org>
Merge trunk r246647.
gcc/cp/
* pt.c (): Adjust guiding decl code.
libcc1/
* libcp1plugin.cc (safe_pushdecl_maybe_friend): Adjust.
(plugin_make_namespace_inline): Adjust.
(plugin_add_using_namespace): Likewise.
Remove usings graph.
gcc/cp/
* cp-tree.h (lang_decl_ns): Replace tree list ns_using, ns_users
with tree vector usings & inlinees.
(DCL_NAMES_SPACE_USING, DECL_NAMESPACE_INLINEES): Update.
(TREE_INDIRECT_USING): Delete.
* decl.c (cxx_init_decl_processing): Tweak.
* name-lookup.h (cp_binding_level): using_directives is a vec.
* name-lookup.c (name_lookup::do_queue_usings, queue_usings,
search_namespace, search_usings, queue_namespace,
search_unqualified, assoc_namespace_only): inlinees and usings are
vectors. Remove old TREE_LIST code.
(namespace_ancestor_1, namespace_ancestor, add_using_namespace_1,
add_using_namespace): Delete.
(qualified_namespace_lookup): Tweak.
(add_using_directive): New.
(do_toplevel_using_directive, do_local_using_directive): Adjust.
(push_namespace): Adjust.
* tree.c (decl_anon_ns_mem_p): Reimplement.
(cp_free_lang_data): Update.
2017-03-31 Nathan Sidwell <nathan@acm.org>
Reimplement unqualified namespace lookup
gcc/cp/
* name-lookup.c (name_lookup::state, name_lookup::preserve_state,
name_lookup::restore_state): New.
(name_lookup::queue_namespace,
name_lookup::do_queue_usings, name_lookup::queue_usings,
name_lookup::search_unqualified): New.
(unqualified_namespace_lookup_1): Kill.
(unqualified_namespace_lookup): Adjust.
(lookup_using_namespace): Kill.
gcc/testsuite/
* g++.dg/lookup/lambda1.C: New.
gcc/cp/
* name-lookup.c (name_lookup::scopes): Make static. Adjust uses.
(name_lookup::search_namespace_only): Broken out of ...
(name_lookup::search_namespace): ... here. Call it.
* tree.c (ovl_cache): New.
(ovl_make, ovl_lookup_keep): Use it.
2017-03-30 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* dump.c (cp_dump_tree): Allow nested overloads.
Add SCOPE_DEPTH
gcc/cp/
* cp-tree.h (SCOPE_DEPTH): New.
* decl.c (cxx_init_decl_processing): Set current_namespace.
* name-lookup.h (is_nested_namespace): Declare.
(is_associated_namespace): Delete.
* name-lookup.c (is_nested_namespace): New.
(is_ancestor): Use is_nested_namespace for namespaces.
(set_decl_namespace): Use is_nested_namespace.
(namespace_ancestor_1): Likewise.
(is_associated_namespace): Delete.
(push_namespace): Set SCOPE_DEPTH.
* pt.c (check_specialization_namespace): Use is_nested_namespace.
(check_unqualified_spec_or_inst): Likewise.
Reimplement qualified namespace lookup
gcc/cp/
* name-lookup.c (cp_binding_level_find_binding_for_name): Remove
premature optimiation.
(find_binding): Delete.
(name_lookup): Add flags, move scopes from adl_lookup.
(name_lookup::search_namespace, search_usings, search_qualified): New.
(tree_vec_contains): Kill.
(qualified_namespace_lookup): Kill old O(N^2) code.
gcc/cp/
* pt.c (determine_specialization): Use 2-d iterator
2017-03-29 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* cp-tree.h (LOOKUP_MARKED_P, RECORD_MARKED_P): Rename to ...
(LOOKUP_SEEN_P, LOOKUP_FOUND_P): ... here. Update everywhere.
gcc/cp/
* name-lookup.c (arg_assoc::assoc_expr): Refactor.
(do_lookup_arg_dependent): Renamed from lookup_arg_dependent_1.
(lookup_arg_dependent): Adjust.
(qualified_namespace_lookup): Renamed from
qualified_lookup_using_namespace.
Kill DECL_NAMESPACE_ASSOCATIONS
gcc/cp/
* cp-tree.h (DECL_NAMESPACE_INLINE_P): Renamed.
(DECL_NAMESPACE_ASSCIATIONS): Delete.
(DECL_NAMESPACE_INLINEES): New.
* name-lookup.c (adl_lookup::assoc_namespace_only): New.
(adl_lookup::assoc_namespace): Find parent, walk from there.
(is_associated_namespace): Walk inline namespace tree.
(push_namepace): Add to INLINEES not ASSOCIATIONS.
gcc/cp/
* lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p.
* method.c (implicitly_declare_fn): Likewise.
* search.c (node_debug_info_needed): Likewise.
gcc/cp/
* name-lookup.h (finish_namespace_using_directive): Rename from
...
(finish_toplevel_using_directive): ... here.
* name-lookup.c: Likewise.
* parser.c (cp_parser_using_directive): Adjust.
2017-03-28 Nathan Sidwell <nathan@acm.org>
Cleanup pushdecl_top_level
gcc/cp/
* cp-tree.h (pushdecl_top_level_maybe_friend,
pushdecl_top_level_and_finish): Delete.
* decl.c (cp_make_fname_decl): Adjust.
* decl2.c (get_guard, handle_tls_init): Likewise.
* pt.c (tsubst_friend_class): Likewise.
* rtti.c (get_tinfo_decl, tinfo_base_init): Likewise.
* name-lookup.h (pushdecl_top_level, pushdecl_top_level_init): Declare.
* name-lookup.c (pushdecl_top_level_1): Rename to ...
(push_decl_top_level): ... here.
(pushdecl_top_level_init): New.
(pushdecl_top_level_maybe_friend): Delete.
(pushdecl_top_level_and_finish): Delete.
Cleanup pushdecl
gcc/cp/
* cp-tree.h (pushdecl, pushdecl_maybe_friend): Delete.
(pushtag): Delete.
* decl.c (cp_make_fname_decl): Call pushdecl_outermost_localscope.
* lambda.c (insert_capture_proxy): Likewise.
* friend.c (do_friend): Call overloaded pushdecl.
* name-lookup.h (pushdecl_with_scope): Delete.
(pushdecl, pushtag, pushdecl_outermost_localscope): Declare.
* name-lookup.c (pushdecl_maybe_friend_1): Rename to ...
(do_pushdecl): ... here.
(pushdecl_maybe_friend): Replace with overloaded pushdecl.
(pushdecl): Adjust.
(pushdecl_with_scope_1): Rename to do_pushdecl_with_scope. Adjust.
(pushdecl_with_scope): Delete.
(pushdecl_outermost_localscope): New.
(pushdecl_namespace_level): Adjust.
(do_pushtag): Renamed from pushtag_1.
(pushtag): Adjust.
Cleanup namespace push/pop part 2
gcc/cp/
* module.c (cpms_in::finish_namespace): Adjust.
(push_module_namespace): Adjust.
* name-lookup.c (push_namespace, pop_namespace): Reimplement.
(make_namespace_inline): Delete.
* name-lookup.h (push_namespace): Change prototype.
* parser.c (cp_parser_namespace_definition): Adjust.
Cleanup namespace push/pop part 1
gcc/cp/
* cp-tree.h (CPTI_GLOBAL, CPTI_GLOBAL_IDENTIFIER, CPTI_GLOBAL_TYPE,
CPTI_ANON_IDENTIFIER): New.
(global_namespace, global_identifier, global_type_node,
anon_identifier): New.
* decl.c (global_type_node, global_scope_name): Delete.
(initialize_predefined_identifiers): Add new idents.
(cxx_init_decl_processing): Adjust.
* name-lookup.h (global_namespace, global_scope_name,
global_type_node): Delete.
* name-lookup (global_namespace, anonymous_namespace_name,
get_anonomous_namespace_name): Delete.
(do_push_nested_namespace, do_pop_nested_namespace): New.
(push_nested_namespace, pop_nested_namespace): Reimplement.
Cleanup using-directives
gcc/cp/
* cp-tree.h (LOOKUP_MARKED_P): Rename from NAME_MARKED_P, update all.
* name-lookup.h (finish_toplevel_using_directive,
finish_local_using_directive): Declare.
(do_using_directive, parse_using_directive): Delete.
* name-lookup.c (do_using_directive): Delete.
(do_toplevel_using_directive): Reimplement.
(do_local_using_directive, do_local_using_directive_1): New.
(parse_using_directive): Delete.
(push_using_directive, push_using_directive_1): Delete.
(finish_toplevel_using_directive, finish_local_using_directive): New.
* pt.c (tsubst_expr): Adjust.
* parser.c (cp_parser_using_directive): Adjust.
Kill strong using
gcc/
* doc/extend.texi (Namespace Association): Document removal.
gcc/cp/
* name-lookup (parse_using_directive): Remove strong handling.
gcc/testsuite/
* g++.dg/lookup/strong-using-6.C: New.
2017-03-27 Nathan Sidwell <nathan@acm.org>
Simplify ADL part 2
gcc/cp
* cp-tree.h (RECORD_MARKED_P): New.
* tree.c (ovl_lookup_keep): Allow NULL.
* name-lookup.c (struct adl_lookup): New.
(struct arg_lookup): Delete.
2017-03-24 Nathan Sidwell <nathan@acm.org>
gcc/
* tree.h (TREE_CHECK6): New.
(tree_check6): New.
gcc/cp/
* cp-tree.h (NAME_MARKED_P): Add UNION_TYPE.
* name-lookup.c (arg_lookup): Replace namespace & class vectors
with visited.
(arg_assoc_namespace, arg_assoc_class): Use NAME_MARKED_P.
(lookup_arg_dependent_1): Unmark namespaces and classes.
gcc/cp/
* cp-tree.h (ovl2_iterator::operator++): Tweak.
Simplify ADL part 1
gcc/cp/
* cp-tree.h (OVL_LOOKUP_P, NAME_MARKED_P): New.
(OVL_TRANSIENT_P): Morph into ...
(OVL_USED_P): ... this.
(ovl_add_transient): Kill.
(ovl_maybe_keep): Replace with ...
(ovl_lookup_keep): ... this.
(ovl_lookup_mark, ovl_lookup_add): Declare.
* tree.c (ovl_add): Rename arg. Set OVL_LOOKUP_P.
(ovl_add_transient): Kill.
(ovl_lookup_mark, ovl_lookup_add): New.
(ovl_maybe_keep): Rename to ...
(ovl_lookup_keep): ... this. Adjust.
* name-lookup.c (name_lookup::add): Use ovl_add directly.
(struct arg_lookup): Kill args and fn_set.
(add_function): Replace with ...
(add_functions): ... this.
(arg_assoc_namespace, arg_assoc_class_only): Use it.
(lookup_arg_dependent_1): Use new API.
* pt.c (tsubst_copy): Assert OVERLOAD is marked used.
* semantics.c (finish_call_expr): Adjust.
2017-03-23 Nathan Sidwell <nathan@acm.org>
Fixup transient_p bug
gcc/cp/
* tree.c (ovl_add): Set TRANSIENT_P here.
(ovl_add_transient): Not here.
gcc/cp/
* cp-tree.h (type_unknown_p): Make inline. Lose TREE_LIST case.
* tree.c (type_unknown_p): Delete.
* name-lookup.c (arg_assoc): Lose TREE_LIST case.
gcc/cp/
* cp-tree.h (OVL_P, OVL_PLURAL_P): New.
* name-lookup.c (name_lookup::add, diagnose_name_conflict,
pushdecl_maybe_friend_1, push_overloaded_decl_1,
do_nonmember_using_decl, push_class_level_binding_1,
set_decl_namespace, lookup_arg_dependent_1): Use OVL_P.
Two dimensional OVERLOADs
gcc/cp/
* cp-tree.h (OVL_FIRST): Call ovl_first.
(ovl_iterator): Add allow_inner, adjust.
(ovl2_iterator): New.
(ovl_first): New.
* name-lookup.c (name_lookup::add): Create 2d overload.
(do_nonmember_using_decl): 2D overload.
(lookup_arg_dependent_1, cp_emit_debug_info_for_using): Likewise.
* call.c (add_candidates): Likewise.
* class.c (resolve_address_of_overloaded_function): Likewise.
* parser.c (cp_parser_template_name): Likewise.
* pt.c (type_dependent_expression_p): Likewise.
(print_candidates_1): Likewise.
* ptree.c (cxx_print_xnode): Allow inner overload.
* semantics.c (finish_call_expr): Keep overload, 2D overload.
* tree.c (ovl_scope): Allow inner overload.
gcc/testsuite/
* g++.dg/lookup/using57.C: New.
2017-03-22 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (lookup_qualified_name): Unwrap singleton
overload.
(lookup_name_real_1): Remove ovl_hidden assert.
(lookup_arg_dependent_1): Don't skip hidden here.
* parser.c (cp_parser_lookup_name): Don't unwrap singleton
overload here.
2017-03-21 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (lookup_name_real_1): Don's skip hidden here.
Simplify singleton overload extraction.
* tree.c (ovl_add): Assert no unexpected 2 dimensional overloads.
gcc/
* system.h (ATTRIBUTE_NTC_PURE): Define.
* tree.h (tree_fits_shwi_p, tree_fits_uhwi_p): Use it.
Refactor lookup part 1
gcc/cp/
* name-lookup.c (struct name_lookup): New.
(struct scope_binding): Delete.
(EMPTY_SCOPE_BINDING): Delete.
(build_ambigious): New.
(name_lookup::add): New.
(do_nonmember_using_decl): Take pointer to cxx_binding. Adjust.
(do_local_using_decl, do_toplevel_using_decl): Adjust.
(merge_functions, same_entity_p, ambiguous_decl): Delete.
(suggest_alternatives_for): Adjust lookup functions.
(unqualified_namespace_lookup_1): Use name_lookup.
(lookup_qualified_name): Likewise.
(lookup_using_namespace, qualified_lookup_using_namespace): Take a
name_lookup.
gcc/testsuite/
* g++.dg/lookup/using17.C: Adjust error message.
Keep hidden overloads at start of OVERLOAD list
gcc/cp/
* cp-tree.h (OVL_HIDDEN_P): New.
(ovl_iterator::hidden_p, unhide): New.
(DECL_HIDDEN_P): New.
(hidden_name_p, remove_hidden_names): Delete.
(ovl_skip_hidden): Declare.
* decl.c (builtin_function_1): Set DECL_ANTICIPATED before
pushing.
(xref_tag_1): Replace hidden_name_p with DECL_HIDDEN_P.
* name-lookup.c (anticipated_builtin_p,
skip_anticipated_buitins): New.
(supplement_binding_1): Use anticipated_builtin_p.
(replace_local_overload_binding): New. Broken out of
augment_local_overload_binding.
(fixup_unhidden_decl): New.
(pushdecl_maybe_friend_1): Deal with unhiding decl. Set
DECL_ANTICIPATED before really pushing.
(augment_local_overload_binding): Call replace_local_overload_binding.
(push_overloaded_decl_1): Deal with unhiding decl.
(do_nonmember_using_decl): Use anticipated_builtin_p.
(ambiguous_decls): Use ovl_skip_hidden.
(lookup_name_real_1): Use DECL_HIDDEN_P, ovl_skip_hidden.
(arg_assoc_namespace): Use DECL_HIDDEN_P.
(lookup_arg_dependent_1): Use ovl_skip_hidden.
* pt.c (instantiate_class_template): Use DECL_HIDDEN_P.
* tree.c (ovl_move_unhidden): New.
(ovl_add): Deal with hiddenness.
(ovl_add_transient): Adjust.
(hidden_name_p, remove_hidden_names): Delete.
(ovl_skip_hidden): New.
(ovl_iterator::ovl_unhide): New.
gcc/testsuite/
* g++.dg/lookup/friend19.C: New.
* g++.dg/lookup/using56.C: New.
2017-03-16 Nathan Sidwell <nathan@acm.org>
New OVERLOAD representation part 6
gcc/cp/
* cp-tree.h: Move ovl handling fns to original location.
* tree.c (ovl_add): Use ovl_make.
(ovl_add_transient): Use ovl_add.
New OVERLOAD representation part 5
gcc/cp/
* cp-tree.h (OVL_NEXT): Delete. Update uses.
(OVL_CHAIN): Check for overload.
New OVERLOAD representation part 4
gcc/cp/
* cp-tree.h (OVL_CURRRENT): Delete.
(ovl_make): Declare.
* tree.c (ovl_make): New.
* constraint.cc (finish_shorthand_constraint): Use ovl_make.
* typeck.c (build_x_unary_op): Likewise.
New OVERLOAD representation part 3
gcc/cp/
* cp-tree.h: Remove OVLNEW pieces.
* tree.c: Likewise.
New OVERLOAD representation part 2
gcc/cp/
* cp-tree.h (OVL_VIA_USING_P, OVL_TRANSIENT_P, OVL_SINGLE_P): New
names.
* error.c, name-lookup.c, parser.c, search.c, tree.c: Adjust uses.
2017-03-15 Nathan Sidwell <nathan@acm.org>
New OVERLOAD representation part 1
gcc/cp/
* cp-tree.h (OVL_LENGTH, OVL_USINGS, OVL_FIRST, OVL_NAME,
OVL_SINGLE, OVL_ELT, OVL_HAS_USING, OVL_HAS_HIDDEN): New.
(ovl_iterator): Implement new-style iterator.
* tree.c (tree_ovl_elt_check_failed): New.
(ovl_maybe_keep): Fixup bracing.
(ovl_scope): Add new smarts.
Vectorize OVERLOAD part 9
gcc/cp/
* cp-tree.h (build_new_function_call): Lose koenig_p arg.
(OVL_HAS_USING): New.
* call.c (build_new_function_call): Lose koenig_p arg.
* name-lookup.c (augment_local_overload_binding): New. Broken out
of ...
(push_overloaded_decl_1): ... here. Call it.
(do_nonmember_using_decl): Lose augment arg.
(do_local_using_decl): Use augment_local_overload_binding.
(do_toplevel_using_decl): Adjust do_nonmember_using_decl call.
* search.c (lookup_field_r): Use OVL_HAS_USING.
* pt.c (do_class_deduction): Adjust build_new_function_call call.
* semantics.c (finish_call_expr): Likewise.
Vectorize OVERLOAD part 8
gcc/cp/
* cp-tree.h (ovl_add_transient): Declare.
* tree.c (ovl_add_transient): New.
(remove_hidden_names): Build transient.
* name-lookup.c (do_nonmember_using_decl): Add AUGMENT parm,
adjust.
(do_local_using_decl): Ask for newvals from
do_nonmember_using_decl, iterate over that list.
(do_toplevel_using_decl): Ask for augmented vals.
(add_function): Return void. Remove extraneous
checks. Update callers.
* semantics.c (finish_call_expr): Always call ovl_maybe_keep.
Vectorize OVERLOAD part 7
gcc/cp/
* name-lookup.c (hidden_name_p, remove_hidden_names): Move
declarations to ...
* cp-tree.h (hidden_name_p, remove_hidden_names): ... here.
* call.c (build_new_function_call): Remove hidden pruning.
* name-lookup.c (hidden_name_p, remove_hidden_names): Move to
tree.c.
(lookup_name_real_1): Adjust hidden_name_p call.
(lookup_arg_dependent_1): Adjust remove_hidden_names call.
* tree.c (hidden_name_p, remove_hidden_names): Moved from
name-lookup.h. Adjust.
Vectorize OVERLOAD part 6
gcc/cp/
* cp-tree.h (OVL_TRANSIENT): Rename from OVL_ARG_DEPENDENT.
* tree.c (ovl_maybe_keep): Adjust.
* name-lookup.c (set_namespace_binding_1): Use OVL_SINGLE.
(lookup_name_real_1): Use OVL_FIRST.
(add_function): Set OVL_TRANSIENT.
(lookup_arg_dependent_1): Use OVL_FIRST.
(cp_emit_debug_info_for_using): Use iterator.
Add OVERLOAD iterator part 8
gcc/cp/
* name-lookup.c (do_nonmember_using_decl): Use iterators
Add OVERLOAD iterator part 7
gcc/cp/
* name-lookup.c (pushdecl_maybe_friend_1): Use OVL_FIRST.
(push_overloaded_decl_1): Use iterators.
(consider_binding_level): Use OVL_FIRST.
2017-03-14 Nathan Sidwell <nathan@acm.org>
Add OVERLOAD iterator part 6
gcc/cp/
* decl2.c (check_class_fn): Use iterators.
* semantics.c (omp_reduction_lookup): Likewise.
(finish_omp_reduction_clause): Don't OVL_FIRST here.
Vectorize OVERLOAD part 5
gcc/cp/
* cp-tree.h (ovl_maybe_keep): Declare.
* tree.c (ovl_maybe_keep): New.
* semantics.c (finish_call_expr): Call it.
(finish_omp_clauses): Use new accessrs.
* class.c (handle_using_decl): Use new accessors.
(resolve_address_of_overloaded_function): Likewise.
* pt.c (print_candidates_1, print_candidates): Reimplement.
Vectorize OVERLOAD part 5
gcc/cp/
* cp-tree.h (OVL_SINGLE): New.
* constraint.cc (resove_constraint_check): Use new iterator.
(normalize_template_id_expression): Use OVL_FIRST.
* cvt.c (build_expr_type_conversions): Likewise.
* error.c (dump_decl): Use OVL_SINGLE.
* parser.c (cp_parser_nested_name_specifier_opt): Likewise.
* tree.c (is_overloaded_fn): Likewise.
Add OVERLOAD iterator part 5
gcc/cp/
* cp-tree.h (ovl_iterator::via_using_p): New.
(ovl_iterator::replace): New.
(clone_function_decl): Add via_using parm.
* tree.c (ovl_iterator::replace): New.
* class.c (add_method): Use ovl_iterator.
(clone_function_decl): Add via_using parm. Pass it to add_method.
(clone_costructors_and_destructors): Pass via_using.
* pt.c (tsubst_decl, instantiate_template_1): Update
clone_function_decl call.
Change add_method signature
gcc/cp/
* cp-tree.h (add_method): Change 3rd arg.
* class.c (add_method): Change 3rd arg to bool. Update.
(handle_using_decl, one_inheriting_sig, one_inherited_ctor,
clone_function_decl, finish_struct): Update add_method calls.
* lambda.c (maybe_add_lambda_conv_op): Likewise.
* method.c (lazily_declare_fn): Likewise.
* semantics.c (finish_member_declaration): Likewise.
2017-03-13 Nathan Sidwell <nathan@acm.org>
Kill get_first_fn part 3
gcc/cp/
* cp-tree.h (get_first_fn): Delete.
* pt.c (iterative_hash_template_arg, tsubst_copy_and_build): Use
get_ovl.
(tsubst_baselink): Use OVL_NAME.
* typeck.c (invalid_nonstatic_memfn_p, build_x_unary_op,
cp_build_addr_expr_1): Use get_ovl.
(finish_class_member_access_expr): Use OVL_NAME.
* tree.c (dependent_name): Recode.
(get_first_fn): Delete.
Kill get_first_fn part 2
gcc/cp/
* cp-tree.h (get_ovl): Add want_first parm, make pure.
* constexpr.c (potential_constant_expression_1): Adjust get_ovl.
* lambda.c (lambda_function): Likewise.
* error.c (dump_decl): Use identifier_p.
* mangle.c (write_expression): Use OVL_NAME.
* name-lookup.c (pushdecl_class_level): Likewise.
* parser.c (cp_parser_postfix_expression,
cp_parser_expression_statement, cp_parser_direct_declarator,
cp_parser_constructor_declarator_p): Use get_ovl.
* search.c (lookup_member0: Likewise.
* typeck2.c (cxx_incomplete_type_diagnostic): Likewise.
* semantics.c (perform_koenig_lookup): Use OVL_NAME.
(finish_call_expr, finish_id_expression): Use get_ovl.
* tree.c (get_ovl): Add want_first arg, adjust.
Kill get_first_fn part 1
gcc/cp/
* call.c (add_list_candidates, build_new_method_call_1): Use
OVL_FIRST directly.
* constraint.cc (function_concept_check_p): Likewise.
* name-lookup.c (validate_nonmember_using_decl): Likewise.
* constexpr.c (potential_constant_expression_1): Use ovl_fns &
OVL_FIRST.
* lambda.c (lambda_function): Likewise.
* decl.c (grokdeclarator): Use OVL_NAME.
* error.c (dump_decl): Likewise.
* friend.c (do_friend): Likewise.
* mangle.c (write_expression): Likewise.
Kill get_fns
gcc/cp/
* cp-tree.h (get_ovl): New.
(get_fns): Delete.
* parser.c (cp_parser_nested_name_specifier_opt): Update.
* search.c (shared_member_p): Update.
* semantics.c (omp_reduction_lookup): Update.
Kill ovl_cons
gcc/cp/
* cp-tree.h (ovl_cons): Delete.
* tree.c (ovl_cons): Delete.
* class.c (add_method): Use ovl_add.
* name-lookup.c (push_overloaded_decl_1): Likewise.
* pt.c (check_explicit_specialization, do_class_deduction): Likewise.
* typeck.c (build_x_unary_op): Likewise.
Kill build_overload
gcc/cp/
* cp-tree.h (ovl_add): Declare.
(build_overload): Delete.
* tree.c (ovl_add): New.
(build_overload): Delete.
* class.c (add_method): Use ovl_add.
* constraint.cc (finish_shorthand_constraint): Likewise.
* name-lookup.c (do_nonmember_using_decl, merge_functions,
remove_hidden_names, add_function): Likewise.
* pt.c (make_constrained_auto): Likewise.
Rename OVL_USED
gcc/cp/
* cp-tree.h (OVL_USED): Rename to ...
(OVL_VIA_USING): ... here.
* class.c (add_method): Update.
* tree.c (ovl_scope): Update.
* search.c (lookup_field_r): Update.
* name-lookup.c (push_overloaded_decl_1,
do_nonmember_using_decl): Update.
Add OVERLOAD iterator part 4
gcc/cp/
* tree.c (cp_tree_equal): Use ovl_iterator.
Vectorize OVERLOAD part 4
gcc/cp/
* cp-tree.h (ovl_iterator::ref): New.
* semantics.c (finish_omp_reduction_clause): Use OVL_FIRST.
* tree.c (is_overloaded_fn, get_fns): Likewise.
2017-03-10 Nathan Sidwell <nathan@acm.org>
Vectorize OVERLOAD part 3
gcc/cp/
* search.c (lookup_field_fuzzy_info::fuzzy_lookup_fn,
lookup_conversion_operator, lookup_fnfields_idx_nolazy,
lookup_conversions_r): Use new accessors.
Vectorize OVERLOAD part 2
gcc/cp/
* decl2.c (mark_used): Use new accessors.
* dump.c (cp_dump_tree): Likewise.
* error.c (dump_decl, dump_expr, location_of): Likewise.
* init.c (build_offset_ref): Likewise.
* parser.c (cp_parser_nested_name_specifier_opt,
cp_parser_lookup_name): Likewise.
* pt.c (check_explicit_specialization, check_template_shadow,
tsubst_baselink): Likewise.
* ptree.c (cxx_print_xnode): Likewise.
Vectorize OVERLOAD part 1
gcc/cp/
* cp-tree.h (OVL_FIRST, OVL_NAME): New accessors.
* call.c (build_user_type_conversion_1,
print_error_for_call_failure, add_candidates): Use them.
* class.c (method_name_cmp, resort_method_name_cmp,
resort_type_method_vec, finish_struct_methods, warn_hidden,
resolve_address_of_overloaded_function,
note_name_declared_in_class): Likwise.
* cxx-pretty-print.c (pp_cxx_unqualified_id, pp_cxx_qualified_id,
cxx_pretty_printer::id_expression,
cxx_pretty_printer::expression): Likewise.
* decl.c (poplevel): Likewise.
* mangle.c (write_member_name): Likewise.
* method.c (strip_inheriting_ctors): Likewise.
* typeck.c (cp_build_addr_expr_1): Likewise.
Makefile-supplied timestamp.
gcc/cp
* Make-lang.in: Provide MODULE_STAMP.
* module.c (cpm_stream::version): Use MODULE_STAMP, not __DATE__ &
__TIME__.
Add OVERLOAD iterator part 3
gcc/cp/
* name-lookup.c (pushdecl_maybe_friend_1,
lookup_extern_c_fun_in_all_ns, c_linkage_bindings,
set_decl_namespace, pushdecl_top_level_and_finish (tree x,
merge_functions, remove_hidden_names, arg_assoc_namespace,
arg_assoc, lookup_arg_dependent_1, cp_emit_debug_info_for_using):
Use new iterator.
* pt.c (retrieve_specialization, iterative_hash_template_arg,
determine_specialization, check_explicit_specialization,
resolve_overloaded_unification, resolve_nondeduced_context,
type_dependent_expression_p, dependent_template_p,
do_class_deduction): Likewise.
Add OVERLOAD iterator part 2
gcc/cp/
* class.c (handle_using_decl,
maybe_warn_about_overly_private_class, modify_all_vtables,
get_basefndecls, warn_hidden, add_implicitly_declared_members,
adjust_clone_args, deduce_noexcept_on_destructors, default_ctor_p,
in_class_defaulted_default_constructor, user_provided_p,
type_has_user_provided_constructor,
type_has_user_provided_or_explicit_constructor,
type_has_virtual_destructor, type_has_move_constructor,
type_has_move_assign, type_has_user_declared_move_constructor,
type_build_ctor_call, type_build_dtor_call,
type_requires_array_cookie, explain_non_literal_class,
finish_struct, resolve_address_of_overloaded_function): Use new
iterator.
* decl2.c (maybe_warn_sized_delete): Likewise.
* parser.c (cp_parser_template_name): Tweak loop exit test.
* semantics.c (finish_call_expr): Likewise.
* typeck.c (check_template_keyword): Likewise.
Add OVERLOAD iterator, part 1
Add MAYBE_BASELINK_FUNCTIONS
gcc/cp/
* cp-tree.h (struct ovl_iterator): New.
(MAYBE_BASELINK_FUNCTIONS): New.
* call.c (build_op_call_1, add_candidates,
build_op_delete_call): Use new iterator.
* lambda.c (maybe_generic_this_capture): Likewise.
* method.c (inherited_ctor_binfo, binfo_inherited_from): Likewise.
* parser.c (lookup_literal_operator,
cp_parser_template_name): Likewise.
* search.c (shared_member_p, look_for_overrides_here,
lookup_conversions_r): Likewise.
* semantics.c (finish_call_expr,
classtype_has_nothrow_assign_or_copy_p): Likewise.
* typeck.c (check_template_keyword): Likewise.
* tree.c (is_overloaded_fn, get_fns): Use MAYBE_BASELINK_FUNCTIONS.
gcc/cp/
* gcc/cp/cp-tree.h (NAMESPACE_CHECK): Delete.
(MODULE_NAMESPACE_P, GLOBAL_MODULE_NAMESPACE,
NAMESPACE_INLINE_P): Adjust.
gcc/testsuite/
* g++.dg/modules/modules.exp: Protect DEFAULT_CXXFLAGS.
2017-03-06 Nathan Sidwell <nathan@acm.org>
Add crc checkpointing.
gcc/cp/
* module.c (cpm_serial::crc): New.
(cpm_serial::bit_flush): Compute crc.
(cpm_serial::crc_unsigned_n, crc_buffer, crc_unsigned): New.
(cpm_reader::checkpoint, cpm_writer::checkpoint): New.
(cpm_reader, cpm_writer): Add checkpointing to io.
(cpms_in, cpms_out): Likewise.
2017-03-05 Nathan Sidwell <nathan@acm.org>
Optimize crc. Push to trunk
gcc/
* tree.h (crc32_unsigned_n): Declare.
(crc32_unsigned, crc32_unsigned): Make inline.
* tree.c (crc32_unsigned_bits): Replace with ...
(crc32_unsigned_n): ... this.
(crc32_unsigned, crc32_byte): Remove.
(crc32_string): Remove unnecessary braces.
2017-03-04 Nathan Sidwell <nathan@acm.org>
Redo bool read/write
gcc/cp/
* module.c (cpm_serial::bit_flush): New.
(cpm_writer::bytes4, cpm_writer::bflush: New.
(cpm_reader::bytes4, cpm_reader::bflush, cpm_reader::bfill): New.
(cpm_reader::fill): Rename from reserve. Update callers.
(cpm_writer::b, cpm_reader::b): Reimplement.
(cpm_writer::flush_bits, cpm_reader::flush_bits): Delete.
(cpms_out::write_tree_ary, cpms_in::read_tree_ary): Call bflush.
(cpms_out::write_tree, cpms_in::read_tree): Likewise.
Cleanup test pruning. Push to trunk.
gcc/testsuite/g++.dg
* g++-dg.exp (find-cxx-tests): New.
(main): Call it to discover direct tests rather than explicit pruning.
2017-03-03 Nathan Sidwell <nathan@acm.org>
Cleanup retrofit_lang_decl. Push to trunk.
gcc/cp/
* cp-tree.h (add_lang_decl_raw, add_lang_type_raw): Rename.
* lex.c (maybe_add_lang_decl_raw, maybe_add_lang_type_raw): Return
bool. Don't assert.
(retrofit_lang_decl, cxx_make_type): Adjust.
* module.c (cpms_in::read_tree): Verify lang_decl/type insertion
valid.
* class.c (alter_access): Directly call retrofit_lang_decl.
* decl.c (push_local_name, duplicate_decls): Likewise.
* pt.c (push_template_decl_real, txubs_omp_clauses): Likewise.
* semantics.c (omp_privatize_field): Likewise.
Renaming stuff.
gcc/cp/
* module.c: Remove anon namespace, rename seriator, reader,
writer, streamer, in & out.
2017-03-01 Nathan Sidwell <nathan@acm.org>
Black triangle achieved
gcc/cp/
* cp-tree.h (GLOBAL_MODULE_NAMESPACE_P): New.
(add_lang_decl_raw, add_lang_type_raw): Declare.
* lex.c (add_lang_decl_raw): New. Broken out of ...
(retrofit_lang_decl): ... here. Call it.
(add_lang_type_raw): New. Broken out of ...
(cxx_make_type): ... here. Call it.
* module.c (out::write_decl_lang_bools, in::read_decl_lang_bools): New.
(in::~in, in::set_scope): Correct.
(out::write_tree, in::read_tree): Start lang_type/decl handling.
(in::finish_type): Fix canonical type handling.
(in::finish_function): Insert into symbol table.
(in::finish_function): Preserve scope.
gcc/testsuite/
* g++.dg/modules/modules.exp: Add link & execute capability.
* g++.dg/modules/mod-decl-2_b.C: Remove XFAILs.
* g++.dg/modules/mod-decl-2_c.C: Remove XFAILs.
* g++.dg/modules/mod-impl-1_a.C: New.
* g++.dg/modules/mod-impl-1_b.C: New.
* g++.dg/modules/mod-impl-1_c.C: New.
* g++.dg/modules/mod-impl-1_d.C: New.
2017-02-17 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* module.c (in::finish_type): New.
(in::finish): Call it.
(out::write_core_vals, in::read_core_vals): Ensure canonical_type
and type_main_variant are dumped early.
gcc/testsuite/
* g++/modules/mod-exp-1_b.C: Extend.
Canonicalize canonical type hashing
gcc/
* tree.h (type_hash_default): Declare.
* tree.c (type_hash_list, attribute_hash_list): Move into
type_hash_default.
(build_type_attribute_qual_variant): Break out hash code calc into
type_hash_default.
(type_hash_default): New. Generic type hash computation.
(build_range_type_1, build_array_type_1, build_function_type,
build_method_type_directly, build_offset_type, build_complex_type,
make_vector_type): Call it.
gcc/c-family/
* c-common.c (complete_array_type): Use type_hash_default.
2017-02-16 Nathan Sidwell <nathan@acm.org>
Namespace decls!
gcc/cp/
* module.c (out::write_tree_ary, in::read_tree_ary): New.
(out::tag_trees, in::tag_trees): Repurpose.
(in::finish_namespace, in::finish_function): New.
(out::write_tree, in::read_tree): Adjust.
(in::finish): Adjust.
Some actual tree writing & reading
gcc/cp/
* module.c (out::write_core_bools, out::write_core_vals): New.
(in::read_core_bools, in::read_core_vals): New.
(in::set_scope): New.
(out::write_tree, in::read_tree): Call core readers/writers.
Node length & allocation. Global trees.
gcc/cp/
* module.c (streamer::tags): Rename to ...
(streamer::record_tag): ... here. Fixup.
(out::tag_trees, out::start, out::write_loc): New.
(in::tag_trees, in::start, in::finish, in::read_loc): New.
(out::write_tree, in::read_tree): Adjust.
(write_module): Write global trees.
2017-02-15 Nathan Sidwell <nathan@acm.org>
Start of tree reading & writing. Module namespace fix.
gcc/cp/
* cp-tree.h (pop_module_namespace, push_module_namespace): Add flag.
* parser.c (check_module_outermost, cp_parser_module_export,
cp_parser_module_proclamation, cp_parser_namespace_definition): Adjust.
* module.c (pop_module_namespace, push_module_namespace): Add
flag.
(reader::read_tree, writer::write_tree): Initial stubs.
(read_module, write_module, do_import_module, declare_module): Adjust.
gcc/testsuite/
* g++.dg/modules/mod-exp-1_a.C: New.
* g++.dg/modules/mod-exp-1_b.C: New.
* g++.dg/modules/mod-sym-1.C: Add cases.
2017-02-14 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* Make-lang.in (CFLAGS-cp/module.o): New var.
* module.c (reader): Add peek_u.
(reader::str): Force ending NUL.
(writer::flush_bits): Avoid infinite recursion.
(streamer): Extend tags, add next.
(out, in): Add some readers/writers.
(read_module, do_import_module, write_module): Augment.
gcc/testsuite/
* g++.dg/modules/mod-imp-1_a.C
* g++.dg/modules/mod-imp-1_b.C
* g++.dg/modules/mod-imp-1_c.C
* g++.dg/modules/mod-imp-1_d.C
2017-02-10 Nathan Sidwell <nathan@acm.org>
Start actually writing & reading module files. (headers only)
gcc/cp/
* module.c (seriator, reader, writer, streamer, in, out): New
classes.
(read_module, do_import_module, write_module, finish_module): Adjust.
gcc/
* gengtype-lex.l (<in_struct>): Add '/'.
2017-02-09 Nathan Sidwell <nathan@acm.org>
Dump file
gcc/
* dumpfile.h (tree_dump_index): Add TDI_lang.
(TDF_LANG): New.
* dumpfile.c (dump_files): Add front-end.
(dump_option_value_info): Add lang. Adjust all.
gcc/cp/
* cp-tree.h (import_module): Lose is_export parm.
* module.c: Include dumpfile.h
(dopen, dclose): New.
(import_add): Absorb into ...
(do_import_module): ... here. Broken out of ...
(import_module): ... here. Call it.
(export_module, declare_module): Adjust.
(read_module, write_module): Write dump.
gcc/testsuite/
* g++.dg/modules/mod-decl-1.C: Adjust.
* g++.dg/modules/mod-decl-2_b.C: Adjust.
* g++.dg/modules/mod-decl-5_b.C: Adjust.
gcc/cp/
* cp-tree.h (DECL_CHECK): New.
(NAMESPACE_MODULE_P): Rename to ...
(MODULE_NAMESPACE_P): ... here.
(CURRENT_MODULE_NAMESPACE_P): New.
(MODULE_EXPORT_P): New.
(import_module): Add is_export param.
* module.c (mstream, mfname): Delete.
(imported_modules): Make hash_map.
(enum import_kind): New.
(push_module_namespace, pop_module_namespace): Adjust.
(import_add, import_module, export_module): Adjust.
(read_module, write_module): New.
(declare_module, finish_module): Adjust.
* name-lookup.c (is_ancestor): Adjust.
gcc/testsuite/
* g++.dg/modules/mod-decl-5_b.C: Adjust
* g++.dg/modules/modules.exp: Remote host, tweak module deletion.
2017-02-08 Nathan Sidwell <nathan@acm.org>
gcc/cp/
* name-lookup.c (is_ancestor): Pop from module namespace root.
gcc/testsuite/
* g++.dg/modules/mod-sym-3.C: New.
Module namespaces
gcc/cp/
* cp-tree.h (NAMESPACE_MODULE_P): New.
(push_module_namespace, pop_module_namespace): Declare.
* module.c (MOD_SYM_PFX, MOD_SYM_DOT): New.
(module_namespace_name): New.
(push_module_namespace, pop_module_namespace): New.
(module_to_ext): New. Broken out of ...
(module_to_filename): ... here. Call it.
(declare_module): Push to module namespace.
* parser.c (check_module_outermost): Deal with module namespace.
(cp_parser_module_export, cp_parser_module_proclaimation,
cp_parser_namespace_definition): Likewise.
gcc/testsuite/
* g++.dg/modules/mod-decl-1.C: Adjust.
* g++.dg/modules/mod-sym-1.C: New.
* g++.dg/modules/mod-sym-2.C: New.
Cleanup inline namespace creation.
gcc/cp/
* name-lookup.h (make_namespace_inline): Declare.
* name-lookup.c (do_toplevel_using_directive): New.
(do_using_directive): Call it.
(make_namespace_inline): New.
* parser.c (cp_parser_namespace_definition): Call it.
2017-02-07 Nathan Sidwell <nathan@acm.org>
PR c++/79369 inline namespaces
gcc/cp/
* cp-tree.h (NAMESPACE_CHECK): New.
(NAMESPACE_INLINE_P): New.
* name-lookup.h (push_namespace): Return int.
* name-lookup.c (push_namespace): Return int. Adjust.
* parser.c (cp_parser_namespace_definition): Reorder nested
parsing. Check inline redefinition.
gcc/testsuite/
* g++.dg/cpp0x/pr65558.C: Adjust error loc.
* g++.dg/cpp0x/pr79369.C: New.
* g++.dg/cpp1z/nested-namespace-def1.C: Adjust.
2017-02-03 Nathan Sidwell <nathan@acm.org>
Module files open/closed. Testsuite extension
gcc/cp/
* module.c (mstream, mfname): New.
(module_to_filename): New.
(import_module, declare_module, finish_module): Open/close module file.
gcc/testsuite/
* g++.dg/modules/modules.exp (mod_spec_to_file, dg-module-if,
check_module_specs, cleanup_module_files): New.
* g++.dg/modules/mod-decl-0.C: Adjust
* g++.dg/modules/mod-decl-1.C: Adjust
* g++.dg/modules/mod-decl-2_a.C: Adjust
* g++.dg/modules/mod-decl-3.C: New.
* g++.dg/modules/mod-decl-3_a.C: Delete.
* g++.dg/modules/mod-decl-3_b.C: Delete.
* g++.dg/modules/mod-decl-4.C: Adjust
* g++.dg/modules/mod-decl-5_a.C: Adjust
* g++.dg/modules/mod-decl-5_b.C: Adjust
* g++.dg/modules/proclaim-1.C: Adjust
Module names are identifiers.
gcc/cp/
* config-lang.in (gtfiles): Add modules.c.
* c-tree.h (module_name_t): Delete.
(finish_module): Declare.
* decl2.c (c_pare_final_cleanups): Call finish_module.
* module.c: Change module_name_t to tree.
(imported_module): Hash of module names.
(import_add): New.
(import_module, declare_module): Use it.
(export_module): Import module.
(finish_module): New.
* parser.c (cp_parser_module_name): Build up identifier. Adjust
callers.
gcc/testsuite/
* g++.dg/modules/mod-decl-0.C: Adjust.
* g++.dg/modules/mod-decl-1.C: Adjust.
* g++.dg/modules/mod-decl-2_b.C: Adjust.
* g++.dg/modules/mod-decl-2_c.C: New.
* g++.dg/modules/mod-decl-5_a.C: New.
* g++.dg/modules/mod-decl-5_b.C: New.
2017-02-02 Nathan Sidwell <nathan@acm.org>
[[interface]]
gcc/cp
* cp-tree.h: Adjust module interface fns.
* modules.c (is_interface): New.
(push_module_export, pop_module_export, module_exporting_level):
Adjust.
(module_proclaim): Delete.
(module_interface_p): New.
(declare_module): Use 'interface' attrib.
(mport_module, export_module): Take attribs.
* parser.c (check_module_outermost, cp_parser_module_declaration,
cp_parser_module_export, cp_parser_module_proclamation): Adjust.
gcc/testsuite/
* g++.dg/modules/mod-decl-2_a.C: Adjust.
* g++.dg/modules/mod-decl-3_a.C: Adjust.
* g++.dg/modules/proclaim-1.C: Adjust.
* g++.dg/modules/mod-decl-4.C: New.
2017-01-27 Nathan Sidwell <nathan@acm.org>
Parse proclaimed ownership.
gcc/cp/
* cp-tree.h (module_exporting_p, module_proclaim): Declare.
* module.c (proclaimer): New.
(module_exporting_p, module_proclaim): New.
* parser.c (check_module_outermost): New.
(cp_parser_module_declaration, cp_parser_module_export): Call it.
(cp_parser_module_proclamation): New.
(cp_parser_declaration): Add proclaimed-ownership.
gcc/testsuite/
* g++.dg/modules/proclaim-1.C: New.
Parse import & export. Test infra.
gcc/cp/
* cp-tree.h (module_purview_p, push_module_export,
pop_module_export, declare_module, import_module,
export_module): Declare.
* module.c (export_depth): New.
(module_purview_p, push_module_export, pop_module_export): New
(declare_module_name): Renme to ...
(declare_module): ... here.
(import_module, export_module): Stubs.
* parser.c (cp_parser_module_declaration): Add IS_EXPORT
parm. Deal with imports & exports.
(cp_parser_module_export): New.
(cp_parser_declaration): Allow module import, export.
gcc/testsuite/
* g++.dg/dg.exp: Prune module tests.
* g++.dg/modules/modules.exp: New.
* g++.dg/modules/mod-decl-2_[ab].C: New.
* g++.dg/modules/mod-decl-3_[ab].C: New.
2017-01-25 Nathan Sidwell <nathan@acm.org>
Parse module-declaration.
gcc/cp
* cp-tree.h (module_name_t): Typedef.
(declare_module_name): Declare.
* parser.c (cp_parser_diagnose_invalid_type_name): Explain
fmodules.
(cp_parser_module_name, cp_parser_module_declaration): New.
(cp_parser_declaration): Add module-declaration.
* module.c (declared_module, module_location): New.
(declare_module_name): Define.
gcc/testsuite/
* g++.dg/modules/mod-decl-0.C: New.
* g++.dg/modules/mod-decl-1.C: New.
New flag & keywords, etc
gcc/c-family/
* c-common.c (c_common_reswords): Add 'module', 'import'.
* c-common.h (enum rid): Add RID_MODULE, RID_IMPORT.
(D_CXX_MODULES, D_CXX_MODULES_FLAGS) New.
* c-cppbuiltins.c (c_cpp_builtins): Add _cpp_modules define.
* c.opt: Add fmodules flag.
gcc/cp/
* Make-lang.in (CXX_AND_OBJCXX_OBJS): Add module.o.
* module.c: New file.
gcc/
* doc/invoke.texi (-fmodules): Document it.
2017-01-24 Nathan Sidwell <nathan@acm.org>
Free up TREE_LANG_FLAG_3. DECL_CONSTRUCTION_VTABLE_P is useless.
gcc/cp/
* cp-tree.h (DECL_CONSTRUCTION_VTABLE_P): Delete.
(DECL_NON_TRIVIALLY_INITIALIZED_P): Move to TREE_LANG_FLAG_6.
* class.c (build_ctor_vtbl_group): Don't set
DECL_CONSTRUCTION_VTABLE_P.
* decl2.c (determine_visibility_from_class): Don't check
DECL_CONSTRUCTION_VTABLE_P anymore.
2017-01-23 Nathan Sidwell <nathan@acm.org>
Branch creation from trunk:244828
Use this Changelog for all branch changes, including merges.
Local Variables:
mode: change-log
change-log-default-name: "ChangeLog.modules"
End: