nikic wrote: > > I'm very confused. `readonly` means that the memory behind `this` cannot be > > changed, not that the pointer cannot be changed. > > Out of curiosity, it looks not same in https://llvm.org/docs/LangRef.html: > > > This attribute indicates that the function does not write through this > > pointer argument, even though it may write to the memory that the pointer > > points to. > > If a function writes to a readonly pointer argument, the behavior is > > undefined. > > My understanding for ` it may write to the memory that the pointer points > to.` is what you said. Or do we need to update the document?
The distinction in LangRef is about a write through the pointer vs a write through an alias of the pointer to the same memory. Only the former is forbidden. https://github.com/llvm/llvm-project/pull/106499 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits