[clang] [CIR] CompoundLiteralExpr for Aggregate types (PR #164172)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 20 09:47:28 PDT 2025


================
@@ -550,7 +576,7 @@ void AggExprEmitter::emitNullInitializationToLValue(mlir::Location loc,
       return;
     }
 
-    cgf.cgm.errorNYI("emitStoreThroughBitfieldLValue");
+    cgf.emitStoreThroughBitfieldLValue(RValue::get(null), lv);
----------------
andykaylor wrote:

OGCG implements this as:

```
    // For non-aggregates, we can store the appropriate null constant.
    llvm::Value *null = CGF.CGM.EmitNullConstant(type);
    // Note that the following is not equivalent to
    // EmitStoreThroughBitfieldLValue for ARC types.
    if (lv.isBitField()) {
      CGF.EmitStoreThroughBitfieldLValue(RValue::get(null), lv);
    } else {
      assert(lv.isSimple());
      CGF.EmitStoreOfScalar(null, lv, /* isInitialization */ true);
    }
```
We should probably follow that structure rather than assume it's a bitfield if it's not simple.

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


More information about the cfe-commits mailing list