================
@@ -180,7 +193,7 @@ bool Sema::ValidateBoundsAttrTypeShape(QualType Ty,
SourceLocation AttrLoc,
InvalidTypeKind = CountedByInvalidPointeeTypeKind::FUNCTION;
} else if (!Flags.CountInBytes &&
PointeeTy->isStructureTypeWithFlexibleArrayMember()) {
- if (Ty->isArrayType()) {
+ if (!getLangOpts().BoundsSafety && Ty->isArrayType()) {
----------------
rapidsna wrote:
Yes. Upstream there's only one mode, so `getLangOpts().BoundsSafety` is the
default check. `hasBoundsSafetyAttributes()` is equivalent upstream and only
marks code that downstream must also run in its attribute-only mode, which
exists only downstream to bridge temporary implementation differences and won't
be upstreamed. Here the FAM-of-FAM diagnostic should be an error only under
full -fbounds-safety, and stay a warning in attribute-only mode, so it checks
`BoundsSafety`, matching the old `CheckCountedByAttrOnField`. I'll update the
comment on `hasBoundsSafetyAttributes()` to spell out when to use it.
https://github.com/llvm/llvm-project/pull/233582
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits