[clang] [CodeGen] Apply 'readonly' to 'this' pointer argument. (PR #106499)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 01:41:57 PDT 2024


ChuanqiXu9 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?

https://github.com/llvm/llvm-project/pull/106499


More information about the cfe-commits mailing list