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() {
9393
9494 std::optional<llvm::dxbc::RootFlags> Flags = llvm::dxbc::RootFlags::None;
9595
96+ // Handle valid empty case
97+ if (tryConsumeExpectedToken (TokenKind::pu_r_paren))
98+ return Flags;
99+
96100 // Handle the edge-case of '0' to specify no flags set
97101 if (tryConsumeExpectedToken (TokenKind::int_literal)) {
98102 if (!verifyZeroFlag ()) {
@@ -118,6 +122,11 @@ std::optional<llvm::dxbc::RootFlags> RootSignatureParser::parseRootFlags() {
118122 default :
119123 llvm_unreachable (" Switch for consumed enum token was not provided" );
120124 }
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 ;
121130 }
122131 } while (tryConsumeExpectedToken (TokenKind::pu_or));
123132 }
Original file line number Diff line number Diff line change @@ -99,3 +99,7 @@ void bad_root_signature_21() {}
9999// expected-error@+1 {{invalid value of flags}}
100100[RootSignature ("DescriptorTable(SRV(t0, flags = descriptor_range_flag_typo)" )]
101101void 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