[Dwarf-Discuss] DW_AT_accessibility default

Michael Eager eager@eagercon.com
Thu Jul 29 18:09:08 GMT 2010

Jakub Jelinek wrote:
> Hi!
> For DW_TAG_inheritance, DW_TAG_member and DW_TAG_subprogram
> the standard says that if the DW_AT_accessibility attribute is missing,
> private accessibility is assumed for class entries and public for
> interfaces, structs or unions.

This conforms to the semantics of C++.

> Does the same apply to all the other DIEs that may have DW_AT_accessibility
> attribute?

Not necessarily.  See below.

> What exactly is meant by in class?  DIEs that are immediate children
> of DW_TAG_class_type (resp. DW_TAG_{structure,interface,union}_type)?

It means members of a class/etc.  In DWARF terms, the children of
the class/etc.

> E.g. if
> DW_TAG_class_type
>   DW_TAG_structure_type
>     ! DW_AT_accessibility is missing, does that imply DW_ACCESS_private
>     ! here?

I don't recall the accessibility of nested class definitions in C++.  It may
be controlled by whether a "public:" or "private:" label is present before the
class definition, and the corresponding default visibility (public for
struct/union, private for class) if the label is omitted.  But I'd have to
research the C++ standard to be sure.

If the DW_AT_accessibility attribute is missing, then the semantics of
the language define the accessibility.

> Should for DIE parents other than DW_TAG_{structure,interface,union,class}_type
> DW_AT_accessibility be not considered meaningful?

I don't know of a language which has similar attributes for
non-class members.  C++/Java do not allow public or private
attributes to be applied to anything which is not a member of
a class/etc.

Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

More information about the Dwarf-discuss mailing list