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

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 2 09:11:26 PDT 2025


================
@@ -1889,6 +1889,25 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
     }
     return v;
   }
+  case CK_IntegralToPointer: {
+    auto DestCIRTy = cgf.convertType(destTy);
----------------
andykaylor wrote:

```suggestion
    mlir:Type destCIRTy = cgf.convertType(destTy);
```
Only use auto if the type is extremely verbose (such as with iterators) or obvious (such as with cast results).

https://llvm.github.io/clangir/GettingStarted/coding-guideline.html#use-of-auto

Also, in CIR code we usually follow MLIR style for variable naming (it depends on the directory the code is in).

https://llvm.github.io/clangir/GettingStarted/coding-guideline.html#variable-naming-camelcase-vs-camelback

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


More information about the cfe-commits mailing list