[clang] [BoundsSafety][Sema] Allow `sized_by`/`sized_by_or_null` on pointers to structs with a flexible array member (PR #209603)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 15 03:00:35 PDT 2026
================
@@ -152,7 +152,8 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes,
InvalidTypeKind = CountedByInvalidPointeeTypeKind::SIZELESS;
} else if (PointeeTy->isFunctionType()) {
InvalidTypeKind = CountedByInvalidPointeeTypeKind::FUNCTION;
- } else if (PointeeTy->isStructureTypeWithFlexibleArrayMember()) {
+ } else if (PointeeTy->isStructureTypeWithFlexibleArrayMember() &&
+ !CountInBytes) {
----------------
delcypher wrote:
Followup here: https://github.com/llvm/llvm-project/pull/209713
https://github.com/llvm/llvm-project/pull/209603
More information about the cfe-commits
mailing list