File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ std::optional<llvm::dxbc::RootFlags> RootSignatureParser::parseRootFlags() {
93
93
94
94
std::optional<llvm::dxbc::RootFlags> Flags = llvm::dxbc::RootFlags::None;
95
95
96
+ // Handle valid empty case
97
+ if (tryConsumeExpectedToken (TokenKind::pu_r_paren))
98
+ return Flags;
99
+
96
100
// Handle the edge-case of '0' to specify no flags set
97
101
if (tryConsumeExpectedToken (TokenKind::int_literal)) {
98
102
if (!verifyZeroFlag ()) {
@@ -118,6 +122,11 @@ std::optional<llvm::dxbc::RootFlags> RootSignatureParser::parseRootFlags() {
118
122
default :
119
123
llvm_unreachable (" Switch for consumed enum token was not provided" );
120
124
}
125
+ } else {
126
+ consumeNextToken (); // consume token to point at invalid token
127
+ reportDiag (diag::err_hlsl_invalid_token)
128
+ << /* value=*/ 1 << /* value of*/ TokenKind::kw_RootFlags;
129
+ return std::nullopt;
121
130
}
122
131
} while (tryConsumeExpectedToken (TokenKind::pu_or));
123
132
}
Original file line number Diff line number Diff line change @@ -99,3 +99,7 @@ void bad_root_signature_21() {}
99
99
// expected-error@+1 {{invalid value of flags}}
100
100
[RootSignature ("DescriptorTable(SRV(t0, flags = descriptor_range_flag_typo)" )]
101
101
void bad_root_signature_22 () {}
102
+
103
+ // expected-error@+1 {{invalid value of RootFlags}}
104
+ [RootSignature ("RootFlags(local_root_signature | root_flag_typo)" )]
105
+ void bad_root_signature_23 () {}
You can’t perform that action at this time.
0 commit comments