[PATCH] D148381: [WIP][Clang] Add counted_by attribute
Yeoul Na via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 23 18:38:51 PDT 2023
rapidsna added inline comments.
================
Comment at: clang/include/clang/Basic/AttrDocs.td:7209
+ /* ... */
+ struct bar *fam[] __attribute__((counted_by(num_fam_elements)));
+ };
----------------
I don't think it's necessary for this patch but for [[ https://discourse.llvm.org/t/rfc-enforcing-bounds-safety-in-c-fbounds-safety/70854/113?u=rapidsna | -fbounds-safety ]], we'd eventually turn this into a type attribute that we will use to create a sugared type or qualified type. And we'd make the attribute work for **both** this position and inside the array bracket (e.g., `fam[__counted_by(n)]`). Would it work for you?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148381/new/
https://reviews.llvm.org/D148381
More information about the cfe-commits
mailing list