You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BoundsSafety] Add build settings to control the bounds check mode for -fbounds-safety
This patch introduces two new build settings
The first is `CLANG_BOUNDS_SAFETY_BRINGUP_MISSING_CHECKS`. This setting can be used
to control which new bounds checks are enabled. It takes two special
values:
1. `none` - This disables all the new bounds checks. This corresponds to
`-fno-bounds-safety-bringup-missing-checks`.
2. `default` - This will use the compiler default (i.e. the build system
won't pass the `-fbounds-safety-bringup-missing-checks=` flag).
If the build setting value is not any of the special values it is passed
directly as an argument to `-fbounds-safety-bringup-missing-checks=`.
This allows enabling a specific set of checks. E.g.:
```
CLANG_BOUNDS_SAFETY_BRINGUP_MISSING_CHECKS=access_size,return_size
```
would pass `-fbounds-safety-bringup-missing-checks=access_size,return-size`.
The second build setting is
`CLANG_BOUNDS_SAFETY_BRINGUP_MISSING_CHECKS_OPT_OUTS`. This setting is
intended to complement the previous build setting by providing a way to
opt out of specific bounds checks. E.g.:
```
CLANG_BOUNDS_SAFETY_BRINGUP_MISSING_CHECKS=batch_0
CLANG_BOUNDS_SAFETY_BRINGUP_MISSING_CHECKS_OPT_OUTS=access_size
```
This is equivalent to
```
-fbound-safety-bringup-missing-checks=batch_0 -fno-bounds-safety-bringup-missing-checks=access_size
```
This opts the compilation unit into all checks in the `batch_0` group
except the `access_size` bounds check.
These new build settings only apply when all of the following are true:
* `CLANG_ENABLE_BOUNDS_SAFETY` or `CLANG_ENABLE_BOUNDS_ATTRIBUTES` is enabled.
* For C source files
The existing `boundsSafetyCLanguageExtension` test case has been
modified to test the behavior of these new flags.
rdar://161599307
0 commit comments