[clang] [CIR] Implement CXXScalarValueInitExpr for ComplexType (PR #147143)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 13:01:42 PDT 2025


================
@@ -165,12 +165,8 @@ mlir::Value ComplexExprEmitter::VisitChooseExpr(ChooseExpr *e) {
 mlir::Value
 ComplexExprEmitter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *e) {
   mlir::Location loc = cgf.getLoc(e->getExprLoc());
-  QualType complexElemTy =
-      e->getType()->castAs<clang::ComplexType>()->getElementType();
-  mlir::Type complexElemLLVMTy = cgf.convertType(complexElemTy);
-  mlir::TypedAttr defaultValue = builder.getZeroInitAttr(complexElemLLVMTy);
-  auto complexAttr = cir::ConstComplexAttr::get(defaultValue, defaultValue);
-  return builder.create<cir::ConstantOp>(loc, complexAttr);
+  mlir::Type complexLLVMTy = cgf.convertType(e->getType());
----------------
xlauko wrote:

I believe this is cir not llvm type. Rename to `complexTy`.

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


More information about the cfe-commits mailing list