[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.