1 // RUN: %clang_cc1 -std=c++1z -triple x86_64-apple-macosx10.7.0 -emit-llvm -o - %s -w | FileCheck %s 2 3 typedef int T; 4 void f() { 5 // CHECK: %[[A:.*]] = alloca i32, align 4 6 // CHECK-NEXT: store i32 5, i32* %[[A]], align 4 7 // CHECK-NEXT: %[[B:.*]] = load i32, i32* %[[A]], align 4 8 // CHECK-NEXT %[[C:.*]] = icmp slt i32 %[[B]], 8 9 if (int a = 5; a < 8) 10 ; 11 } 12 13 void f1() { 14 // CHECK: %[[A:.*]] = alloca i32, align 4 15 // CHECK-NEXT: %[[B:.*]] = alloca i32, align 4 16 // CHECK-NEXT: %[[C:.*]] = alloca i32, align 4 17 // CHECK-NEXT: store i32 5, i32* %[[B]], align 4 18 // CHECK-NEXT: store i32 7, i32* %[[C]], align 4 19 if (int a, b = 5; int c = 7) 20 ; 21 } 22 23 int f2() { 24 // CHECK: %[[A:.*]] = alloca i32, align 4 25 // CHECK-NEXT: %[[B:.*]] = call i32 @_Z2f2v() 26 // CHECK-NEXT: store i32 7, i32* %[[A]], align 4 27 // CHECK-NEXT: %[[C:.*]] = load i32, i32* %[[A]], align 4 28 // CHECK-NEXT: %[[D:.*]] = icmp ne i32 %[[C]], 0 29 if (T{f2()}; int c = 7) 30 ; 31 return 2; 32 } 33 34 void g() { 35 // CHECK: %[[A:.*]] = alloca i32, align 4 36 // CHECK-NEXT: store i32 5, i32* %[[A]], align 4 37 // CHECK-NEXT: %[[B:.*]] = load i32, i32* %[[A]], align 4 38 // CHECK-NEXT: switch i32 %[[B]], label %[[C:.*]] [ 39 switch (int a = 5; a) { 40 case 0: 41 break; 42 } 43 } 44 45 void g1() { 46 // CHECK: %[[A:.*]] = alloca i32, align 4 47 // CHECK-NEXT: %[[B:.*]] = alloca i32, align 4 48 // CHECK-NEXT: %[[C:.*]] = alloca i32, align 4 49 // CHECK-NEXT: store i32 5, i32* %[[B]], align 4 50 // CHECK-NEXT: store i32 7, i32* %[[C]], align 4 51 // CHECK-NEXT: %[[D:.*]] = load i32, i32* %[[C]], align 4 52 // CHECK-NEXT: switch i32 %[[D]], label %[[E:.*]] [ 53 switch (int a, b = 5; int c = 7) { 54 case 0: 55 break; 56 } 57 } 58 59 int g2() { 60 // CHECK: %[[A:.*]] = alloca i32, align 4 61 // CHECK-NEXT: %[[B:.*]] = call i32 @_Z2f2v() 62 // CHECK-NEXT: store i32 7, i32* %[[A]], align 4 63 // CHECK-NEXT: %[[C:.*]] = load i32, i32* %[[A]], align 4 64 // CHECK-NEXT: switch i32 %[[C]], label %[[E:.*]] [ 65 switch (T{f2()}; int c = 7) { 66 case 0: 67 break; 68 } 69 return 2; 70 } 71