Commit 7ecb37b
authored
At the moment, when we report diagnostics from `SemaHLSL` we only
provide the source location of the root signature attr. This allows for
significantly less helpful diagnostics (for eg. reporting resource range
overlaps).
This pr implements a way to retain the source location of a root element
when it is parsed, so that we can output the `SourceLocation` of each
root element that causes the overlap in the diagnostics during semantic
analysis.
This pr defines a wrapper struct `clang::hlsl::RootSignatureElement` in
`SemaHLSL` that will contain the underlying `RootElement` and can hold
any additional diagnostic information. This struct will be what is used
in `HLSLRootSignatureParser` and in `SemaHLSL`. Then the diagnostic
information will be stripped and the underlying element will be stored
in the `RootSignatureDecl`.
For the reporting of diagnostics, we can now use the retained
`SourceLocation` of each `RootElement` when reporting the range overlap,
and we can add a `note` diagnostic to highlight the other root element
as well.
- Defines `RootSignatureElement` in the `hlsl` namespace in `SemaHLSL`
(defined in `SemaHLSL` because `Parse` has a dependency on `Sema`)
- Updates parsing logic to construct `RootSignatureElement`s and retain
the source loction in `ParseHLSLRootSignature`
- Updates `SemaHLSL` when it constructs the `RootSignatureDecl` to take
the new `RootSignatureElement` and store the underlying `RootElement`
- Updates the current tests to ensure the new `note` diagnostic is
produced and that the `SourceLocation` is seen
- Slight update to the `RootSignatureValidations` api to ensure the
caller sorts and owns the memory of the passed in `RangeInfo`
- Adds a test to demonstrate the `SourceLocation` of both elements being
correctly pointed out
Resolves: #145819
1 parent a742ee6 commit 7ecb37b
File tree
10 files changed
+311
-143
lines changed- clang
- include/clang
- Basic
- Parse
- Sema
- lib
- Parse
- Sema
- test/SemaHLSL
- unittests/Parse
- llvm
- include/llvm/Frontend/HLSL
- lib/Frontend/HLSL
10 files changed
+311
-143
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13098 | 13098 | | |
13099 | 13099 | | |
13100 | 13100 | | |
| 13101 | + | |
13101 | 13102 | | |
13102 | 13103 | | |
13103 | 13104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
204 | | - | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
35 | 54 | | |
36 | 55 | | |
37 | 56 | | |
| |||
130 | 149 | | |
131 | 150 | | |
132 | 151 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
139 | 160 | | |
140 | 161 | | |
141 | 162 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4948 | 4948 | | |
4949 | 4949 | | |
4950 | 4950 | | |
4951 | | - | |
| 4951 | + | |
4952 | 4952 | | |
4953 | 4953 | | |
4954 | 4954 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
41 | 43 | | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
45 | | - | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
51 | | - | |
| 55 | + | |
52 | 56 | | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | | - | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
245 | 250 | | |
246 | 251 | | |
247 | 252 | | |
| 253 | + | |
248 | 254 | | |
249 | 255 | | |
250 | 256 | | |
251 | | - | |
| 257 | + | |
252 | 258 | | |
253 | 259 | | |
254 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1064 | 1064 | | |
1065 | 1065 | | |
1066 | 1066 | | |
1067 | | - | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1068 | 1075 | | |
1069 | 1076 | | |
1070 | 1077 | | |
1071 | 1078 | | |
1072 | 1079 | | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | 1080 | | |
1077 | 1081 | | |
1078 | 1082 | | |
1079 | 1083 | | |
1080 | | - | |
1081 | | - | |
| 1084 | + | |
| 1085 | + | |
1082 | 1086 | | |
1083 | 1087 | | |
| 1088 | + | |
1084 | 1089 | | |
1085 | 1090 | | |
1086 | | - | |
1087 | | - | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1088 | 1094 | | |
1089 | 1095 | | |
1090 | 1096 | | |
| |||
1095 | 1101 | | |
1096 | 1102 | | |
1097 | 1103 | | |
1098 | | - | |
| 1104 | + | |
| 1105 | + | |
1099 | 1106 | | |
1100 | 1107 | | |
1101 | 1108 | | |
| |||
1105 | 1112 | | |
1106 | 1113 | | |
1107 | 1114 | | |
1108 | | - | |
| 1115 | + | |
| 1116 | + | |
1109 | 1117 | | |
1110 | 1118 | | |
1111 | 1119 | | |
| |||
1115 | 1123 | | |
1116 | 1124 | | |
1117 | 1125 | | |
1118 | | - | |
| 1126 | + | |
| 1127 | + | |
1119 | 1128 | | |
1120 | 1129 | | |
1121 | 1130 | | |
| |||
1129 | 1138 | | |
1130 | 1139 | | |
1131 | 1140 | | |
| 1141 | + | |
1132 | 1142 | | |
1133 | | - | |
| 1143 | + | |
1134 | 1144 | | |
1135 | 1145 | | |
1136 | 1146 | | |
1137 | 1147 | | |
1138 | | - | |
| 1148 | + | |
1139 | 1149 | | |
1140 | 1150 | | |
1141 | 1151 | | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1145 | 1155 | | |
1146 | 1156 | | |
1147 | 1157 | | |
1148 | | - | |
1149 | | - | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
1150 | 1198 | | |
| 1199 | + | |
1151 | 1200 | | |
| 1201 | + | |
1152 | 1202 | | |
1153 | 1203 | | |
1154 | 1204 | | |
1155 | | - | |
| 1205 | + | |
1156 | 1206 | | |
1157 | 1207 | | |
1158 | 1208 | | |
1159 | 1209 | | |
1160 | 1210 | | |
1161 | 1211 | | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1162 | 1215 | | |
1163 | 1216 | | |
| 1217 | + | |
1164 | 1218 | | |
1165 | 1219 | | |
1166 | 1220 | | |
| |||
0 commit comments