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