diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-12-09 12:18:06 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-12-10 05:21:52 -0800 |
commit | 8c60696b699e0b22cc12ae628473f0a23f90c82e (patch) | |
tree | 3f67ba38dcace1dc882fc9768a287feab2399847 /gcc/cp/ptree.c | |
parent | 79c1b9fb44ce9abd0e2f6642b65684b9721233ee (diff) | |
download | gcc-8c60696b699e0b22cc12ae628473f0a23f90c82e.zip gcc-8c60696b699e0b22cc12ae628473f0a23f90c82e.tar.gz gcc-8c60696b699e0b22cc12ae628473f0a23f90c82e.tar.bz2 |
c++: Module-specific error and tree dumping
With modules, we need the ability to name 'foos' in different modules.
The idiom for that is a trailing '@modulename' suffix. This adds that
to the error printing routines. I also augment the tree dumping
machinery to show module-specific metadata.
gcc/cp/
* error.c (dump_module_suffix): New.
(dump_aggr_type, dump_simple_decl, dump_function_name): Call it.
* ptree.c (cxx_print_decl): Print module information.
* module.cc (module_name, get_importing_module): Stubs.
Diffstat (limited to 'gcc/cp/ptree.c')
-rw-r--r-- | gcc/cp/ptree.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index f8d2208..1e9fdf8 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -59,6 +59,42 @@ cxx_print_decl (FILE *file, tree node, int indent) 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) |