Commit 019b1f9
committed
Handle side-effecting argument expressions
This slightly tweaks the AST formulation to wrap any potentially
side-effecting initialization list expression in an OpaqueValueExpr so
that during codegen we can ensure it only gets emitted once.
I've made a slightly hacky but minimal change in CodeGen to then emit
OpaqueValueExprs in InitLists during aggregate initialization emission.
I weighed the tradeoff between an AST-level representation or this
CodeGen change. If HLSL were going to retain this initialization list
behavior long term, I'd probably add a new AST node to represent HLSL
initialization lists and restructure how we generate the AST, but I
think that would be a lot more code to maintain, and since the goal is
to remove this quirk from the language I don't think it is the best
solution.
The change as written isolates most of the weirdness of HLSL in
CGHLSLRuntime and is a massively smaller change than a new AST node for
initialization lists. This will also ensure that Clang's AST-based
analysis for initialization lists will continue to be accurate for HLSL
without any additional updates required.1 parent e923490 commit 019b1f9
File tree
6 files changed
+59
-1
lines changed- clang/lib
- CodeGen
- Sema
6 files changed
+59
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5551 | 5551 | | |
5552 | 5552 | | |
5553 | 5553 | | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
| 5557 | + | |
| 5558 | + | |
| 5559 | + | |
5554 | 5560 | | |
5555 | 5561 | | |
5556 | 5562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
1776 | 1777 | | |
1777 | 1778 | | |
1778 | 1779 | | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
1779 | 1790 | | |
1780 | 1791 | | |
1781 | 1792 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| 166 | + | |
| 167 | + | |
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3011 | 3011 | | |
3012 | 3012 | | |
3013 | 3013 | | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
3014 | 3018 | | |
3015 | 3019 | | |
3016 | 3020 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3225 | 3225 | | |
3226 | 3226 | | |
3227 | 3227 | | |
3228 | | - | |
| 3228 | + | |
| 3229 | + | |
3229 | 3230 | | |
3230 | 3231 | | |
3231 | 3232 | | |
| |||
0 commit comments