[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 08:13:04 PDT 2025


================
@@ -130,17 +389,136 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
   QualType destTy = ce->getType();
   CastKind kind = ce->getCastKind();
 
+  // These cases are generally not written to ignore the result of evaluating
+  // their sub-expressions, so we clear this now.
+  [[maybe_unused]] bool ignored = TestAndClearIgnoreResultAssign();
+
   switch (kind) {
+  case clang::CK_Dependent:
+    llvm_unreachable("dependent cast kind in CIR gen!");
+  case clang::CK_BuiltinFnToFnPtr:
+    llvm_unreachable("builtin functions are handled elsewhere");
+
+  case CK_CPointerToObjCPointerCast:
+  case CK_BlockPointerToObjCPointerCast:
+  case CK_AnyPointerToBlockPointerCast:
+  case CK_BitCast: {
+    auto src = Visit(const_cast<Expr *>(e));
----------------
erichkeane wrote:

another place we can't use auto.

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


More information about the cfe-commits mailing list