[clang] [clang][dataflow] Introduce a helper class for handling record initializer lists. (PR #86675)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 27 08:11:44 PDT 2024


================
@@ -744,6 +744,35 @@ RecordStorageLocation *getBaseObjectLocation(const MemberExpr &ME,
 std::vector<const FieldDecl *>
 getFieldsForInitListExpr(const InitListExpr *InitList);
 
+/// Helper class for initialization of a record with an `InitListExpr`.
+/// `InitListExpr::inits()` contains the initializers for both the base classes
+/// and the fields of the record; this helper class separates these out into two
+/// different lists. In addition, it deals with special cases associated with
+/// unions.
+class RecordInitListHelper {
----------------
martinboehme wrote:

> Is it because of the optional storage needed for the union?

Yes, exactly this -- otherwise, there would be no way for us to keep the `ImplicitValueInitExpr` "alive".

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


More information about the cfe-commits mailing list