const char *
cooked_index_entry::full_name (struct obstack *storage, bool for_main,
+ bool for_ada_linkage,
const char *default_sep) const
{
const char *local_name = for_main ? name : canonical;
sep = "::";
break;
+ case language_ada:
+ if (for_ada_linkage)
+ {
+ sep = "__";
+ break;
+ }
+ [[fallthrough]];
case language_go:
case language_d:
- case language_ada:
sep = ".";
break;
break;
}
- get_parent ()->write_scope (storage, sep, for_main);
+ get_parent ()->write_scope (storage, sep, for_main, for_ada_linkage);
obstack_grow0 (storage, local_name, strlen (local_name));
return (const char *) obstack_finish (storage);
}
void
cooked_index_entry::write_scope (struct obstack *storage,
const char *sep,
- bool for_main) const
+ bool for_main,
+ bool for_ada_linkage) const
{
if (get_parent () != nullptr)
- get_parent ()->write_scope (storage, sep, for_main);
- const char *local_name = for_main ? name : canonical;
+ get_parent ()->write_scope (storage, sep, for_main, for_ada_linkage);
+ /* When computing the Ada linkage name, the entry might not have
+ been canonicalized yet, so use the 'name'. */
+ const char *local_name = (for_main || for_ada_linkage) ? name : canonical;
obstack_grow (storage, local_name, strlen (local_name));
obstack_grow (storage, sep, strlen (sep));
}
STORAGE. FOR_MAIN is true if we are computing the name of the
"main" entry -- one marked DW_AT_main_subprogram. This matters
for avoiding name canonicalization and also a related race (if
- "main" computation is done during finalization). If the language
+ "main" computation is done during finalization). If
+ FOR_ADA_LINKAGE is true, then Ada-language symbols will have
+ their "linkage-style" name computed. The default is
+ source-style. If the language
doesn't prescribe a separator, one can be specified using
DEFAULT_SEP. */
- const char *full_name (struct obstack *storage, bool for_main = false,
+ const char *full_name (struct obstack *storage,
+ bool for_main = false,
+ bool for_ada_linkage = false,
const char *default_sep = nullptr) const;
/* Comparison modes for the 'compare' function. See the function
/* A helper method for full_name. Emits the full scope of this
object, followed by the separator, to STORAGE. If this entry has
- a parent, its write_scope method is called first. FOR_MAIN is
- true when computing the name of 'main'; see full_name. */
+ a parent, its write_scope method is called first. See full_name
+ for a description of the FOR_MAIN and FOR_ADA_LINKAGE
+ parameters. */
void write_scope (struct obstack *storage, const char *sep,
- bool for_main) const;
+ bool for_main, bool for_ada_linkage) const;
/* The parent entry. This is NULL for top-level entries.
Otherwise, it points to the parent entry, such as a namespace or