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

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 02:07:17 PDT 2024


================
@@ -4774,3 +4774,9 @@ def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> {
   let Attributes = [CustomTypeChecking, Constexpr];
   let Prototype = "void(...)";
 }
+
+def GetCountedBy : Builtin {
+  let Spellings = ["__builtin_get_counted_by"];
+  let Attributes = [NoThrow];
+  let Prototype = "size_t*(void*)";
----------------
Sirraide wrote:

I’m a bit worried about the `size_t*` return type not necessarily being all that accurate (as you point out somewhere). I feel like we might want to mark this as `CustomTypeChecking` and handle it accordingly in Sema. That should also allow us to issue a better diagnostic if the argument does not reference a flexible array member.

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


More information about the cfe-commits mailing list