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] Support arbitrary check groups for the -fbounds-safety-bringup-missing-checks= flag
Currently we have the `-fbounds-safety-bringup-missing-checks=` flag
which allows switching on new bounds checks. This flag has a special `all` value
that means switch on all the checks.
However `all` isn't sufficient because we may have `-fbounds-safety`
adopters using the `-fbounds-safety-bringup-missing-checks` flag
(enables `all` checks) already but we want to introduce new bounds
checks that don't get enabled automatically.
This patch solves this problem by introducing support for arbitrary
groups of checks. This is implemented by the
`LangOptionsBase::getBoundsSafetyNewChecksMaskForGroup` function which
takes a group name and returns a bit mask of the checks that should be
enabled for the group.
This patch introduces the `batch_0` group. It is currently the same as
`all` but as we introduce support of more bounds checks `batch_0` will
contain the same set of checks, but `all` will change over time to
include any new checks we implement.
This means an adopter of `-fbounds-safety` can provide the
`-fbounds-safety-bringup-missing-checks=batch_0` flag to get a stable group
of checks that will not change over time. This is preferrable to
specifying `-fbounds-safety-bringup-missing-checks=all` because the
enabled checks will likely change overtime which could cause regressions
in an `-fbounds-safety` adopter when the compiler is upgraded.
While we're here this patch also fixes how the
`BoundsSafetyNewChecksMask` type was being incorrectly used as both an
enum and a bitmask. While this technically worked (because enums have an
underlying integer type) it isn't conceptually correct because a bit
mask and an enum value are not the same thing. A value of enum type
should take on only **ONE** of the valid enum values, whereas a bitmask
can take on one or more of the valid enum values.
This is fixed by introducing `BoundsSafetyNewChecksMaskIntTy` and using
it where appropriate and also renaming `BoundsSafetyNewChecksMask` to
`BoundsSafetyNewChecks`.
rdar://145826593
(cherry picked from commit 704c190)
HelpText<"Enable a set of new -fbounds-safety run-time checks, (option: access_size, indirect_count_update, return_size, ended_by_lower_bound, compound_literal_init, libc_attributes, array_subscript_agg, all)">;
2007
+
HelpText<"Enable a set of new -fbounds-safety run-time checks, (option: access_size, indirect_count_update, return_size, ended_by_lower_bound, compound_literal_init, libc_attributes, array_subscript_agg, all, batch_0)">;
HelpText<"Disable a set of new -fbounds-safety run-time checks, (option: access_size, indirect_count_update, return_size, ended_by_lower_bound, compound_literal_init, libc_attributes, array_subscript_agg, all)">;
2012
+
HelpText<"Disable a set of new -fbounds-safety run-time checks, (option: access_size, indirect_count_update, return_size, ended_by_lower_bound, compound_literal_init, libc_attributes, array_subscript_agg, all, batch_0)">;
0 commit comments