-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Copy link
Labels
HLSLHLSL Language SupportHLSL Language Supportclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
This issue tracks fixing a bug that allows parameters to be specified without an intermediate comma.
For instance:
RootFlags(0) CBV(b0)
Should be invalid because there is no comma between the two parameters.
This is because of the code pattern as follows:
llvm-project/clang/lib/Parse/ParseHLSLRootSignature.cpp
Lines 30 to 42 in 3c76a05
if (tryConsumeExpectedToken(TokenKind::kw_RootFlags)) { | |
auto Flags = parseRootFlags(); | |
if (!Flags.has_value()) | |
return true; | |
Elements.push_back(*Flags); | |
} | |
if (tryConsumeExpectedToken(TokenKind::kw_RootConstants)) { | |
auto Constants = parseRootConstants(); | |
if (!Constants.has_value()) | |
return true; | |
Elements.push_back(*Constants); | |
} |
It should be an else-if chain so that if we successfully parse the first element type, it will not attempt to parse any other element types right after.
Reproduction here: https://godbolt.org/z/arcExM9rE
AC:
- All occurrences of the if chains should be replaced with an else-if chain
- Add unit tests for this scenario
Metadata
Metadata
Assignees
Labels
HLSLHLSL Language SupportHLSL Language Supportclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Type
Projects
Status
Closed