[clang] [CIR] SubscriptExpr for VariableLengthArray (PR #175370)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 12 13:26:13 PST 2026


================
@@ -1165,7 +1159,14 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
                                  lv.getBaseInfo());
   }
 
-  const mlir::Value idx = emitIdxAfterBase(/*promote=*/true);
+  // The HLSL runtime handles subscript expressions on global resource arrays
+  // and objects with HLSL buffer layouts.
+  if (getLangOpts().HLSL) {
+    cgm.errorNYI(e->getSourceRange(), "emitArraySubscriptExpr: HLSL");
+    return {};
+  }
+
+  mlir::Value idx = emitIdxAfterBase(/*promote=*/true);
----------------
andykaylor wrote:

Why did you put this here rather than inside the `if (vla)` condition?

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


More information about the cfe-commits mailing list