diff options
author | Tom Tromey <tromey@redhat.com> | 2012-12-14 20:33:29 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-12-14 20:33:29 +0000 |
commit | 7d27a96df4e297e7329e0e3856c6d6e346478c80 (patch) | |
tree | 577b811b54508d15105168636b95930d432a77da /gdb/dwarf2read.c | |
parent | f8c05d0d192df972af6b1c14aaf9dc8743cfe72e (diff) | |
download | gdb-7d27a96df4e297e7329e0e3856c6d6e346478c80.zip gdb-7d27a96df4e297e7329e0e3856c6d6e346478c80.tar.gz gdb-7d27a96df4e297e7329e0e3856c6d6e346478c80.tar.bz2 |
Partial fix for PR c++/14160:
* c-typeprint.c (c_type_print_base): Use TYPE_FN_FIELD_CONSTRUCTOR.
* dwarf2read.c (dwarf2_is_constructor): New function.
(dwarf2_add_member_fn): Use it.
* gnu-v3-abi.c (gnuv3_pass_by_reference): Use
TYPE_FN_FIELD_CONSTRUCTOR.
* jv-typeprint.c (java_type_print_base): Use
TYPE_FN_FIELD_CONSTRUCTOR.
* gdbtypes.h (struct fn_field) <is_constructor>: New field.
<dummy>: Shrink.
(TYPE_FN_FIELD_CONSTRUCTOR): New macro.
testsuite
* gdb.cp/templates.exp (test_ptype_of_templates): Update kfails.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 110ade9..4d5323e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -10778,6 +10778,34 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type, } } +/* Return true if this member function is a constructor, false + otherwise. */ + +static int +dwarf2_is_constructor (struct die_info *die, struct dwarf2_cu *cu) +{ + const char *fieldname; + const char *typename; + int len; + + if (die->parent == NULL) + return 0; + + if (die->parent->tag != DW_TAG_structure_type + && die->parent->tag != DW_TAG_union_type + && die->parent->tag != DW_TAG_class_type) + return 0; + + fieldname = dwarf2_name (die, cu); + typename = dwarf2_name (die->parent, cu); + if (fieldname == NULL || typename == NULL) + return 0; + + len = strlen (fieldname); + return (strncmp (fieldname, typename, len) == 0 + && (typename[len] == '\0' || typename[len] == '<')); +} + /* Add a member function to the proper fieldlist. */ static void @@ -10909,6 +10937,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, if (attr && DW_UNSND (attr) != 0) fnp->is_artificial = 1; + fnp->is_constructor = dwarf2_is_constructor (die, cu); + /* Get index in virtual function table if it is a virtual member function. For older versions of GCC, this is an offset in the appropriate virtual table, as specified by DW_AT_containing_type. |