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

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 13:03:04 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());
----------------
AmrDeveloper wrote:

Yes, that's right, I will rename it

Thanks

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


More information about the cfe-commits mailing list