Commit 0089ca9
committed
[BoundsSafety] Allow evaluating the same CLE in a bounds-check
BoundsSafety can reuse the same CompoundLiteralExpr in a bounds-check
condition. This commit changes const-eval for CompoundLiteralExpr to
reset the state and evaluate it again when the temporary for that
CompoundLiteralExpr already exists.
In addition, we skip const-eval in Sema when building a bounds-check
condition. That const-eval is used only for diagnostics and we don't
want to diagnose AST that we are generating.
This is merely a workaround. The proper solution is to not emit the AST
for bounds-check condition and defer it to CodeGen.
rdar://157033241
(cherry picked from commit 80d3756)1 parent 57b2922 commit 0089ca9
File tree
5 files changed
+80
-15
lines changed- clang
- include/clang/Sema
- lib
- AST
- Sema
- test/BoundsSafety/CodeGen
5 files changed
+80
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7901 | 7901 | | |
7902 | 7902 | | |
7903 | 7903 | | |
7904 | | - | |
| 7904 | + | |
| 7905 | + | |
7905 | 7906 | | |
7906 | 7907 | | |
7907 | 7908 | | |
| |||
8612 | 8613 | | |
8613 | 8614 | | |
8614 | 8615 | | |
8615 | | - | |
| 8616 | + | |
8616 | 8617 | | |
8617 | 8618 | | |
8618 | 8619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9358 | 9358 | | |
9359 | 9359 | | |
9360 | 9360 | | |
| 9361 | + | |
| 9362 | + | |
| 9363 | + | |
| 9364 | + | |
| 9365 | + | |
| 9366 | + | |
| 9367 | + | |
| 9368 | + | |
| 9369 | + | |
| 9370 | + | |
| 9371 | + | |
| 9372 | + | |
| 9373 | + | |
| 9374 | + | |
9361 | 9375 | | |
9362 | 9376 | | |
9363 | 9377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14129 | 14129 | | |
14130 | 14130 | | |
14131 | 14131 | | |
| 14132 | + | |
| 14133 | + | |
| 14134 | + | |
| 14135 | + | |
| 14136 | + | |
| 14137 | + | |
| 14138 | + | |
| 14139 | + | |
14132 | 14140 | | |
14133 | 14141 | | |
14134 | 14142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16371 | 16371 | | |
16372 | 16372 | | |
16373 | 16373 | | |
16374 | | - | |
| 16374 | + | |
| 16375 | + | |
16375 | 16376 | | |
16376 | 16377 | | |
16377 | 16378 | | |
| |||
16402 | 16403 | | |
16403 | 16404 | | |
16404 | 16405 | | |
16405 | | - | |
| 16406 | + | |
| 16407 | + | |
16406 | 16408 | | |
16407 | 16409 | | |
16408 | 16410 | | |
| |||
18107 | 18109 | | |
18108 | 18110 | | |
18109 | 18111 | | |
18110 | | - | |
| 18112 | + | |
| 18113 | + | |
18111 | 18114 | | |
18112 | 18115 | | |
18113 | 18116 | | |
| |||
18264 | 18267 | | |
18265 | 18268 | | |
18266 | 18269 | | |
18267 | | - | |
| 18270 | + | |
| 18271 | + | |
18268 | 18272 | | |
18269 | 18273 | | |
18270 | 18274 | | |
| |||
26025 | 26029 | | |
26026 | 26030 | | |
26027 | 26031 | | |
26028 | | - | |
| 26032 | + | |
| 26033 | + | |
| 26034 | + | |
26029 | 26035 | | |
26030 | 26036 | | |
26031 | 26037 | | |
| |||
26044 | 26050 | | |
26045 | 26051 | | |
26046 | 26052 | | |
26047 | | - | |
| 26053 | + | |
| 26054 | + | |
| 26055 | + | |
26048 | 26056 | | |
26049 | 26057 | | |
26050 | 26058 | | |
| |||
26067 | 26075 | | |
26068 | 26076 | | |
26069 | 26077 | | |
26070 | | - | |
| 26078 | + | |
| 26079 | + | |
26071 | 26080 | | |
26072 | 26081 | | |
26073 | 26082 | | |
| |||
26252 | 26261 | | |
26253 | 26262 | | |
26254 | 26263 | | |
26255 | | - | |
| 26264 | + | |
| 26265 | + | |
| 26266 | + | |
26256 | 26267 | | |
26257 | 26268 | | |
26258 | 26269 | | |
| |||
26267 | 26278 | | |
26268 | 26279 | | |
26269 | 26280 | | |
26270 | | - | |
26271 | | - | |
| 26281 | + | |
| 26282 | + | |
| 26283 | + | |
| 26284 | + | |
26272 | 26285 | | |
26273 | 26286 | | |
26274 | 26287 | | |
| |||
26308 | 26321 | | |
26309 | 26322 | | |
26310 | 26323 | | |
26311 | | - | |
| 26324 | + | |
| 26325 | + | |
| 26326 | + | |
26312 | 26327 | | |
26313 | 26328 | | |
26314 | 26329 | | |
26315 | 26330 | | |
26316 | 26331 | | |
26317 | 26332 | | |
26318 | | - | |
26319 | | - | |
| 26333 | + | |
| 26334 | + | |
| 26335 | + | |
26320 | 26336 | | |
26321 | 26337 | | |
26322 | 26338 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments