aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-09-20 18:48:29 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-09-20 18:48:29 +0200
commitfbbe0995b838343660140bce022165bc7976edb2 (patch)
treef2c542b81e80fd9d4e87ace023ee9c2eb52ea824
parentcce470f93d9a4fe30f28fb03fbe460e17933d752 (diff)
downloadgcc-fbbe0995b838343660140bce022165bc7976edb2.zip
gcc-fbbe0995b838343660140bce022165bc7976edb2.tar.gz
gcc-fbbe0995b838343660140bce022165bc7976edb2.tar.bz2
re PR debug/45124 (No DW_AT_accessibility for public DIEs in DW_TAG_class_type)
PR debug/45124 * dwarf2out.c (add_accessibility_attribute): Assume DW_ACCESS_private as the default for dwarf_version > 2 and DW_TAG_class_type parent. (gen_inheritance_die): Assume DW_ACCESS_public as the default for dwarf_version > 2 and parent other than DW_TAG_class_type. From-SVN: r164442
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/dwarf2out.c26
2 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a1d1b8f..2ad185b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/45124
+ * dwarf2out.c (add_accessibility_attribute): Assume
+ DW_ACCESS_private as the default for dwarf_version > 2
+ and DW_TAG_class_type parent.
+ (gen_inheritance_die): Assume DW_ACCESS_public as the default
+ for dwarf_version > 2 and parent other than DW_TAG_class_type.
+
2010-09-20 Rafael Carre <rafael.carre@gmail.com>
PR target/45726
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 5ee14ee..963ba1f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -15921,10 +15921,22 @@ add_AT_location_description (dw_die_ref die, enum dwarf_attribute attr_kind,
static void
add_accessibility_attribute (dw_die_ref die, tree decl)
{
+ /* In DWARF3+ the default is DW_ACCESS_private only in DW_TAG_class_type
+ children, otherwise the default is DW_ACCESS_public. In DWARF2
+ the default has always been DW_ACCESS_public. */
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);
+ {
+ if (dwarf_version == 2
+ || die->die_parent == NULL
+ || die->die_parent->die_tag != DW_TAG_class_type)
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_private);
+ }
+ else if (dwarf_version > 2
+ && die->die_parent
+ && die->die_parent->die_tag == DW_TAG_class_type)
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_public);
}
/* Attach the specialized form of location attribute used for data members of
@@ -19643,10 +19655,20 @@ gen_inheritance_die (tree binfo, tree access, dw_die_ref context_die)
if (BINFO_VIRTUAL_P (binfo))
add_AT_unsigned (die, DW_AT_virtuality, DW_VIRTUALITY_virtual);
+ /* In DWARF3+ the default is DW_ACCESS_private only in DW_TAG_class_type
+ children, otherwise the default is DW_ACCESS_public. In DWARF2
+ the default has always been DW_ACCESS_private. */
if (access == access_public_node)
- add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_public);
+ {
+ if (dwarf_version == 2
+ || context_die->die_tag == DW_TAG_class_type)
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_public);
+ }
else if (access == access_protected_node)
add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_protected);
+ else if (dwarf_version > 2
+ && context_die->die_tag != DW_TAG_class_type)
+ add_AT_unsigned (die, DW_AT_accessibility, DW_ACCESS_private);
}
/* Generate a DIE for a class member. */