[llvm-branch-commits] [clang] [HLSL] Introduce vector- and matrix-specific versions of diagnostic warnings (PR #182386)
Deric C. via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 20 10:14:49 PST 2026
Icohedron wrote:
> > It seems we need these new diagnostics to be HLSL-specific unless we want to make changes to vector and matrix warning diagnostics across all languages.
>
> For vector conversions across languages it maybe worth an rfc to see if folks in the community are open to this. I would really like to avoid adding a bunch of duplicate HLSL diagnostics. @bogner for thoughts
Actually, I think removing `-Wconversion` from the tests is the incorrect change. The tests *should* include `-Wconversion` because it's directly calling `clang -cc1`.
According to [`HLSLToolChain::addClangWarningOptions` in `clang/lib/Driver/ToolChains/HLSL.cpp`](https://github.com/llvm/llvm-project/blob/321922938869c873f9e3cb67b43b8c727f0acb5b/clang/lib/Driver/ToolChains/HLSL.cpp#L595-L597), the `-Wconversion` flag is added by default compiling with the `clang-dxc` driver. It's just not included by default when you directly use `clang -cc1` as the tests do.
I think the only change that should be done is the addition of
```c++
CC1Args.push_back("-Wvector-conversion");
CC1Args.push_back("-Wmatrix-conversion");
```
to `HLSLToolChain::addClangWarningOptions` to enable the vector and matrix conversion diagnostics by default for HLSL when compiling through the clang-dxc driver.
https://github.com/llvm/llvm-project/pull/182386
More information about the llvm-branch-commits
mailing list