C++: Use unnamed_local_variable in array structured binding test

This commit is contained in:
Jeroen Ketema
2022-02-24 10:42:18 +01:00
parent 437a85dec7
commit ec05942693
4 changed files with 49 additions and 33 deletions

View File

@@ -11503,9 +11503,9 @@ ir.cpp:
# 1474| getExpr(): [ArrayExpr] access to array
# 1474| Type = [IntType] int
# 1474| ValueCategory = lvalue
# 1474| getArrayBase(): [VariableAccess] xs
# 1474| Type = [ArrayType] int[2]
# 1474| ValueCategory = lvalue
# 1474| getArrayBase(): [VariableAccess] unnamed_local_variable
# 1474| Type = [LValueReferenceType] int(&)[2]
# 1474| ValueCategory = prvalue(load)
# 1474| getArrayOffset(): [Literal] 0
# 1474| Type = [IntType] int
# 1474| Value = [Literal] 0
@@ -11513,6 +11513,9 @@ ir.cpp:
# 1474| getArrayBase().getFullyConverted(): [ArrayToPointerConversion] array to pointer conversion
# 1474| Type = [IntPointerType] int *
# 1474| ValueCategory = prvalue
# 1474| getExpr(): [ReferenceDereferenceExpr] (reference dereference)
# 1474| Type = [ArrayType] int[2]
# 1474| ValueCategory = lvalue
# 1474| getExpr().getFullyConverted(): [ReferenceToExpr] (reference to)
# 1474| Type = [LValueReferenceType] int &
# 1474| ValueCategory = prvalue
@@ -11523,9 +11526,9 @@ ir.cpp:
# 1475| getExpr(): [ArrayExpr] access to array
# 1475| Type = [IntType] int
# 1475| ValueCategory = lvalue
# 1475| getArrayBase(): [VariableAccess] xs
# 1475| Type = [ArrayType] int[2]
# 1475| ValueCategory = lvalue
# 1475| getArrayBase(): [VariableAccess] unnamed_local_variable
# 1475| Type = [LValueReferenceType] int(&)[2]
# 1475| ValueCategory = prvalue(load)
# 1475| getArrayOffset(): [Literal] 1
# 1475| Type = [IntType] int
# 1475| Value = [Literal] 1
@@ -11533,6 +11536,9 @@ ir.cpp:
# 1475| getArrayBase().getFullyConverted(): [ArrayToPointerConversion] array to pointer conversion
# 1475| Type = [IntPointerType] int *
# 1475| ValueCategory = prvalue
# 1475| getExpr(): [ReferenceDereferenceExpr] (reference dereference)
# 1475| Type = [ArrayType] int[2]
# 1475| ValueCategory = lvalue
# 1475| getExpr().getFullyConverted(): [ReferenceToExpr] (reference to)
# 1475| Type = [LValueReferenceType] int &
# 1475| ValueCategory = prvalue

View File

@@ -1471,8 +1471,8 @@ void array_structured_binding() {
// explicit reference version
{
auto& unnamed_local_variable = xs;
auto& x0 = xs[0];
auto& x1 = xs[1];
auto& x0 = unnamed_local_variable[0];
auto& x1 = unnamed_local_variable[1];
x1 = 3;
int &rx1 = x1;
int x = x1;

View File

@@ -6706,34 +6706,40 @@
| ir.cpp:1473:40:1473:41 | StoreValue | r1473_3 |
| ir.cpp:1473:40:1473:41 | Unary | r1473_2 |
| ir.cpp:1474:15:1474:16 | Address | &:r1474_1 |
| ir.cpp:1474:20:1474:21 | Left | r1474_3 |
| ir.cpp:1474:20:1474:21 | Unary | r1474_2 |
| ir.cpp:1474:20:1474:24 | StoreValue | r1474_6 |
| ir.cpp:1474:20:1474:24 | Unary | r1474_5 |
| ir.cpp:1474:23:1474:23 | Right | r1474_4 |
| ir.cpp:1474:20:1474:41 | Address | &:r1474_2 |
| ir.cpp:1474:20:1474:41 | Left | r1474_5 |
| ir.cpp:1474:20:1474:41 | Load | m1473_4 |
| ir.cpp:1474:20:1474:41 | Unary | r1474_3 |
| ir.cpp:1474:20:1474:41 | Unary | r1474_4 |
| ir.cpp:1474:20:1474:44 | StoreValue | r1474_8 |
| ir.cpp:1474:20:1474:44 | Unary | r1474_7 |
| ir.cpp:1474:43:1474:43 | Right | r1474_6 |
| ir.cpp:1475:15:1475:16 | Address | &:r1475_1 |
| ir.cpp:1475:20:1475:21 | Left | r1475_3 |
| ir.cpp:1475:20:1475:21 | Unary | r1475_2 |
| ir.cpp:1475:20:1475:24 | StoreValue | r1475_6 |
| ir.cpp:1475:20:1475:24 | Unary | r1475_5 |
| ir.cpp:1475:23:1475:23 | Right | r1475_4 |
| ir.cpp:1475:20:1475:41 | Address | &:r1475_2 |
| ir.cpp:1475:20:1475:41 | Left | r1475_5 |
| ir.cpp:1475:20:1475:41 | Load | m1473_4 |
| ir.cpp:1475:20:1475:41 | Unary | r1475_3 |
| ir.cpp:1475:20:1475:41 | Unary | r1475_4 |
| ir.cpp:1475:20:1475:44 | StoreValue | r1475_8 |
| ir.cpp:1475:20:1475:44 | Unary | r1475_7 |
| ir.cpp:1475:43:1475:43 | Right | r1475_6 |
| ir.cpp:1476:9:1476:10 | Address | &:r1476_2 |
| ir.cpp:1476:9:1476:10 | Address | &:r1476_4 |
| ir.cpp:1476:9:1476:10 | Load | m1475_7 |
| ir.cpp:1476:9:1476:10 | Load | m1475_9 |
| ir.cpp:1476:9:1476:10 | Unary | r1476_3 |
| ir.cpp:1476:9:1476:14 | ChiPartial | partial:m1476_5 |
| ir.cpp:1476:9:1476:14 | ChiTotal | total:m1463_12 |
| ir.cpp:1476:14:1476:14 | StoreValue | r1476_1 |
| ir.cpp:1477:14:1477:16 | Address | &:r1477_1 |
| ir.cpp:1477:20:1477:21 | Address | &:r1477_2 |
| ir.cpp:1477:20:1477:21 | Load | m1475_7 |
| ir.cpp:1477:20:1477:21 | Load | m1475_9 |
| ir.cpp:1477:20:1477:21 | StoreValue | r1477_5 |
| ir.cpp:1477:20:1477:21 | Unary | r1477_3 |
| ir.cpp:1477:20:1477:21 | Unary | r1477_4 |
| ir.cpp:1478:13:1478:13 | Address | &:r1478_1 |
| ir.cpp:1478:17:1478:18 | Address | &:r1478_2 |
| ir.cpp:1478:17:1478:18 | Address | &:r1478_3 |
| ir.cpp:1478:17:1478:18 | Load | m1475_7 |
| ir.cpp:1478:17:1478:18 | Load | m1475_9 |
| ir.cpp:1478:17:1478:18 | Load | m1476_5 |
| ir.cpp:1478:17:1478:18 | StoreValue | r1478_4 |
| ir.cpp:1482:8:1482:8 | Address | &:r1482_5 |

View File

@@ -7947,19 +7947,23 @@ ir.cpp:
# 1473| r1473_3(int(&)[2]) = CopyValue : r1473_2
# 1473| mu1473_4(int(&)[2]) = Store[unnamed_local_variable] : &:r1473_1, r1473_3
# 1474| r1474_1(glval<int &>) = VariableAddress[x0] :
# 1474| r1474_2(glval<int[2]>) = VariableAddress[xs] :
# 1474| r1474_3(int *) = Convert : r1474_2
# 1474| r1474_4(int) = Constant[0] :
# 1474| r1474_5(glval<int>) = PointerAdd[4] : r1474_3, r1474_4
# 1474| r1474_6(int &) = CopyValue : r1474_5
# 1474| mu1474_7(int &) = Store[x0] : &:r1474_1, r1474_6
# 1474| r1474_2(glval<int(&)[2]>) = VariableAddress[unnamed_local_variable] :
# 1474| r1474_3(int(&)[2]) = Load[unnamed_local_variable] : &:r1474_2, ~m?
# 1474| r1474_4(glval<int[2]>) = CopyValue : r1474_3
# 1474| r1474_5(int *) = Convert : r1474_4
# 1474| r1474_6(int) = Constant[0] :
# 1474| r1474_7(glval<int>) = PointerAdd[4] : r1474_5, r1474_6
# 1474| r1474_8(int &) = CopyValue : r1474_7
# 1474| mu1474_9(int &) = Store[x0] : &:r1474_1, r1474_8
# 1475| r1475_1(glval<int &>) = VariableAddress[x1] :
# 1475| r1475_2(glval<int[2]>) = VariableAddress[xs] :
# 1475| r1475_3(int *) = Convert : r1475_2
# 1475| r1475_4(int) = Constant[1] :
# 1475| r1475_5(glval<int>) = PointerAdd[4] : r1475_3, r1475_4
# 1475| r1475_6(int &) = CopyValue : r1475_5
# 1475| mu1475_7(int &) = Store[x1] : &:r1475_1, r1475_6
# 1475| r1475_2(glval<int(&)[2]>) = VariableAddress[unnamed_local_variable] :
# 1475| r1475_3(int(&)[2]) = Load[unnamed_local_variable] : &:r1475_2, ~m?
# 1475| r1475_4(glval<int[2]>) = CopyValue : r1475_3
# 1475| r1475_5(int *) = Convert : r1475_4
# 1475| r1475_6(int) = Constant[1] :
# 1475| r1475_7(glval<int>) = PointerAdd[4] : r1475_5, r1475_6
# 1475| r1475_8(int &) = CopyValue : r1475_7
# 1475| mu1475_9(int &) = Store[x1] : &:r1475_1, r1475_8
# 1476| r1476_1(int) = Constant[3] :
# 1476| r1476_2(glval<int &>) = VariableAddress[x1] :
# 1476| r1476_3(int &) = Load[x1] : &:r1476_2, ~m?