Yeah, I'm good either way - describing the artificiality of object_pointer
as optional, or removing that entirely & leaving that up to consumers to
use as needed. I think I'd lean towards removing the wording & leaving it
up to users to decide what's artificial and what isn't.

On Wed, Jan 22, 2025 at 2:54 AM Michael Buch via Dwarf-discuss <
dwarf-discuss@lists.dwarfstd.org> wrote:

> # DW_AT_object_pointer: clarify wording around implicit versus
> explicit object parameters
>
> ## Background
>
> With C++23 we got the ability to explicitly spell out in source the
> object parameter of a class method [1]. The object parameter for such
> methods is not compiler-generated and is explicitly named by the user.
> The wording of the current DWARF spec assumes object parameters are
> implicit and specifies that those parameters be marked
> DW_AT_artificial, despite them not falling into the category for
> "artificial" parameters.
>
> Other examples of languages with explicit object parameters are Python and
> Rust.
>
> Recently Clang started emitting DW_AT_object_pointer for explicit
> object parameters but decided not to mark them artificial [2][3].
>
> ## Overview
>
> This proposal adjusts the wording in the DWARF spec to clarify that
> explicit DW_AT_object_parameter's might not be marked
> DW_AT_artificial.
>
> ## Proposed Changes
>
> In chapter "5.7.8 Member Function Entries", change the mention of
> `DW_AT_artificial` in the last sentence as follows:
>
> [ORIGINAL TEXT]
> >>>>>>>>>>>>>>>
> If the member function entry describes a non-static member function,
> then that entry has a DW_AT_object_pointer attribute whose value is a
> reference to the formal parameter entry that corresponds to the object
> for which the function is called. The name attribute of that formal
> parameter is defined by the current language (for example, this for
> C++ or self for Objective C and some other languages). That parameter
> also has a DW_AT_artificial attribute whose value is true.
> [NEW TEXT]
> ==========
> If the member function entry describes a non-static member function,
> then that entry has a DW_AT_object_pointer attribute whose value is a
> reference to the formal parameter entry that corresponds to the object
> for which the function is called. The name attribute of that formal
> parameter is defined by the current language (for example, this for
> C++ or self for Objective C and some other languages). Many languages
> make the object pointer an implicit parameter with no syntax. In that
> case the parameter should have a DW_AT_artificial attribute whose
> value is true.
> <<<<<<<<<<<<<<<
>
> Alternatively we could just omit any mention of DW_AT_artificial. And
> we might want to add some informative text about C++23's explicit
> object parameters.
>
> ## References
>
> * [1]:
> https://en.cppreference.com/w/cpp/language/member_functions#Explicit_object_member_functions
> * [2]: https://github.com/llvm/llvm-project/pull/122897
> * [3]: https://github.com/llvm/llvm-project/pull/122928
> --
> Dwarf-discuss mailing list
> Dwarf-discuss@lists.dwarfstd.org
> https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss
>
-- 
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss

Reply via email to