aboutsummaryrefslogtreecommitdiff
path: root/clang/docs
diff options
context:
space:
mode:
authorHenrik G. Olsson <hnrklssn@gmail.com>2024-07-09 13:58:01 -0700
committerGitHub <noreply@github.com>2024-07-09 13:58:01 -0700
commite22ebee5a3bb56cb7f9a9513f01fb7ed24b23f48 (patch)
tree543aafea0fcbb569c50f37977ecdb4e2b3f89bc7 /clang/docs
parent9e1f1cfa59c4513798de5c326d77e1e5912b1634 (diff)
downloadllvm-e22ebee5a3bb56cb7f9a9513f01fb7ed24b23f48.zip
llvm-e22ebee5a3bb56cb7f9a9513f01fb7ed24b23f48.tar.gz
llvm-e22ebee5a3bb56cb7f9a9513f01fb7ed24b23f48.tar.bz2
[Bounds-Safety] Add sized_by, counted_by_or_null & sized_by_or_null (#93231)
The attributes `sized_by`, `counted_by_or_null` and `sized_by_or_null` have been added as variants on `counted_by`, each with slightly different semantics. `sized_by` takes a byte size parameter instead of an element count, allowing pointees with unknown size. The `counted_by_or_null` and `sized_by_or_null` variants are equivalent to their base variants, except the pointer can be null regardless of count/size value. If the pointer is null the size is effectively 0. rdar://125400354
Diffstat (limited to 'clang/docs')
-rw-r--r--clang/docs/ReleaseNotes.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d9f2b16..5f5f3a3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -554,6 +554,15 @@ Attribute Changes in Clang
size_t count;
};
+- The attributes ``sized_by``, ``counted_by_or_null`` and ``sized_by_or_null```
+ have been added as variants on ``counted_by``, each with slightly different semantics.
+ ``sized_by`` takes a byte size parameter instead of an element count, allowing pointees
+ with unknown size. The ``counted_by_or_null`` and ``sized_by_or_null`` variants are equivalent
+ to their base variants, except the pointer can be null regardless of count/size value.
+ If the pointer is null the size is effectively 0. ``sized_by_or_null`` is needed to properly
+ annotate allocator functions like ``malloc`` that return a buffer of a given byte size, but can
+ also return null.
+
- The ``guarded_by``, ``pt_guarded_by``, ``acquired_after``, ``acquired_before``
attributes now support referencing struct members in C. The arguments are also
now late parsed when ``-fexperimental-late-parse-attributes`` is passed like