[clang] [CIR] Upstream Unary Plus & Minus op for ComplexType (PR #150281)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 29 09:44:54 PDT 2025


================
@@ -174,6 +185,58 @@ mlir::Value ComplexExprEmitter::emitCast(CastKind ck, Expr *op,
   return {};
 }
 
+mlir::Value ComplexExprEmitter::VisitUnaryPlus(const UnaryOperator *e,
+                                               QualType promotionType) {
+  QualType promotionTy = promotionType.isNull()
+                             ? getPromotionType(e->getSubExpr()->getType())
+                             : promotionType;
+  mlir::Value result = VisitPlus(e, promotionTy);
+  if (!promotionTy.isNull()) {
+    cgf.cgm.errorNYI("ComplexExprEmitter::VisitUnaryPlus emitUnPromotedValue");
+    return {};
+  }
+
+  return result;
+}
+
+mlir::Value ComplexExprEmitter::VisitPlus(const UnaryOperator *e,
----------------
andykaylor wrote:

I still think these can be combined, and I don't think they are actually called by the Visitor pattern, so it would be better to rename them. If I'm wrong about them not being called by the Visitor they should stay.

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


More information about the cfe-commits mailing list