[clang] [Clang] Add [[readnone, readonly, writeonly]] parameter attributes (PR #178429)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 2 04:59:47 PST 2026


philnik777 wrote:

> How do we define these at the C++ language level? Like, can a user actually tell if source-level assignment operator satisfies "writeonly"? (For example, writing to a bitfield is a read.)

I think bitfields are quite special here, no? At least I can't think of another mechanism that looks like it's just a write but also reads.

FWIW if the `[[writeonly]]` part of this change is problematic I'm happy to drop it - I mostly included it for completeness. I don't think the other attributes have a problem like this.

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


More information about the cfe-commits mailing list