[clang] [CIR] Upstream CreateOp for ComplexType with folder (PR #143192)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 10 04:24:46 PDT 2025


================
@@ -255,7 +255,13 @@ void CIRGenFunction::emitExprAsInit(const Expr *init, const ValueDecl *d,
     emitScalarInit(init, getLoc(d->getSourceRange()), lvalue);
     return;
   case cir::TEK_Complex: {
-    cgm.errorNYI(init->getSourceRange(), "emitExprAsInit: complex type");
+    mlir::Value complex = emitComplexExpr(init);
+    if (capturedByInit)
+      cgm.errorNYI(init->getSourceRange(),
+                   "emitExprAsInit: complex type captured by init");
+    mlir::Location loc = getLoc(init->getExprLoc());
+    emitStoreOfComplex(loc, complex, lvalue,
+                       /*init*/ true);
----------------
xlauko wrote:

```suggestion
                       /*isInit=*/ true);
```

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


More information about the cfe-commits mailing list