(DECL_LANG_SPECIFIC (DECL_MODULE_CHECK (NODE))->u.base.module_entity_p)
/* DECL that has attached decls for ODR-relatedness. */
-#define DECL_MODULE_ATTACHMENTS_P(NODE) \
+#define DECL_MODULE_KEYED_DECLS_P(NODE) \
(DECL_LANG_SPECIFIC (TREE_CHECK2(NODE,FUNCTION_DECL,VAR_DECL))\
- ->u.base.module_attached_p)
+ ->u.base.module_keyed_decls_p)
/* Whether this is an exported DECL. Held on any decl that can appear
at namespace scope (function, var, type, template, const or
unsigned module_import_p : 1; /* from an import */
unsigned module_entity_p : 1; /* is in the entitity ary &
hash. */
- /* VAR_DECL or FUNCTION_DECL has attached decls. */
- unsigned module_attached_p : 1;
+ /* VAR_DECL or FUNCTION_DECL has keyed decls. */
+ unsigned module_keyed_decls_p : 1;
/* 12 spare bits. */
};
/* Where current instance of the decl got declared/defined/instantiated. */
extern void set_instantiating_module (tree);
extern void set_defining_module (tree);
-extern void maybe_attach_decl (tree ctx, tree decl);
+extern void maybe_key_decl (tree ctx, tree decl);
extern void mangle_module (int m, bool include_partition);
extern void mangle_module_fini ();
completed. */
vec<tree, va_heap, vl_embed> *post_load_decls;
-/* Some entities are attached to another entitity for ODR purposes.
+/* Some entities are keyed to another entitity for ODR purposes.
For example, at namespace scope, 'inline auto var = []{};', that
- lambda is attached to 'var', and follows its ODRness. */
-typedef hash_map<tree, auto_vec<tree>> attached_map_t;
-static attached_map_t *attached_table;
+ lambda is keyed to 'var', and follows its ODRness. */
+typedef hash_map<tree, auto_vec<tree>> keyed_map_t;
+static keyed_map_t *keyed_table;
/********************************************************************/
/* Tree streaming. The tree streaming is very specific to the tree
MK_partial,
MK_enum, /* Found by CTX, & 1stMemberNAME. */
- MK_attached, /* Found by attachee & index. */
+ MK_keyed, /* Found by key & index. */
MK_friend_spec, /* Like named, but has a tmpl & args too. */
MK_local_friend, /* Found by CTX, index. */
that's the GM purview, so not what the importer will mean */
WB (lang->u.base.module_purview_p && !header_module_p ());
if (VAR_OR_FUNCTION_DECL_P (t))
- WB (lang->u.base.module_attached_p);
+ WB (lang->u.base.module_keyed_decls_p);
switch (lang->u.base.selector)
{
default:
RB (lang->u.base.dependent_init_p);
RB (lang->u.base.module_purview_p);
if (VAR_OR_FUNCTION_DECL_P (t))
- RB (lang->u.base.module_attached_p);
+ RB (lang->u.base.module_keyed_decls_p);
switch (lang->u.base.selector)
{
default:
if (VAR_OR_FUNCTION_DECL_P (inner)
&& DECL_LANG_SPECIFIC (inner)
- && DECL_MODULE_ATTACHMENTS_P (inner)
+ && DECL_MODULE_KEYED_DECLS_P (inner)
&& !is_key_order ())
{
- /* Stream the attached entities. */
- auto *attach_vec = attached_table->get (inner);
+ /* Stream the keyed entities. */
+ auto *attach_vec = keyed_table->get (inner);
unsigned num = attach_vec->length ();
if (streaming_p ())
u (num);
if (VAR_OR_FUNCTION_DECL_P (inner)
&& DECL_LANG_SPECIFIC (inner)
- && DECL_MODULE_ATTACHMENTS_P (inner))
+ && DECL_MODULE_KEYED_DECLS_P (inner))
{
/* Read and maybe install the attached entities. */
bool existed;
- auto &set = attached_table->get_or_insert (STRIP_TEMPLATE (existing),
- &existed);
+ auto &set = keyed_table->get_or_insert (STRIP_TEMPLATE (existing),
+ &existed);
unsigned num = u ();
if (is_new == existed)
set_overrun ();
= LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR
(TREE_TYPE (decl))))
if (TREE_CODE (scope) == VAR_DECL
- && DECL_MODULE_ATTACHMENTS_P (scope))
+ && DECL_MODULE_KEYED_DECLS_P (scope))
{
- mk = MK_attached;
+ mk = MK_keyed;
break;
}
}
break;
- case MK_attached:
+ case MK_keyed:
{
gcc_checking_assert (LAMBDA_TYPE_P (TREE_TYPE (inner)));
tree scope = LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR
(TREE_TYPE (inner)));
gcc_checking_assert (TREE_CODE (scope) == VAR_DECL);
- auto *root = attached_table->get (scope);
+ auto *root = keyed_table->get (scope);
unsigned ix = root->length ();
/* If we don't find it, we'll write a really big number
that the reader will ignore. */
if ((*root)[ix] == inner)
break;
- /* Use the attached-to decl as the 'name'. */
+ /* Use the keyed-to decl as the 'name'. */
name = scope;
key.index = ix;
}
gcc_unreachable ();
case NAMESPACE_DECL:
- if (mk == MK_attached)
+ if (mk == MK_keyed)
{
if (DECL_LANG_SPECIFIC (name)
&& VAR_OR_FUNCTION_DECL_P (name)
- && DECL_MODULE_ATTACHMENTS_P (name))
- if (auto *set = attached_table->get (name))
+ && DECL_MODULE_KEYED_DECLS_P (name))
+ if (auto *set = keyed_table->get (name))
if (key.index < set->length ())
{
existing = (*set)[key.index];
DECL_MODULE_EXPORT_P (decl) = true;
}
-/* DECL is attached to ROOT for odr purposes. */
+/* DECL is keyed to CTX for odr purposes. */
void
-maybe_attach_decl (tree ctx, tree decl)
+maybe_key_decl (tree ctx, tree decl)
{
if (!modules_p ())
return;
gcc_checking_assert (DECL_NAMESPACE_SCOPE_P (ctx));
- if (!attached_table)
- attached_table = new attached_map_t (EXPERIMENT (1, 400));
+ if (!keyed_table)
+ keyed_table = new keyed_map_t (EXPERIMENT (1, 400));
- auto &vec = attached_table->get_or_insert (ctx);
+ auto &vec = keyed_table->get_or_insert (ctx);
if (!vec.length ())
{
retrofit_lang_decl (ctx);
- DECL_MODULE_ATTACHMENTS_P (ctx) = true;
+ DECL_MODULE_KEYED_DECLS_P (ctx) = true;
}
vec.safe_push (decl);
}
if (import->loadedness < ML_LANGUAGE)
{
- if (!attached_table)
- attached_table = new attached_map_t (EXPERIMENT (1, 400));
+ if (!keyed_table)
+ keyed_table = new keyed_map_t (EXPERIMENT (1, 400));
import->read_language (true);
}
delete pending_table;
pending_table = NULL;
- /* Or any attachments -- Let it go! */
- delete attached_table;
- attached_table = NULL;
+ /* Or any keys -- Let it go! */
+ delete keyed_table;
+ keyed_table = NULL;
/* Allow a GC, we've possibly made much data unreachable. */
ggc_collect ();