@@ -29,39 +29,44 @@ bool RootSignatureParser::parse() {
29
29
do {
30
30
std::optional<RootSignatureElement> Element = std::nullopt;
31
31
if (tryConsumeExpectedToken (TokenKind::kw_RootFlags)) {
32
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
32
33
auto Flags = parseRootFlags ();
33
34
if (!Flags.has_value ())
34
35
return true ;
35
- Element = RootSignatureElement (*Flags);
36
+ Element = RootSignatureElement (ElementLoc, *Flags);
36
37
}
37
38
38
39
if (tryConsumeExpectedToken (TokenKind::kw_RootConstants)) {
40
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
39
41
auto Constants = parseRootConstants ();
40
42
if (!Constants.has_value ())
41
43
return true ;
42
- Element = RootSignatureElement (*Constants);
44
+ Element = RootSignatureElement (ElementLoc, *Constants);
43
45
}
44
46
45
47
if (tryConsumeExpectedToken (TokenKind::kw_DescriptorTable)) {
48
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
46
49
auto Table = parseDescriptorTable ();
47
50
if (!Table.has_value ())
48
51
return true ;
49
- Element = RootSignatureElement (*Table);
52
+ Element = RootSignatureElement (ElementLoc, *Table);
50
53
}
51
54
52
55
if (tryConsumeExpectedToken (
53
56
{TokenKind::kw_CBV, TokenKind::kw_SRV, TokenKind::kw_UAV})) {
57
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
54
58
auto Descriptor = parseRootDescriptor ();
55
59
if (!Descriptor.has_value ())
56
60
return true ;
57
- Element = RootSignatureElement (*Descriptor);
61
+ Element = RootSignatureElement (ElementLoc, *Descriptor);
58
62
}
59
63
60
64
if (tryConsumeExpectedToken (TokenKind::kw_StaticSampler)) {
65
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
61
66
auto Sampler = parseStaticSampler ();
62
67
if (!Sampler.has_value ())
63
68
return true ;
64
- Element = RootSignatureElement (*Sampler);
69
+ Element = RootSignatureElement (ElementLoc, *Sampler);
65
70
}
66
71
67
72
if (Element.has_value ())
@@ -258,10 +263,11 @@ std::optional<DescriptorTable> RootSignatureParser::parseDescriptorTable() {
258
263
do {
259
264
if (tryConsumeExpectedToken ({TokenKind::kw_CBV, TokenKind::kw_SRV,
260
265
TokenKind::kw_UAV, TokenKind::kw_Sampler})) {
266
+ SourceLocation ElementLoc = getTokenLocation (CurToken);
261
267
auto Clause = parseDescriptorTableClause ();
262
268
if (!Clause.has_value ())
263
269
return std::nullopt;
264
- Elements.push_back (RootSignatureElement (*Clause));
270
+ Elements.push_back (RootSignatureElement (ElementLoc, *Clause));
265
271
Table.NumClauses ++;
266
272
}
267
273
0 commit comments