[clang] [clang] Add value_type attr, use it to add noalias when pass-by-value. (PR #95004)
Florian Hahn via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 09:53:17 PDT 2025
fhahn wrote:
Just rebased the PR and
> > I feel like this is a property that needs to propagate through types
>
> You mean, similar to the way trivial_abi works? That makes sense.
I am not sure about propagating. I added some documentation to make the spec of the attribute clearer.
Specifically, it requires the objects of the type to be considered copied into new objects when passing to functions, i.e. code using the type isn't allowed to rely on previous pointers to the actual object e.g. via copy elision or NRVO.
Similarly, I think the guarantees are also different to `trivial_abi`, as there could be other pointers to the same object even if it is trivial via copy elision or NRVO. There's a thread where this problem in general has been discussed extensively a while ago https://lists.llvm.org/pipermail/cfe-dev/2020-July/066357.html
https://github.com/llvm/llvm-project/pull/95004
More information about the cfe-commits
mailing list