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

Tex Riddell via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 18:19:09 PST 2025


tex3d wrote:

> How does it not duplicate sub-expressions while also not creating temporary variables to capture results?

The way I thought of to comprehensively solve this in a clear general way was to:
- create a new temporary with an anonymous struct type containing the exact sequence of expression types from the initializer
- initialize that with a flat initializer list containing the original expressions
- then refer to that temporary in expressions in a new rewritten initializer list matching the target type layout.

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


More information about the cfe-commits mailing list