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

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 10:26:27 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- clang/lib/CIR/CodeGen/CIRGenBuilder.cpp clang/include/clang/CIR/MissingFeatures.h clang/lib/CIR/CodeGen/CIRGenBuilder.h clang/lib/CIR/CodeGen/CIRGenExpr.cpp clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp clang/lib/CIR/CodeGen/CIRGenFunction.cpp clang/lib/CIR/CodeGen/CIRGenFunction.h clang/test/CIR/CodeGen/array.cpp clang/test/CIR/Lowering/array.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
index 6b9068a75..59e46461e 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
@@ -471,12 +471,12 @@ static Address emitArraySubscriptPtr(CIRGenFunction &cgf,
   const CharUnits eltAlign =
       getArrayElementAlign(addr.getAlignment(), idx, eltSize);
 
-    assert(!cir::MissingFeatures::preservedAccessIndexRegion());
-    const mlir::Value eltPtr =
-        emitArraySubscriptPtr(cgf, beginLoc, endLoc, addr.getPointer(),
-                              addr.getElementType(), idx, shouldDecay);
-    const mlir::Type elementType = cgf.convertTypeForMem(eltType);
-    return Address(eltPtr, elementType, eltAlign);
+  assert(!cir::MissingFeatures::preservedAccessIndexRegion());
+  const mlir::Value eltPtr =
+      emitArraySubscriptPtr(cgf, beginLoc, endLoc, addr.getPointer(),
+                            addr.getElementType(), idx, shouldDecay);
+  const mlir::Type elementType = cgf.convertTypeForMem(eltType);
+  return Address(eltPtr, elementType, eltAlign);
 }
 
 LValue

``````````

</details>


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


More information about the cfe-commits mailing list