<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/120973>120973</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DebugInfo] DW_AT_object_pointer not attached to method declarations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Michael137
</td>
</tr>
</table>
<pre>
[DWARF's `DW_AT_object_pointer`](https://dwarfstd.org/issues/050711.2.html) indicates which `DW_TAG_formal_parameter` corresponds to the function object that the method is being called on.
One motivator for this attribute from the original proposal is that it can be used to determine whether a C++ method is static or not. LLDB does need to distinguish static vs. non-static methods, but can't rely on `DW_AT_object_pointer` at the moment because Clang does not emit it on the declaration DIE (only on the definition). GCC emits it on both. See https://godbolt.org/z/3TWjTfWon
So LLDB currently relies on the existence of a `DW_TAG_formal_parameter` called `this` which is a pointer type. With C++23, we can't rely on either of these being true because of the `deducing this` feature: https://godbolt.org/z/h4jeT54G5 (though there's a bug in both Clang and GCC here where we don't emit the `DW_AT_object_pointer` for an explicit object parameter, will raise a separate issue for it)
This issue proposes adding the `DW_AT_object_pointer` to declarations too.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVM1u2zgQfhr6MoggUZYdHXxw4nVQoIsFtgZyDChxJDKgOAY5Spp9-gUppc3-tL3YsEea-eb7GRWjHT3iQTR3ojlt1MyGwuF32xuFrqr3m470W6qeHo9_noXcRxC78vT4dLw8UfeMPT9dyXrGIHalaE5C3hrmaxT1UcizkGf9qsIQWRcURiHPNsYZo5Dnsin3VVXIwvDkhGzBem17xRjh1djerGMux4engcKk3NNVBTXhMgl6CgHjlbyOwARsEIbZ92zJw4IL2CjOhQnZkAYboUPrR-iVc6iBfCHKoyiPf3iEidi-KKYAAwVgYyMo5mC7mRGGQFPuRMGO1isH10BXisqlpnmOZeiVhw5hjqgTJJ2gTtYjvBpkgwEU3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