================
@@ -870,6 +904,15 @@ bool ConstStructBuilder::Build(const APValue &Val, const 
RecordDecl *RD,
     if (!EltInit)
       return false;
 
+    if (ZeroInitPadding) {
+      if (!DoZeroInitPadding(Layout, FieldNo, *Field, SizeSoFar,
+                             IsFlexibleArray, AllowOverwrite))
+        return false;
+      if (IsFlexibleArray)
----------------
efriedma-quic wrote:

I think I've figured out the way IsFlexibleArray works, but it's sort of 
awkward.  Do you really need to use a different codepath for flexible-array 
fields, vs. ordinary fields?  It seems like it would be simpler to just use 
getTypeAllocSize() in both cases.  And the name "IsFlexibleArray" is a bit 
confusing because isn't really reliably detecting flexible arrays; there are 
other zero-size fields.

https://github.com/llvm/llvm-project/pull/97121
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to