Commit 8ebbb20
authored
[HLSL] Add an lvalue to rvalue cast when appropriate for HLSLElementwiseCast and HLSLAggregateSplatCast (#163828)
When the Sub expression of an HLSLAggregateSplatCast is an LValue insert
an LValue to RValue cast; done using DefaultLvalueConversion.
When the Sub expression of an HLSLElementwiseCast is an LValue and not a
record or an array insert an LValue to RValue cast.
Arrays were already handled correctly using an HLSLArrayRValue cast.
DefaultLvalueConversion is used to add the LValue to RValue cast when
appropriate and does not emit one when the expression is a record.
Update existing test which was broken by this change. Add two new tests
for HLSLElementwiseCast showing the lack of lvalue to rvalue cast for a
struct and showing the lvalue to rvalue cast for a vector.
Closes #1635931 parent a0b66b5 commit 8ebbb20
File tree
3 files changed
+31
-3
lines changed- clang
- lib/Sema
- test/SemaHLSL/Language
3 files changed
+31
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2927 | 2927 | | |
2928 | 2928 | | |
2929 | 2929 | | |
| 2930 | + | |
| 2931 | + | |
2930 | 2932 | | |
2931 | 2933 | | |
2932 | 2934 | | |
| |||
2935 | 2937 | | |
2936 | 2938 | | |
2937 | 2939 | | |
| 2940 | + | |
2938 | 2941 | | |
2939 | 2942 | | |
2940 | 2943 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
0 commit comments