Commit b95e6c5
[CIR][Codegen][Bugfix] use record layout to generate index for a field (#270)
This is a minor fix similar to the one introduced in #263.
Basically, all calls to the `buildLValueForFieldInitialization` are even
with the origin codegen `emitLValueForFieldInitialization` calls, i.e.
the field index is calculated from the record layout, but not from the
decl `field->getFieldIndex()`.
Added just one test, because looks like we need to implement some `NYI`
features first to test another places e.g. in `CIRGenExprAgg.cpp`,
though I could miss something.
Anyway, given the original codegen doesn't use `getFieldIndex` in these
places, we also should not.
All the remaining usages of `getFieldIndex` are ok.1 parent 6015b22 commit b95e6c5
File tree
5 files changed
+21
-10
lines changed- clang
- lib/CIR/CodeGen
- test/CIR/CodeGen
5 files changed
+21
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
| 210 | + | |
212 | 211 | | |
213 | 212 | | |
214 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
392 | | - | |
| 391 | + | |
393 | 392 | | |
394 | 393 | | |
395 | 394 | | |
396 | 395 | | |
397 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
551 | 550 | | |
552 | 551 | | |
553 | 552 | | |
554 | | - | |
| 553 | + | |
555 | 554 | | |
556 | 555 | | |
557 | 556 | | |
| |||
816 | 815 | | |
817 | 816 | | |
818 | 817 | | |
819 | | - | |
820 | 818 | | |
821 | | - | |
| 819 | + | |
822 | 820 | | |
823 | 821 | | |
824 | 822 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1531 | 1531 | | |
1532 | 1532 | | |
1533 | 1533 | | |
1534 | | - | |
1535 | | - | |
| 1534 | + | |
1536 | 1535 | | |
1537 | 1536 | | |
1538 | 1537 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
0 commit comments