&type_print_raw_options);
/* This also needs canonicalization. */
- const char *name = buf.c_str ();
- std::string canon = cp_canonicalize_string (name);
+ std::string canon
+ = cp_canonicalize_string (buf.c_str ());
if (canon.empty ())
- canon = name;
+ canon = std::move (buf.string ());
/* We need a space between "operator" and the
canonicalized type name. */
or DW_AT_MIPS_linkage_name. Returns NULL if the attribute is not
defined for the given DIE. */
+static struct attribute *
+dw2_linkage_name_attr (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct attribute *attr;
+
+ attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
+ if (attr == NULL)
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+
+ return attr;
+}
+
+/* Return the DIE's linkage name as a string, either DW_AT_linkage_name
+ or DW_AT_MIPS_linkage_name. Returns NULL if the attribute is not
+ defined for the given DIE. */
+
static const char *
dw2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
{
{
complaint (&symfile_complaints,
_("cannot determine context for virtual member "
- "function \"%s\" (offset %d)"), fieldname,
- to_underlying (type_die->sect_off));
+ "function \"%s\" (offset %d)"),
+ fieldname, to_underlying (type_die->sect_off));
}
else
{
/* Returns non-zero if NAME is the name of a vtable member in CU's
language, zero otherwise. */
static int
-dw2_is_vtable_name (const char *name, struct dwarf2_cu *cu)
+is_vtable_name (const char *name, struct dwarf2_cu *cu)
{
static const char vptr[] = "_vptr";
static const char vtable[] = "vtable";
{
const char *fieldname = TYPE_FIELD_NAME (t, i);
- if (dw2_is_vtable_name (fieldname, cu))
+ if (is_vtable_name (fieldname, cu))
{
set_type_vptr_fieldno (type, i);
break;
{
char *demangled = NULL;
- attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
- if (attr == NULL)
- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
-
+ attr = dw2_linkage_name_attr (die, cu);
if (attr == NULL || DW_STRING (attr) == NULL)
return NULL;
{int (const base * const)} \
- \
-
+add {base::operator fluff const* const*} \
+ {const fluff * const *(const base * const)} \
+ - \
+ -
# Templates
add {tclass<char>::do_something} \
gdb_test "p CV_f('cpexprs.cc'::CV::t)" \
{ = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>}
+# Make sure conversion operator names are canonicalized and properly
+# "spelled."
+gdb_test "p base::operator const fluff * const *" \
+ [get "base::operator fluff const* const*" print] \
+ "canonicalized conversion operator name 1"
+gdb_test "p base::operator const fluff* const*" \
+ [get "base::operator fluff const* const*" print] \
+ "canonicalized conversion operator name 2"
+gdb_test "p base::operator derived*" \
+ "There is no field named operator derived\\*" \
+ "undefined conversion operator"
+
gdb_exit
return 0