llvm-beanz wrote:

> > I think this approach probably needs some adjustment. HLSL allows 
> > constructor-like syntax but it behaves the same way the HLSL initializer 
> > list syntax does, so matrix initialization should be done through 
> > SemaHLSL’s initialization list handling.
> 
> Will look into this thanks for spec reference. If I do things through 
> SemaHLSL for matrices how do we want to support this request? [#160960 
> (comment)](https://github.com/llvm/llvm-project/pull/160960#discussion_r2384246323)

I think we likely will want to handle C/C++ matrix initializers in a more sane 
way than the HLSL initializers need to work (at least for current HLSL). More 
on this below...

> Also why did we do vectors via SemaInit? Are vectors also using SemaHLSL’s 
> initialization list handling? I'm assuming if so it came after the commit 
> linked below
> 
> [9f499d9](https://github.com/llvm/llvm-project/commit/9f499d9d73edfc818978c64eb24b8d2d34995d76)

This commit predates our efforts to have spec language drafted before we make 
changes in Clang and is a pretty great example of why we are emphasizing 
testing and spec writing.

Amusingly, that code actually does eventually call down to the SemaHLSL code 
for initialization lists, so it does actually support the edge cases it should 
and "do the right thing", but you today you should be able to delete this whole 
loop 
(https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaInit.cpp#L6827),
 because everything it does is done in a more complete way during list 
initialization.

A similar simplification is likely what you need for your PR here, which would 
have the effect of just passing the arguments through to the list 
initialization behavior for the underlying language. This is probably the right 
solution for both HLSL and C++ as it will keep the special grossness of HLSL to 
itself and allow C++ to have initializers that behave just like initializer 
lists.

https://github.com/llvm/llvm-project/pull/160960
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to