diff options
author | Dan Liew <dan@su-root.co.uk> | 2024-07-19 12:35:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-19 12:35:01 +0100 |
commit | 6da23b647ea0c7961a31742e3daac80f4c08e99c (patch) | |
tree | 2420c7feea0799024e40fc7cbbca3dbb768c3b15 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | fdfc49186318727653cf6b13686bb77cfed60e33 (diff) | |
download | llvm-6da23b647ea0c7961a31742e3daac80f4c08e99c.zip llvm-6da23b647ea0c7961a31742e3daac80f4c08e99c.tar.gz llvm-6da23b647ea0c7961a31742e3daac80f4c08e99c.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions