[clang] [CIR] Upstream pointer arithmetic support (PR #138041)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 00:52:00 PDT 2025


================
@@ -185,6 +185,15 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
   }
   bool isInt(mlir::Type i) { return mlir::isa<cir::IntType>(i); }
 
+  //
+  // Constant creation helpers
+  // -------------------------
+  //
+  cir::ConstantOp getSInt32(int32_t c, mlir::Location loc) {
+    auto sInt32Ty = getSInt32Ty();
+    return create<cir::ConstantOp>(loc, cir::IntAttr::get(sInt32Ty, c));
----------------
xlauko wrote:

```suggestion
    return getConstantInt(loc, getSInt32Ty(), c);
```

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


More information about the cfe-commits mailing list