[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 10:58:59 PST 2024


================
@@ -850,6 +1034,13 @@ CodeGenFunction::emitBuiltinObjectSize(const Expr *E, unsigned Type,
     }
   }
 
+  if (IsDynamic) {
+    // Emit special code for a flexible array member with the "counted_by"
+    // attribute.
+    if (Value *V = emitFlexibleArrayMemberSize(E, Type, ResType))
+      return V;
----------------
nickdesaulniers wrote:

Should `emitFlexibleArrayMemberSize` be made infallible (via asserts rather than early returns of `nullptr`)?

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


More information about the cfe-commits mailing list