[clang] [HLSL] Handle init list with OpaqueValueExprs in CGExprScalar (PR #138541)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Mon May 5 10:07:06 PDT 2025
================
@@ -2095,6 +2096,17 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
assert (Ignore == false && "init list ignored");
unsigned NumInitElements = E->getNumInits();
+ // 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. See related HLSL language proposals:
+ // * 0005-strict-initializer-lists.md
+ // * https://github.com/microsoft/hlsl-specs/pull/325
----------------
llvm-beanz wrote:
This looks an awful lot like a comment I wrote... minor suggested update:
```suggestion
// deprecate in the near future. See related HLSL language proposals in the
// proposals (https://github.com/microsoft/hlsl-specs/blob/main/proposals):
// * 0005-strict-initializer-lists.md
// * 0032-constructors.md
```
https://github.com/llvm/llvm-project/pull/138541
More information about the cfe-commits
mailing list