pp->m_format_postprocessor = new cxx_format_postprocessor ();
}
+/* Dump an '@module' name suffix for DECL, if any. */
+
+static void
+dump_module_suffix (cxx_pretty_printer *pp, tree decl)
+{
+ if (!modules_p ())
+ return;
+
+ if (!DECL_CONTEXT (decl))
+ return;
+
+ if (TREE_CODE (decl) != CONST_DECL
+ || !UNSCOPED_ENUM_P (DECL_CONTEXT (decl)))
+ {
+ if (!DECL_NAMESPACE_SCOPE_P (decl))
+ return;
+
+ if (TREE_CODE (decl) == NAMESPACE_DECL
+ && !DECL_NAMESPACE_ALIAS (decl)
+ && (TREE_PUBLIC (decl) || !TREE_PUBLIC (CP_DECL_CONTEXT (decl))))
+ return;
+ }
+
+ if (unsigned m = get_originating_module (decl))
+ if (const char *n = module_name (m, false))
+ {
+ pp_character (pp, '@');
+ pp->padding = pp_none;
+ pp_string (pp, n);
+ }
+}
+
/* Dump a scope, if deemed necessary. */
static void
else
pp_cxx_tree_identifier (pp, DECL_NAME (decl));
+ dump_module_suffix (pp, decl);
+
if (tmplate)
dump_template_parms (pp, TYPE_TEMPLATE_INFO (t),
!CLASSTYPE_USE_TEMPLATE (t),
pp_string (pp, M_("<structured bindings>"));
else
pp_string (pp, M_("<anonymous>"));
+
+ dump_module_suffix (pp, t);
+
if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (pp, type, flags);
}
else
dump_decl (pp, name, flags);
+ dump_module_suffix (pp, t);
+
if (DECL_TEMPLATE_INFO (t)
&& !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)
&& (TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL
bool need_indent = true;
+ if (TREE_CODE (node) == FUNCTION_DECL
+ || TREE_CODE (node) == VAR_DECL
+ || TREE_CODE (node) == TYPE_DECL
+ || TREE_CODE (node) == TEMPLATE_DECL
+ || TREE_CODE (node) == CONCEPT_DECL
+ || TREE_CODE (node) == NAMESPACE_DECL)
+ {
+ unsigned m = 0;
+ if (DECL_LANG_SPECIFIC (node) && DECL_MODULE_IMPORT_P (node))
+ m = get_importing_module (node, true);
+
+ if (const char *name = m == ~0u ? "" : module_name (m, true))
+ {
+ if (need_indent)
+ indent_to (file, indent + 3);
+ fprintf (file, " module %d:%s", m, name);
+ need_indent = false;
+ }
+
+ if (DECL_LANG_SPECIFIC (node) && DECL_MODULE_PURVIEW_P (node))
+ {
+ if (need_indent)
+ indent_to (file, indent + 3);
+ fprintf (file, " purview");
+ need_indent = false;
+ }
+ }
+
+ if (DECL_MODULE_EXPORT_P (node))
+ {
+ if (need_indent)
+ indent_to (file, indent + 3);
+ fprintf (file, " exported");
+ need_indent = false;
+ }
+
if (DECL_EXTERNAL (node) && DECL_NOT_REALLY_EXTERN (node))
{
if (need_indent)