[clang] [CodeGen] Mark operator delete as captures(address) (PR #198202)
Antonio Frighetto via cfe-commits
cfe-commits at lists.llvm.org
Mon May 25 08:08:17 PDT 2026
antoniofrighetto wrote:
> > I'm a little worried about adding provenance annotations when we haven't nailed this down yet. Especially with -fno-assume-sane-operator-new, since that's the only escape hatch we have at the moment.
>
> Thinking about this again, making this part of `-fassume-sane-operator-new` probably makes sense, because the `captures(address)` on `operator delete` is kind of the dual of `noalias` on `operator new`, and we only add the latter for sane operator new.
I understand the concerns raised here, and that, in principle, if we don't assume sane allocator semantics, it may as well be questionable to assert that pointer provenance does not outlive `operator delete`; but I can't immediately see how the unusual semantics for `operator new` are also implied for `operator delete`. `-fassume-sane-operator-new` seems to make a statement about operator new only, not about delete (unlike GCC `-fassume-sane-operators-new-delete` which covers the latter too), which also makes me slightly cast doubts on the duality between captures(address) and noalias itself.
https://github.com/llvm/llvm-project/pull/198202
More information about the cfe-commits
mailing list