[llvm-branch-commits] [clang] [BoundsSafety] support counted_by family on function parameters (PR #230538)

Mohammed Ashraf via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 23 08:51:56 PDT 2026


================
@@ -2597,6 +2605,29 @@ class Sema final : public SemaBase {
   bool ActOnLateParsedTypeAttrArgument(BoundsAttributedType *BATy,
                                        FieldDecl *FD, Expr *Arg);
 
+  /// Check the count \p E of a counted_by-family attribute on \p ParamTy, the
+  /// declared type of a parameter or the pointer it points to: it must be a
+  /// non-boolean integer naming a parameter or dereferencing one, \p ParamTy
----------------
Holo-xy wrote:

> nit: I was confused by this. How would an integer be able to name a parameter?

"it" referes to "E" meaning E must be a non boolean integer that names or derferenes a param.

> Anyway, maybe the comment doesn't need to specify the valid semantics of a count expression. I think it would be enough to say that this function checks that it's valid, and then specify the checks in the implementation.

agreed. changed it.

https://github.com/llvm/llvm-project/pull/230538


More information about the llvm-branch-commits mailing list