cxx1z-init-statement.cpp
2.02 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// RUN: %clang_cc1 -std=c++1z -triple x86_64-apple-macosx10.7.0 -emit-llvm -o - %s -w | FileCheck %s
typedef int T;
void f() {
// CHECK: %[[A:.*]] = alloca i32, align 4
// CHECK-NEXT: store i32 5, i32* %[[A]], align 4
// CHECK-NEXT: %[[B:.*]] = load i32, i32* %[[A]], align 4
// CHECK-NEXT: %[[C:.*]] = icmp slt i32 %[[B]], 8
if (int a = 5; a < 8)
;
}
void f1() {
// CHECK: %[[A:.*]] = alloca i32, align 4
// CHECK-NEXT: %[[B:.*]] = alloca i32, align 4
// CHECK-NEXT: %[[C:.*]] = alloca i32, align 4
// CHECK-NEXT: store i32 5, i32* %[[B]], align 4
// CHECK-NEXT: store i32 7, i32* %[[C]], align 4
if (int a, b = 5; int c = 7)
;
}
int f2() {
// CHECK: %[[A:.*]] = alloca i32, align 4
// CHECK-NEXT: %[[B:.*]] = call i32 @_Z2f2v()
// CHECK-NEXT: store i32 7, i32* %[[A]], align 4
// CHECK-NEXT: %[[C:.*]] = load i32, i32* %[[A]], align 4
// CHECK-NEXT: %[[D:.*]] = icmp ne i32 %[[C]], 0
if (T{f2()}; int c = 7)
;
return 2;
}
void g() {
// CHECK: %[[A:.*]] = alloca i32, align 4
// CHECK-NEXT: store i32 5, i32* %[[A]], align 4
// CHECK-NEXT: %[[B:.*]] = load i32, i32* %[[A]], align 4
// CHECK-NEXT: switch i32 %[[B]], label %[[C:.*]] [
switch (int a = 5; a) {
case 0:
break;
}
}
void g1() {
// CHECK: %[[A:.*]] = alloca i32, align 4
// CHECK-NEXT: %[[B:.*]] = alloca i32, align 4
// CHECK-NEXT: %[[C:.*]] = alloca i32, align 4
// CHECK-NEXT: store i32 5, i32* %[[B]], align 4
// CHECK-NEXT: store i32 7, i32* %[[C]], align 4
// CHECK-NEXT: %[[D:.*]] = load i32, i32* %[[C]], align 4
// CHECK-NEXT: switch i32 %[[D]], label %[[E:.*]] [
switch (int a, b = 5; int c = 7) {
case 0:
break;
}
}
int g2() {
// CHECK: %[[A:.*]] = alloca i32, align 4
// CHECK-NEXT: %[[B:.*]] = call i32 @_Z2f2v()
// CHECK-NEXT: store i32 7, i32* %[[A]], align 4
// CHECK-NEXT: %[[C:.*]] = load i32, i32* %[[A]], align 4
// CHECK-NEXT: switch i32 %[[C]], label %[[E:.*]] [
switch (T{f2()}; int c = 7) {
case 0:
break;
}
return 2;
}