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