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

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 11:17:32 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;
----------------
bwendling wrote:

Over the weekend, I thought about emitting a `-1 / 0` in the cases where we weren't able to generate the BDOS calculation. Thoughts?

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


More information about the cfe-commits mailing list