[clang] [CIR] Refactor global variable emission and initialization (PR #138222)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri May 2 13:10:21 PDT 2025


================
@@ -90,8 +90,100 @@ class ConstExprEmitter
   }
 
   mlir::Attribute VisitCastExpr(CastExpr *e, QualType destType) {
-    cgm.errorNYI(e->getBeginLoc(), "ConstExprEmitter::VisitCastExpr");
-    return {};
+    if (const auto *ece = dyn_cast<ExplicitCastExpr>(e))
+      cgm.errorNYI(e->getBeginLoc(),
+                   "ConstExprEmitter::VisitCastExpr explicit cast");
+    Expr *subExpr = e->getSubExpr();
+
+    switch (e->getCastKind()) {
+    case CK_HLSLArrayRValue:
----------------
andykaylor wrote:

I can't see why we would need to do anything for them. Maybe the incubator placed them here at a time when OGCG was doing something with them? I believe `Evaluate` mentioned in the comment on line 136 is the AST's Evaluate function, which does seem to handle these cases.

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


More information about the cfe-commits mailing list