================ @@ -161,6 +162,17 @@ mlir::Value ComplexExprEmitter::VisitChooseExpr(ChooseExpr *e) { return Visit(e->getChosenSubExpr()); } +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); ---------------- AmrDeveloper wrote:
I used getNullValue, it's nicer and required some changes in `CIRToLLVMConstantOpLowering::matchAndRewrite` because previously we expected the value to be ConstComplexAttr, so I supported ZeroAttr too, I will backport this change after merging https://github.com/llvm/llvm-project/pull/147143 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits