@@ -29,39 +29,44 @@ bool RootSignatureParser::parse() {
2929 do {
3030 std::optional<RootSignatureElement> Element = std::nullopt ;
3131 if (tryConsumeExpectedToken (TokenKind::kw_RootFlags)) {
32+ SourceLocation ElementLoc = getTokenLocation (CurToken);
3233 auto Flags = parseRootFlags ();
3334 if (!Flags.has_value ())
3435 return true ;
35- Element = RootSignatureElement (*Flags);
36+ Element = RootSignatureElement (ElementLoc, *Flags);
3637 }
3738
3839 if (tryConsumeExpectedToken (TokenKind::kw_RootConstants)) {
40+ SourceLocation ElementLoc = getTokenLocation (CurToken);
3941 auto Constants = parseRootConstants ();
4042 if (!Constants.has_value ())
4143 return true ;
42- Element = RootSignatureElement (*Constants);
44+ Element = RootSignatureElement (ElementLoc, *Constants);
4345 }
4446
4547 if (tryConsumeExpectedToken (TokenKind::kw_DescriptorTable)) {
48+ SourceLocation ElementLoc = getTokenLocation (CurToken);
4649 auto Table = parseDescriptorTable ();
4750 if (!Table.has_value ())
4851 return true ;
49- Element = RootSignatureElement (*Table);
52+ Element = RootSignatureElement (ElementLoc, *Table);
5053 }
5154
5255 if (tryConsumeExpectedToken (
5356 {TokenKind::kw_CBV, TokenKind::kw_SRV, TokenKind::kw_UAV})) {
57+ SourceLocation ElementLoc = getTokenLocation (CurToken);
5458 auto Descriptor = parseRootDescriptor ();
5559 if (!Descriptor.has_value ())
5660 return true ;
57- Element = RootSignatureElement (*Descriptor);
61+ Element = RootSignatureElement (ElementLoc, *Descriptor);
5862 }
5963
6064 if (tryConsumeExpectedToken (TokenKind::kw_StaticSampler)) {
65+ SourceLocation ElementLoc = getTokenLocation (CurToken);
6166 auto Sampler = parseStaticSampler ();
6267 if (!Sampler.has_value ())
6368 return true ;
64- Element = RootSignatureElement (*Sampler);
69+ Element = RootSignatureElement (ElementLoc, *Sampler);
6570 }
6671
6772 if (Element.has_value ())
@@ -258,10 +263,11 @@ std::optional<DescriptorTable> RootSignatureParser::parseDescriptorTable() {
258263 do {
259264 if (tryConsumeExpectedToken ({TokenKind::kw_CBV, TokenKind::kw_SRV,
260265 TokenKind::kw_UAV, TokenKind::kw_Sampler})) {
266+ SourceLocation ElementLoc = getTokenLocation (CurToken);
261267 auto Clause = parseDescriptorTableClause ();
262268 if (!Clause.has_value ())
263269 return std::nullopt ;
264- Elements.push_back (RootSignatureElement (*Clause));
270+ Elements.push_back (RootSignatureElement (ElementLoc, *Clause));
265271 Table.NumClauses ++;
266272 }
267273
0 commit comments