[clang] [BoundsSafety] Support late parsing for `counted_by` in type positions (PR #166491)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 19 07:26:26 PST 2025


================
@@ -7012,6 +7012,9 @@ def err_builtin_counted_by_ref_invalid_use : Error<
   "value returned by '__builtin_counted_by_ref' cannot be used in "
   "%select{an array subscript|a binary}0 expression">;
 
+def err_counted_by_on_nested_pointer : Error<
+  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' attribute on nested pointer type is not allowed">;
----------------
AaronBallman wrote:

Are we sure that "nested pointer type" is sufficiently clear?
```
void (*fp)(int size, int *ptr __counted_by(size));
```
is `ptr` a "nested" pointer type given that it's within the declarator for a function pointer?

Maybe "on a pointer to pointer type is not allowed"?

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


More information about the cfe-commits mailing list