juanvazquez wrote: > `null after move` is fine I guess? As a record-decl attribute it is a little > weird as it is not particularly specific what it means though in the case of > multiple fields. UNLESS we want it to mean something like > "memset-0-after-move" .
After some thought I also lean towards [[null_after_move]] as a class attribute. I think it's the best suited for annotating smart-pointer-like types. I have been playing with the idea of 2 attributes as a solution to the problems explained by @martinboehme if we lean towards annotating operations. 1. A class attribute (e.g. [[specified-after-move]]) to mark user-defined types as left in a specified state after move, and therefore allowed to be used. 2. A function attribute (e.g. [[unsafe-after-move]]) to overrule the previous one if a member method tries an unsafe operation (e.g. dereference). Although after re-visiting some examples of user defined smart-pointer-like types I think the cost of adding and using 2 attributes may not be worth for the typical scenario we are trying to solve. Smart-pointer-like types consistently seem to use well-known operators (operator*, operator->, operator[]) to dereference. Hence I lean towards [[null_after_move]] as a class attribute. As proposed, making it mean something something generic like "memset-0-after-move" fits pretty well. I'm starting to write an [RFC](https://llvm.org/docs/RFCProcess.html) as requested in this discussion with a proposal to continue the discussion, and allow the community to chime-in. Unless someone in this discussion have strong feelings against starting it. On that regard, sorry for not writing the RFC first, that's on me. I should have known better. Hope I didn't make ppl in the PR feel too bad about it. Was not my intention to skip required steps. And thx for all the discussion here. I'll ping this thread as soon as I've the RFC ready :-) https://github.com/llvm/llvm-project/pull/178432 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
