Unify CXXTemporaryObjectExpr and CXXConstructExpr code and zero-initialize the object if requested.
Hints on how to test this properly without creating some weird intermediate object are welcome of course. :)
Paths
| Differential D154189
[clang][Interp] Implement zero-init of record types ClosedPublic Authored by tbaeder on Jun 30 2023, 12:59 AM.
Details Summary Unify CXXTemporaryObjectExpr and CXXConstructExpr code and zero-initialize the object if requested. Hints on how to test this properly without creating some weird intermediate object are welcome of course. :)
Diff Detail Event Timeline
tbaeder marked 2 inline comments as done. tbaeder added inline comments.
tbaeder marked an inline comment as done. This revision is now accepted and ready to land.Jul 31 2023, 6:41 AM This revision was landed with ongoing or failed builds.Sep 5 2023, 2:23 AM Closed by commit rG6d79f985b53e: [clang][Interp] Implement zero-init of record types (authored by tbaeder). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 536135 clang/lib/AST/Interp/ByteCodeExprGen.h
clang/lib/AST/Interp/ByteCodeExprGen.cpp
clang/lib/AST/Interp/Descriptor.h
clang/lib/AST/Interp/Descriptor.cpp
clang/test/AST/Interp/records.cpp
|
I briefly talked about this with @aaron.ballman on IRC. The current interpreter properly zero-initialized all the fields of a struct, but the un-does the initialization again (and initializes them to a APValue::Indeterminate in HandleConstructorCall::SkipToField().