[all-commits] [llvm/llvm-project] d60da2: [HLSL][RootSignature] Implement diagnostic for mis...
Finn Plummer via All-commits
all-commits at lists.llvm.org
Thu Jul 10 10:52:41 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d60da27400cd96855542cd992d326c10a34dd0f7
https://github.com/llvm/llvm-project/commit/d60da27400cd96855542cd992d326c10a34dd0f7
Author: Finn Plummer <finn.c.plum at gmail.com>
Date: 2025-07-10 (Thu, 10 Jul 2025)
Changed paths:
M clang/lib/Parse/ParseHLSLRootSignature.cpp
M clang/test/SemaHLSL/RootSignature-err.hlsl
A clang/test/SemaHLSL/RootSignature.hlsl
M clang/unittests/Parse/ParseHLSLRootSignatureTest.cpp
Log Message:
-----------
[HLSL][RootSignature] Implement diagnostic for missed comma (#147350)
This pr fixes a bug that allows parameters to be specified without an
intermediate comma.
After this pr, we will correctly produce a diagnostic for (eg):
```
RootFlags(0) CBV(b0)
```
This pr updates the problematic code pattern containing a chain of 'if'
statements to a chain of 'else if' statements, to prevent parsing of an
element before checking for a comma.
This pr also does 2 small updates, while in the region:
1. Simplify the `do` loop that these `if` statements are contained in.
This helps code readability and makes it easier to improve the
diagnostics further
2. Moves the `consumeExpectedToken` function calls to be right after the
`parse.*Params` invocation. This will ensure that the comma or invalid
token error is presented before a "missed mandatory param" diagnostic.
- Updates all occurrences of the if chains with an else-if chain
- Simplifies the surrounding `do` loop to be an easier to understand
`while` loop
- Moves the `consumeExpectedToken` diagnostic right after the loop so
that the missing comma diagnostic is produce before checking for any
missed mandatory arguments
- Adds unit tests for this scenario
- Small fix to the diagnostic of `RootDescriptors` to use their
respective `Token` instead of `RootConstants`
Resolves: https://github.com/llvm/llvm-project/issues/147337
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list