[clang] [CIR] Upstream handling of integral-to-pointer casts (PR #161653)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 2 04:42:55 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 origin/main HEAD --extensions cpp,h -- clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp clang/test/CIR/CodeGen/cast.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h b/clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h
index c7450d877..5bcdbd9a0 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDataLayout.h
@@ -87,7 +87,7 @@ public:
 
   llvm::TypeSize getTypeSizeInBits(mlir::Type ty) const;
 
-    llvm::TypeSize getPointerTypeSizeInBits(mlir::Type Ty) const {
+  llvm::TypeSize getPointerTypeSizeInBits(mlir::Type Ty) const {
     assert(mlir::isa<cir::PointerType>(Ty) &&
            "This should only be called with a pointer type");
     return layout.getTypeSizeInBits(Ty);
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index c64c5f7d7..6938be2fa 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -1907,7 +1907,7 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
       llvm_unreachable("NYI");
 
     return builder.createIntToPtr(MiddleVal, DestCIRTy);
-  }  
+  }
 
   case CK_ArrayToPointerDecay:
     return cgf.emitArrayToPointerDecay(subExpr).getPointer();

``````````

</details>


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


More information about the cfe-commits mailing list