[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:27 PDT 2026
================
@@ -0,0 +1,80 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify %s
+
+// The counted_by family on a function parameter. The count is parsed where it
+// is written, also with late parsing, so it names a parameter declared before
+// the annotated one.
+
+#define __counted_by(f) __attribute__((counted_by(f)))
----------------
delcypher wrote:
This test case is missing a lot of coverage for `__sized_by`, `__sized_by_or_null`, and `__counted_by_or_null` because it only tests what happens in some scenarios for `__counted_by`. You probably need to duplicate this test case 4 times and have each test only handle one attribute. Alternatively you can test all 4 attributes in the same file but either way I'd prefer to see exhaustive coverage of the new diagnostics for each attribute.
https://github.com/llvm/llvm-project/pull/234941
More information about the llvm-branch-commits
mailing list