[clang] [CIR] Upstream Unary Inc/Dec for ComplexType (PR #149162)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 18 10:16:36 PDT 2025


================
@@ -56,6 +56,26 @@ class ComplexExprEmitter : public StmtVisitor<ComplexExprEmitter, mlir::Value> {
   mlir::Value VisitParenExpr(ParenExpr *e);
   mlir::Value
   VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *e);
+
+  mlir::Value VisitPrePostIncDec(const UnaryOperator *e, bool isInc,
+                                 bool isPre);
+
+  mlir::Value VisitUnaryPostDec(const UnaryOperator *e) {
----------------
AmrDeveloper wrote:

I implemented it locally, but I was thinking that there are no checks on unary op, and anyone can call the function with `cir::UnaryOpKind::Not, Minus or Plus` and it will generate CIR code that will crash only when we lower to LLVM 🤔, do you think this is the best option or maybe we should rename the booleans in a better way @xlauko 

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


More information about the cfe-commits mailing list