[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 13:07:39 PST 2025


================
@@ -1730,6 +1731,16 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
   }
 #endif
 
+  // HLSL initialization lists in the AST are an expansion which can contain
+  // side-effecting expressions wrapped in opaque value expressions. To properly
+  // emit these we need to emit the opaque values before we emit the argument
+  // expressions themselves. This is a little hacky, but it prevents us needing
+  // to do a bigger AST-level change for a language feature that we need
+  // deprecate in the near future.
----------------
llvm-beanz wrote:

I don't think it makes sense to file an issue because even when we depreciate it in the language we'll still need to support it in the compiler for... a long time.

In the sema code I referred to 0005-strict-initializer-lists.md & https://github.com/microsoft/hlsl-specs/pull/325, which are language features that will require changing this quirk of HLSL. I can refer to those two here as well.

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


More information about the cfe-commits mailing list