<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/89968>89968</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ER: Add diagnostic to flag using "%P" specifier with Objective-C pointers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jaredgrubb
</td>
</tr>
</table>
<pre>
Darwin has an extension on the printf format-specifiers for "%P", which dumps the bytes at a pointer (in contrast to "%p" which dumps a pointer's value itself) and is allowed in "OS Log" contexts.
It's easy to misuse this, for example:
```
NSUUID *uuid = ...;
os_log(..., "%{uuid_t}.16P", uuid);
```
This dumps the ObjC class data (eg, the _is-a_ pointer) -- not the UUID represented by the object.
It'd be nice if the compiler had a warning that could flag this misuse, which seems to always (IMO) be a bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkU01vgzgQ_TXmMgoihhA4cEiTjVRpd7vabs_RgAdwZWzkMU3z71emabMfUhSLGb83b954kFkPlqgRuyexOyW4hNH55h09qcEvbZu0Tt2aE_qrtjAiA1qgz0CWtbPgLISRYPbahh565ycMG56p070mzzECQkohd3-sxxGuo-5GUMs08wptb4EYMADC7LQNFAGVttA5GzxygODuFLOQ8l_4H4iQe4YPNAuBDkymF7IGtAo0AxrjrqRA20jz8gq_uiESRX76DJyK7CSyw9f_c1ipCPkW606aFyYIo-aoPXZDnzjNhkR-R4gyu__Wz99f396eTyDkYVm0ApGfIE1TkT99pR1fTCxfxaA83hsT-6d4-xLE_pRuy2-rYkzI-gf8n1J_jZr_YeRL-36EziAzKAwYXaQh0sTkRfMGLw-7athswLqwJlfFnmZPTDaQgva2xl37Tl34vz8KWgKrOwLdrxc7N83akIcRFSBc0VttBwgjBujcYhT0BofVxrulj5fARBNHr9Fc8cZR9vNvL1FhS4DQLkOaqCZXdV5jQs12v83rKs_KKhmbturKrdzvVbvNd7LM933ZUdZTXtQlYqUS3chMFlkhi20lC1mlncRCFdu8JlmRRBRFRhNqkxrzMaXOD4lmXqip6rqsEoMtGV5XQ0pLV1iTcTq7U-KbiNm0y8CiyIzmwA-WoIOh5pc_RX6Ag1KgNA7WcdBdbHV1Y-Ho0WM54Gdt4KrDGOdJXdAftDl-z42TxZtmDGHm-P7kWcjzoMO4tGnnJiHPsf792MzeRQIhz6tqFvK8dvV3AAAA__9akT6A">