[clang] [Bounds-Safety] Add sized_by, counted_by_or_null & sized_by_or_null (PR #93231)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Thu May 23 22:16:41 PDT 2024
================
@@ -8697,9 +8708,10 @@ static bool CheckCountedByAttrOnField(
InvalidTypeKind = CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER;
}
- if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID) {
+ if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID &&
+ !CountInBytes) {
----------------
delcypher wrote:
I would have thought we would want to prevent `sized_by` on all of the conditions above (e.g. pointee being a function type) apart from pointee being an incomplete type. However, it looks like this implementation allows pointee types for all the cases we disallow it for `counted_by`.
https://github.com/llvm/llvm-project/pull/93231
More information about the cfe-commits
mailing list