[PATCH] D154189: [clang][Interp] Implement zero-init of record types

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 07:24:05 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1240
+  // Fields
+  for (const Record::Field &Field : R->fields()) {
+    const Descriptor *D = Field.Desc;
----------------
tbaeder wrote:
> aaron.ballman wrote:
> > It looks like you're not initializing base classes or padding bits: http://eel.is/c++draft/dcl.init#general-6.2 -- we could use test coverage for both of those cases (don't forget to also test bit-fields). You should also have a test for zero init of unions.
> Unions and bitfields are generally not supported yet, and I'm not sure what you mean by padding bits - they don't exist at this stage. In storage however, they are always zero since we memset that to 0.
> Unions and bitfields are generally not supported yet, 

Let's add the test coverage and mark failures with FIXME comments; otherwise we risk forgetting to add the test coverage later.

> and I'm not sure what you mean by padding bits - they don't exist at this stage. In storage however, they are always zero since we memset that to 0.

So long as we're validating that they're properly set to zero; that's the important part.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154189/new/

https://reviews.llvm.org/D154189



More information about the cfe-commits mailing list