[clang] [Clang] Document the interaction of malloc_span and alloc_size (PR #216967)
Aleksandr Nogikh via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 31 06:40:55 PDT 2026
================
@@ -5592,6 +5592,11 @@ members, one of which is a pointer to the start of the allocated memory and
the other one is either an integer type containing the size of the actually
allocated memory or a pointer to the end of the allocated region. Note, static
data members do not impact whether a type is span-like or not.
+
+In combination with the `alloc_size` attribute, if the begin pointer is
+non-null, the size of the returned span-like object has to be greater or equal
+to the number of bytes guaranteed to be dereferenceable by `alloc_size`. It also
+guarantees that the number of dereferenceable bytes is at least size.
----------------
a-nogikh wrote:
Ack
https://github.com/llvm/llvm-project/pull/216967
More information about the cfe-commits
mailing list