[Dwarf-discuss] Additional values for DW_AT_accessibility
Martin
lists@mfriebe.de
Mon Sep 28 09:23:19 GMT 2026
On 25/09/2026 19:12, Ben Woodard via Dwarf-discuss wrote:
>
> However, one thing that I am not really clear about in DWARF is does
> DW_ACCESS_private have a specific semantic meaning independent of the
> language. If it does, then it is not specified. I can see it two
> different ways:
>
> DW_ACCESS_private has a semantic meaning in DWARF separate from the
> language. In that case because the FreePascal concept of "strict
> private" maps more closely to C++'s concept of "private" which is
> translated in DWARF into DW_ACCESS_private, "strict private" should map
> to DW_ACCESS_private.
>
> If we do this then I think we need to more clearly define what the
> implied semantics of the Accessibility codes mean and do it in such a
> way that it is independent of any language.
>
> The other way that I can see it is DWARF acts as a mapping between the
> source language and the machine language and is interpreted by the
> consumer only in the context of the the language that the code was
> written in. In that case, it is the language that provides the semantic
> meaning of what the Accessibility Declaration means. That would lead to
> DW_ACCESS_private mapping to the (module) private keyword in the
> language. Strict private mapping to "DW_OP_strict_private"...
>
> This would require more of the consumers. For example: libabigail would
> have to understand the difference between "DW_ACCESS_private" as it
> applies to C++ and how it applies to FreePascal.
>
Just to add some info, in case it may help with that decision.
There likely will be some need of knowing the language to get the
correct mapping.
E.g. Delphi/FreePascal has "type/class helpers". Those are kind-of
dataless classes, that can be used to
- provide methods for another class
- access protected (but not private) data across unit boundaries.
They aren't an inherited class, more like a combination of interface and
friend.
But unlike (afaik?) a C++ friend, it only has (cross unit) access to
protected, not private methods/data.
So, if FPC where to declare them as friend, then the rules of what is
accessible would be different from C++.
More information about the Dwarf-discuss
mailing list