[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 14:08:52 PDT 2025


================
@@ -198,6 +198,19 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
 
     return create<cir::BinOp>(loc, cir::BinOpKind::Div, lhs, rhs);
   }
+
+  /// Create a cir.ptr_stride operation to get access to an array element.
+  /// idx is the index of the element to access, shouldDecay is true if the
+  /// result should decay to a pointer to the element type.
+  mlir::Value getArrayElement(mlir::Location arrayLocBegin,
+                              mlir::Location arrayLocEnd, mlir::Value arrayPtr,
+                              mlir::Type eltTy, mlir::Value idx,
+                              bool shouldDecay);
+
+  /// Returns a decayed pointer to the first element of the array
+  /// pointed to by arrayPtr.
----------------
andykaylor wrote:

```suggestion
  /// pointed to by \p arrayPtr.
```

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


More information about the cfe-commits mailing list