[clang] [WIP][Clang] Add __builtin_get_counted_by builtin (PR #102549)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 10:30:42 PDT 2024


efriedma-quic wrote:

So the idea here is that if the struct in question uses counted_by, you automatically set the count... and if, for whatever reason, the compiler can't find the corresponding field, you just throw away the count?  That seems like an terrifying API; it's impossible to predict what it will do with a given bit of code.

Maybe it makes sense to return null if you find the field, but it doesn't have a counted_by attribute at all.  But there should still be diagnostics for all the other failure modes.

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


More information about the cfe-commits mailing list