aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-06-29 21:37:46 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-06-29 21:37:46 +0200
commit0287000a9f870363bf864354d7cceffc4b575dec (patch)
tree881865d1a095787053735ccc582c9c7752878c0a /gcc
parent2d660b7f8795fc3dc553fd79796f5ecdefd009ac (diff)
downloadgcc-0287000a9f870363bf864354d7cceffc4b575dec.zip
gcc-0287000a9f870363bf864354d7cceffc4b575dec.tar.gz
gcc-0287000a9f870363bf864354d7cceffc4b575dec.tar.bz2
re PR debug/44668 (class->DW_TAG_typedef is missing DW_AT_accessibility)
PR debug/44668 * dwarf2out.c (add_accessibility_attribute): New function. (gen_subprogram_die, gen_variable_die, gen_field_die): Use it instead of adding DW_AT_accessibility manually. (gen_enumeration_type_die, gen_struct_or_union_type_die, gen_typedef_die): Use it. * g++.dg/debug/dwarf2/accessibility1.C: New test. From-SVN: r161563
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/dwarf2out.c38
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C24
4 files changed, 62 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7d4fbd8..f80c207 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44668
+ * dwarf2out.c (add_accessibility_attribute): New function.
+ (gen_subprogram_die, gen_variable_die, gen_field_die): Use it
+ instead of adding DW_AT_accessibility manually.
+ (gen_enumeration_type_die, gen_struct_or_union_type_die,
+ gen_typedef_die): Use it.
+
2010-06-29 Douglas B Rupp <rupp@gnat.com>
* vmsdbgout.c (full_name): Just output the file name if not native.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 2dd8bcc..a72771d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15771,6 +15771,17 @@ add_AT_location_description (dw_die_ref die, enum dwarf_attribute attr_kind,
add_AT_loc_list (die, attr_kind, descr);
}
+/* Add DW_AT_accessibility attribute to DIE if needed. */
+
+static void
+add_accessibility_attribute (dw_die_ref die, tree decl)
+{
+ if (TREE_PROTECTED (decl))
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_protected);
+ else if (TREE_PRIVATE (decl))
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_private);
+}
+
/* Attach the specialized form of location attribute used for data members of
struct and union types. In the special case of a FIELD_DECL node which
represents a bit-field, the "offset" part of this special location
@@ -18075,7 +18086,10 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die)
TREE_ASM_WRITTEN (type) = 1;
add_byte_size_attribute (type_die, type);
if (TYPE_STUB_DECL (type) != NULL_TREE)
- add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ {
+ add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ add_accessibility_attribute (type_die, TYPE_STUB_DECL (type));
+ }
/* If the first reference to this type was as the return type of an
inline function, then it may not have a parent. Fix this now. */
@@ -18582,10 +18596,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
if (DECL_ARTIFICIAL (decl))
add_AT_flag (subr_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (subr_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (subr_die, DW_AT_accessibility, DW_ACCESS_private);
+ add_accessibility_attribute (subr_die, decl);
}
if (declaration)
@@ -19083,10 +19094,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
if (DECL_ARTIFICIAL (decl))
add_AT_flag (var_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_private);
+ add_accessibility_attribute (var_die, decl);
}
if (declaration)
@@ -19315,10 +19323,7 @@ gen_field_die (tree decl, dw_die_ref context_die)
if (DECL_ARTIFICIAL (decl))
add_AT_flag (decl_die, DW_AT_artificial, 1);
- if (TREE_PROTECTED (decl))
- add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
- add_AT_unsigned (decl_die, DW_AT_accessibility, DW_ACCESS_private);
+ add_accessibility_attribute (decl_die, decl);
/* Equate decl number to die, so that we can look up this decl later on. */
equate_decl_number_to_die (decl, decl_die);
@@ -19592,7 +19597,10 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
TREE_ASM_WRITTEN (type) = 1;
add_byte_size_attribute (type_die, type);
if (TYPE_STUB_DECL (type) != NULL_TREE)
- add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ {
+ add_src_coords_attributes (type_die, TYPE_STUB_DECL (type));
+ add_accessibility_attribute (type_die, TYPE_STUB_DECL (type));
+ }
/* If the first reference to this type was as the return type of an
inline function, then it may not have a parent. Fix this now. */
@@ -19705,6 +19713,8 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
TYPE in argument yield the DW_TAG_typedef we have just
created. */
equate_type_number_to_die (type, type_die);
+
+ add_accessibility_attribute (type_die, decl);
}
if (DECL_ABSTRACT (decl))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4ecfcab..fa8f96b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/44668
+ * g++.dg/debug/dwarf2/accessibility1.C: New test.
+
2010-06-29 Jason Merrill <jason@redhat.com>
PR c++/44587
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C b/gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C
new file mode 100644
index 0000000..4992f41
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/accessibility1.C
@@ -0,0 +1,24 @@
+// PR debug/44668
+// { dg-do compile }
+// { dg-options "-g -dA" }
+
+struct C
+{
+private:
+ typedef int a;
+ a b;
+ enum g { g1, g2 } h;
+ struct D { int i; } i;
+protected:
+ typedef int c;
+ c d;
+public:
+ typedef int e;
+ e f;
+} c;
+
+// 3 private DW_TAG_member dies, 1 private DW_TAG_typedef,
+// 1 private DW_TAG_enumeration_type and 1 private DW_TAG_structure_type
+// { dg-final { scan-assembler-times "3\[^\\r\\n\]* DW_AT_accessibility" 6 } }
+// 1 private DW_TAG_member die, 1 private DW_TAG_typedef
+// { dg-final { scan-assembler-times "2\[^\\r\\n\]* DW_AT_accessibility" 2 } }