[llvm-branch-commits] [clang] [BoundsSafety] Support the counted_by family on function parameters (PR #234941)

Dan Liew via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Oct 23 10:50:28 PDT 2026


================
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#define __counted_by(f)  __attribute__((counted_by(f)))
+
+int global_count;
+
+// An Objective-C method parameter's count is checked like a function
+// parameter's.
+ at interface I
+// expected-error at +1{{count expression in function declaration may only reference function parameters}}
+- (void)global:(int *__counted_by(global_count))buf;
----------------
delcypher wrote:

Interesting. I didn't know we were supporting Objective-C here. We should at the very least have a positive test case here (i.e. the attribute is accepted without errors).

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


More information about the llvm-branch-commits mailing list