[clang] [NFC][BoundsSafety] Give `counted_by_or_null`, `sized_by`, and `sized_by_or_null` their own documentation (PR #212877)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 10:26:42 PDT 2026


================
@@ -9971,6 +10035,153 @@ requirement:
   }];
 }
 
+def SizedByDocs : Documentation {
+  let Category = DocCatField;
+  let Heading = "sized_by";
+  let Content = [{
+The ``sized_by`` attribute is applied to a pointer to indicate that the pointer
+points to memory containing at least the number of *bytes* given by the
+attribute's argument. It is closely related to ``counted_by``; the difference is
+that ``counted_by`` counts the number of *elements* of the pointee type, whereas
+``sized_by`` counts the number of *bytes*. This makes ``sized_by`` the natural
+choice for ``void *`` and other byte buffers.
+
+This attribute is used by `-fbounds-safety <BoundsSafety.html>`__ to propagate
----------------
rapidsna wrote:

`__bdos` and the array bound sanitizer properly support sized_by currently?

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


More information about the cfe-commits mailing list