Skip to content

[HLSL][RootSignature] Audit RootSignatureParser diagnostic production #147800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: users/inbelic/pr-147115
Choose a base branch
from

Conversation

inbelic
Copy link
Contributor

@inbelic inbelic commented Jul 9, 2025

This pr audits the diagnostics produced in RootSignatureParser diagnostics.

First, it has been noted more than once that the current diag::err_hlsl_unexpected_end_of_params is not direct and can be misleading. For instance, here and here.

This pr address this by removing this diagnostic and replacing it with a more direct diag::err_expected_either. However, doing so removes the nuance between the case where it is a missing comma and when it was an invalid parameter.

Hence, we introduce the diag::err_hlsl_invalid_token for the latter case, which does so in a direct way. Further, we can apply the same diagnostic to the parsing of parameter values.

As part of this, we see that there was a test gap in testing the diagnostics produced from diag::err_expected_after and for the parsing of enum/flag values. As such, these are also addressed here to provide sufficient unit/sema test coverage.

  • Removes all uses of diag::err_hlsl_unexpected_end_of_params in RootSigantureParser
  • Introduce diag::err_hlsl_invalid_token to provide a direct diagnostic
  • In each of these cases, replace the diagnostic with either a diag::err_hlsl_invalid_token or diag::err_expected_either accordingly
  • Update HLSLRootSignatureParserTest to account for diagnostic changes
  • Increase test coverage of HLSLRootSignatureParserTest for enum/flag diagnostics
  • Increase test coverage of RootSignatures-err for enum/flag diagnostics
  • Small fix-up of the diag::err_expected_after and add test to demonstrate usage

Resolves: #147799

@inbelic inbelic force-pushed the inbelic/rs-simplify-diags branch from 7d8fa5d to 70448a3 Compare July 9, 2025 18:50
@inbelic inbelic marked this pull request as ready for review July 9, 2025 20:45
@inbelic inbelic linked an issue Jul 9, 2025 that may be closed by this pull request
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[HLSL][RootSignature] Simplify and Audit RootSignatureParser Diagnostics
1 participant