]> git.ipfire.org Git - thirdparty/gcc.git/commit
[c++] Add module attachment
authorNathan Sidwell <nathan@acm.org>
Mon, 9 May 2022 11:47:14 +0000 (04:47 -0700)
committerNathan Sidwell <nathan@acm.org>
Wed, 11 May 2022 13:38:19 +0000 (06:38 -0700)
commita92ed39c416b2a92f404d9851fdfea5cae7e6b21
tree937940a8cb1ba7ff82afc2385926cdc4519874c9
parent37a8220fa9188470c677abfef50c1b120c0b6c76
[c++] Add module attachment

This adds module attachment as a distinct flag to 'in module purview'.
A declaration may have neither or both (as before), but can also have
just the 'in [named-module] purview', which was previously not
representable.

This new state allows some cleanup of redeclarations (particularly the
builtins), which was a little warty.  Some other internal APIs get
similarly clarified.

gcc/cp/
* cp-tree.h (DECL_MODULE_ATTACH_P): New.
(struct lang_decl_base): Add module_attach_p flag.
* decl.cc (duplicate_decls): Rework module redeclaration
checking.
* module.cc (trees_out::lang_decl_bools): Write attach flag.
(trees_in::lang_decl_bools): ... and read it back.
(trees_out::decl_value): Rework module attachment handling.
(trees_in::decl_value): Rename local var to reflect meaning.
(trees_in::key_mergeable): Likewise.
(get_originating_module): Use DECL_MODULE_ATTACH_P.  No need
to special-case mangling.
(module_may_redeclare): Reimplement.
(set_originating_module): Deal with attachment.
* name-lookup.cc (maybe_record_mergeable_decl): Deal with
attachment.
(mergeable_namespace_slots): Likewise.
(do_nonmember_using_decl): Likewise.
* name-lookup.h (mergeable_namespace_slots): Adjust parm
meaning.
* ptree.cc (cxx_print_decl): Adjust purview & attach printing.
gcc/cp/cp-tree.h
gcc/cp/decl.cc
gcc/cp/module.cc
gcc/cp/name-lookup.cc
gcc/cp/name-lookup.h
gcc/cp/ptree.cc