aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.cc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-05-09 04:40:43 -0700
committerNathan Sidwell <nathan@acm.org>2022-05-10 04:08:05 -0700
commitd1e8f221e3fc8d3153b662c2f912bf1a26d645ff (patch)
treefe461e95e9e42b16bd7b64c7e757585397ff0b6b /gcc/cp/decl.cc
parent76db543db88727789a6c117608a23edc2eace713 (diff)
downloadgcc-d1e8f221e3fc8d3153b662c2f912bf1a26d645ff.zip
gcc-d1e8f221e3fc8d3153b662c2f912bf1a26d645ff.tar.gz
gcc-d1e8f221e3fc8d3153b662c2f912bf1a26d645ff.tar.bz2
[c++] Disambiguate ModuleKind flags
In modules, 'attached to global module' nearly always means 'not in module purview'. Also the implementation treats, 'in global module && in module purview' as meaning 'header unit'. The ModuleKind flags reflected that. The 'nearly always' means there are cases that the first condition is not invariant, and that of course invalidates the second equivalence. This disambiguates the ModuleKind flags to allow that 'not quite', and separate out header-unitness from the GMF & purview flags combination. 1) Separate out named-module vs header-unit from the MODULE/GLOBAL flags. 2) Replace the MODULE/GLOBAL flags with PURVIEW & ATTACH flags. 3) Adjust the parser state handling. Lays ground-work for language-declaration changes. gcc/cp/ * cp-tree.h (enum module_kind_bits): Disambiguate purview, attach, named module vs header-unit. (global_purview_p, not_module_p): Delete. (named_module_p): New. (header_module_p, module_purview_p): Adjust. (module_attach_p, named_module_purview_p): New. * decl.cc (duplicate_decls): Adjust. * module.cc (declare_module, preprocessed_module): Adjust. * name-lookup.cc (init_global_partition): Adjust. (get_fixed_binding_slot, pushdecl): Adjust. * parser.cc (cp_parser_module_declaration): Adjust. (cp_parser_import_declaration, cp_parser_declaration): Adjust.
Diffstat (limited to 'gcc/cp/decl.cc')
-rw-r--r--gcc/cp/decl.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 9c9cf9f..4099fde 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -2110,7 +2110,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
{
if (DECL_ARTIFICIAL (olddecl))
{
- if (!(global_purview_p () || not_module_p ()))
+ if (module_attach_p ())
error ("declaration %qD conflicts with builtin", newdecl);
else
DECL_MODULE_EXPORT_P (olddecl) = DECL_MODULE_EXPORT_P (newdecl);