[PATCH] D143128: [-Wunsafe-buffer-usage] Fix-Its transforming `&DRE[any]` to `(DRE.data() + any)`
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 2 17:10:05 PST 2023
NoQ added a comment.
In D143128#4108502 <https://reviews.llvm.org/D143128#4108502>, @ziqingluo-90 wrote:
> In D143128#4108375 <https://reviews.llvm.org/D143128#4108375>, @NoQ wrote:
>
>> Why do we prefer `DRE.data() + any` to `&DRE.data()[any]`? It could be much less intrusive this way, and the safety guarantees are the same.
>
> It is actually `(DRE.data() + any)` versus `&DRE.data()[any]`. Are they quite the same in terms of being intrusive?
They may be equally verbose but I think the latter looks much more similar to the original code in terms of shape. This could be valuable because there's probably a reason why the programmer preferred to write it that way. Or even if there wasn't any reason, the users still may find it surprising that we change the shape for no apparent reason.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143128/new/
https://reviews.llvm.org/D143128
More information about the cfe-commits
mailing list