[clang] [Clang] Add -Wcounted-by-addrof to warn when &fam discards __counted_by (PR #206760)
Henrik G. Olsson via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 23 19:47:07 PDT 2026
================
@@ -3044,6 +3044,85 @@ static QualType getVectorElementType(ASTContext &Context, QualType VecTy) {
return QualType();
}
+/// Returns true when the object holding the flexible array member reached by
+/// \p ME has a fixed allocation (a local, parameter, static, or global
+/// variable). A count cannot enlarge a fixed allocation, so '&fam' loses
+/// nothing useful there. Returns false when the member is reached through a
+/// pointer, where the count is the bound the layout fallback would lose.
+static bool flexibleArrayMemberHasFixedStorage(const MemberExpr *ME) {
----------------
hnrklssn wrote:
Given that https://github.com/llvm/llvm-project/pull/211697 warns for FAMs in these situations, is this still worth handling here?
https://github.com/llvm/llvm-project/pull/206760
More information about the cfe-commits
mailing list