1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -g -emit-llvm %s -o -| FileCheck %s 2*f4a2713aSLionel Sambuc // 3*f4a2713aSLionel Sambuc // Two variables with the same name in subsequent if staments need to be in separate scopes. 4*f4a2713aSLionel Sambuc // 5*f4a2713aSLionel Sambuc // rdar://problem/14024005 6*f4a2713aSLionel Sambuc // 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc int printf(const char*, ...); 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc char *return_char (int input) 11*f4a2713aSLionel Sambuc { 12*f4a2713aSLionel Sambuc if (input%2 == 0) 13*f4a2713aSLionel Sambuc return "I am even.\n"; 14*f4a2713aSLionel Sambuc else 15*f4a2713aSLionel Sambuc return "I am odd.\n"; 16*f4a2713aSLionel Sambuc } 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc int main2() { 19*f4a2713aSLionel Sambuc // CHECK: [ DW_TAG_auto_variable ] [ptr] [line [[@LINE+2]]] 20*f4a2713aSLionel Sambuc // CHECK metadata !{i32 {{.*}}, metadata !{{.*}}, i32 [[@LINE+1]], {{.*}}} ; [ DW_TAG_lexical_block ] 21*f4a2713aSLionel Sambuc if (char *ptr = return_char(1)) { 22*f4a2713aSLionel Sambuc printf ("%s", ptr); 23*f4a2713aSLionel Sambuc } 24*f4a2713aSLionel Sambuc // CHECK: [ DW_TAG_auto_variable ] [ptr] [line [[@LINE+2]]] 25*f4a2713aSLionel Sambuc // CHECK metadata !{i32 {{.*}}, metadata !{{.*}}, i32 [[@LINE+1]], {{.*}}} ; [ DW_TAG_lexical_block ] 26*f4a2713aSLionel Sambuc if (char *ptr = return_char(2)) { 27*f4a2713aSLionel Sambuc printf ("%s", ptr); 28*f4a2713aSLionel Sambuc } 29*f4a2713aSLionel Sambuc else printf ("%s", ptr); 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc return 0; 32*f4a2713aSLionel Sambuc } 33