[clang] [CIR] Upstream basic alloca and load support (PR #128792)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 20:37:20 PST 2025


================
@@ -75,3 +110,34 @@ mlir::Value CIRGenFunction::emitScalarExpr(const Expr *e) {
 
   return ScalarExprEmitter(*this, builder).Visit(const_cast<Expr *>(e));
 }
+
+// Emit code for an explicit or implicit cast.  Implicit
+// casts have to handle a more broad range of conversions than explicit
+// casts, as they handle things like function to ptr-to-function decay
+// etc.
+mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
+  Expr *e = ce->getSubExpr();
+  QualType destTy = ce->getType();
+  CastKind kind = ce->getCastKind();
+
+  // Since almost all cast kinds apply to scalars, this switch doesn't have a
+  // default case, so the compiler will warn on a missing case. The cases are
----------------
erichkeane wrote:

Er... DOESN'T it have a default case?  

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


More information about the cfe-commits mailing list