================
@@ -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)
----------------
yabinc wrote:

Changed IsFlexibleArray to FieldSize.
If you mean to use getTypeAllocSize() in DoZeroInitPadding(),
I don't know how to replace ASTContext::getTypeSizeInChars(clang::QualType T) 
with DataLayout::getTypeAllocSize(llvm::Type *Ty).

If you mean to always use 
CGM.getDataLayout().getTypeAllocSize(EltInit->getType()), there is a case when 
EltInit isn't avaiable (when emitting a DesignatedInitUpdateExpr with a nested 
InitListExpr).

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