summaryrefslogtreecommitdiff
path: root/gcc/cp/ptree.cc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-05-09 04:47:14 -0700
committerNathan Sidwell <nathan@acm.org>2022-05-11 06:38:19 -0700
commita92ed39c416b2a92f404d9851fdfea5cae7e6b21 (patch)
tree937940a8cb1ba7ff82afc2385926cdc4519874c9 /gcc/cp/ptree.cc
parent37a8220fa9188470c677abfef50c1b120c0b6c76 (diff)
downloadgcc-a92ed39c416b2a92f404d9851fdfea5cae7e6b21.tar.gz
[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.
Diffstat (limited to 'gcc/cp/ptree.cc')
-rw-r--r--gcc/cp/ptree.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/cp/ptree.cc b/gcc/cp/ptree.cc
index 540f1e4c81e..53ce06ccd2d 100644
--- a/gcc/cp/ptree.cc
+++ b/gcc/cp/ptree.cc
@@ -79,12 +79,22 @@ cxx_print_decl (FILE *file, tree node, int indent)
need_indent = false;
}
- if (DECL_LANG_SPECIFIC (ntnode) && DECL_MODULE_PURVIEW_P (ntnode))
+ if (DECL_LANG_SPECIFIC (ntnode))
{
- if (need_indent)
- indent_to (file, indent + 3);
- fprintf (file, " purview");
- need_indent = false;
+ if (DECL_MODULE_PURVIEW_P (ntnode))
+ {
+ if (need_indent)
+ indent_to (file, indent + 3);
+ fprintf (file, " purview");
+ need_indent = false;
+ }
+ if (DECL_MODULE_ATTACH_P (ntnode))
+ {
+ if (need_indent)
+ indent_to (file, indent + 3);
+ fprintf (file, " attached");
+ need_indent = false;
+ }
}
}