===================================================================
@@ -30,8 +30,8 @@
typedef enum
{
pp_c_flag_abstract = 1 << 1,
- pp_c_flag_last_bit = 2,
- pp_c_flag_gnu_v3 = 4
+ pp_c_flag_gnu_v3 = 1 << 2,
+ pp_c_flag_last_bit = 3
} pp_c_pretty_print_flags;
===================================================================
@@ -2459,7 +2459,22 @@
return pp_formatted_text (cxx_pp);
}
+/* Wrap decl_as_string with options appropriate for dwarf. */
+
const char *
+decl_as_dwarf_string (tree decl, int flags)
+{
+ const char *name;
+ /* Curiously, reinit_cxx_pp doesn't reset the flags field, so setting the flag
+ here will be adequate to get the desired behaviour. */
+ pp_c_base (cxx_pp)->flags |= pp_c_flag_gnu_v3;
+ name = decl_as_string (decl, flags);
+ /* Subsequent calls to the pretty printer shouldn't use this style. */
+ pp_c_base (cxx_pp)->flags &= ~pp_c_flag_gnu_v3;
+ return name;
+}
+
+const char *
decl_as_string (tree decl, int flags)
{
reinit_cxx_pp ();
@@ -2479,6 +2494,21 @@
return pp_formatted_text (cxx_pp);
}
+/* Wrap lang_decl_name with options appropriate for dwarf. */
+
+const char *
+lang_decl_dwarf_name (tree decl, int v, bool translate)
+{
+ const char *name;
+ /* Curiously, reinit_cxx_pp doesn't reset the flags field, so setting the flag
+ here will be adequate to get the desired behaviour. */
+ pp_c_base (cxx_pp)->flags |= pp_c_flag_gnu_v3;
+ name = lang_decl_name (decl, v, translate);
+ /* Subsequent calls to the pretty printer shouldn't use this style. */
+ pp_c_base (cxx_pp)->flags &= ~pp_c_flag_gnu_v3;
+ return name;
+}
+
/* Generate the three forms of printable names for cxx_printable_name. */
const char *
===================================================================
@@ -183,17 +183,11 @@
&& (ANON_AGGRNAME_P (DECL_NAME (t)) || LAMBDANAME_P (DECL_NAME (t))))
return NULL;
if (verbosity >= 2)
- return decl_as_string (t,
+ return decl_as_dwarf_string (t,
TFF_DECL_SPECIFIERS | TFF_UNQUALIFIED_NAME
- | TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS
- | TFF_MATCH_GNU_V3_DEMANGLER);
+ | TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS);
- /* decl_as_string handles namespaces--especially anonymous ones--more
- appropriately for debugging than cxx_printable_name. But
- cxx_printable_name handles templates and global ctors and dtors better. */
- if (TREE_CODE (t) == NAMESPACE_DECL)
- return decl_as_string (t, TFF_MATCH_GNU_V3_DEMANGLER);
- return cxx_printable_name (t, verbosity);
+ return lang_decl_dwarf_name (t, verbosity, false);
}
static enum classify_record
===================================================================
@@ -4913,8 +4913,10 @@
extern const char *type_as_string_translate (tree, int);
extern const char *decl_as_string (tree, int);
extern const char *decl_as_string_translate (tree, int);
+extern const char *decl_as_dwarf_string (tree, int);
extern const char *expr_as_string (tree, int);
extern const char *lang_decl_name (tree, int, bool);
+extern const char *lang_decl_dwarf_name (tree, int, bool);
extern const char *language_to_string (enum languages);
extern const char *class_key_or_enum_as_string (tree);
extern void print_instantiation_context (void);