[clang] [CIR][CodeGen] Support DesignatedInitUpdateExpr in constant emission (PR #194238)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 16:49:08 PDT 2026


================
@@ -374,6 +374,202 @@ mlir::Attribute buildRecord(ConstantEmitter &emitter, const APValue &val,
 }
 } // namespace ConstRecordBuilder
 
+//===----------------------------------------------------------------------===//
+//                         DesignatedInitUpdateExpr
+//===----------------------------------------------------------------------===//
+
+// Forward declaration.
+static bool emitDesignatedInitUpdater(ConstantEmitter &emitter,
+                                      CIRGenModule &cgm, QualType type,
+                                      mlir::Attribute &base,
+                                      const InitListExpr *updater);
+
+/// Apply a DesignatedInitUpdateExpr's updater InitListExpr to an existing
+/// record constant. The record's fields are decomposed, modified according to
+/// the updater, and reassembled.
+static bool updateRecord(ConstantEmitter &emitter, CIRGenModule &cgm,
----------------
andykaylor wrote:

Does this handle unions correctly? If so, can you add a test for that? If not, can you add an NYI?

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


More information about the cfe-commits mailing list