# 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][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][2], [3][3]]. ## Overview This proposal adjusts the wording in the DWARF spec to clarify that explicit `DW_AT_object_pointer` 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. [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 --- 2025-02-03: Accepted; will remove the sentence from Section 5.7.8. Section 2.11 Artificial Entries is clear that using `DW_AT_artificial` for this case is expected.