[all-commits] [llvm/llvm-project] 6da23b: [BoundsSafety] Add `-fexperimental-bounds-safety` ...
Dan Liew via All-commits
all-commits at lists.llvm.org
Fri Jul 19 04:35:23 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6da23b647ea0c7961a31742e3daac80f4c08e99c
https://github.com/llvm/llvm-project/commit/6da23b647ea0c7961a31742e3daac80f4c08e99c
Author: Dan Liew <dan at su-root.co.uk>
Date: 2024-07-19 (Fri, 19 Jul 2024)
Changed paths:
M clang/include/clang/Basic/LangOptions.def
M clang/include/clang/Driver/Options.td
M clang/lib/Sema/SemaDeclAttr.cpp
A clang/test/Sema/attr-counted-by-bounds-safety-vlas.c
Log Message:
-----------
[BoundsSafety] Add `-fexperimental-bounds-safety` CC1 and language option and use it to tweak `counted_by`'s semantics (#92623)
This adds the `-fexperimental-bounds-safety` cc1 and corresponding
language option. This language option enables "-fbounds-safety" which is
a bounds-safety extension for C that is being incrementally upstreamed.
This cc1 flag is not exposed as a driver flag yet because most of the
implementation isn't upstream yet.
The language option is used to make a small semantic change to how the
`counted_by` attribute is treated. Without
`-fexperimental-bounds-safety` the attribute is allowed (but emits a
warning) on a flexible array member where the element type is a struct
with a flexible array member. With the flag this situation is an error.
E.g.
```
struct has_unannotated_FAM {
int count;
char buffer[];
};
struct buffer_of_structs_with_unnannotated_FAM {
int count;
// Forbidden with `-fexperimental-bounds-safety`
struct has_unannotated_FAM Arr[] __counted_by(count);
};
```
rdar://125400392
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list