blob: 05cd299ff3667dc667ca6e3c1f18e7d76aaf5102 [file] [log] [blame]
Devang Patel0554e0e2010-08-25 00:28:56 +00001// RUN: %clang_cc1 -g -emit-llvm < %s | FileCheck %s
Yunzhong Gao51a31e12013-08-30 05:37:02 +00002
3// Make sure that the debug info of the local variable d does not shadow
4// the global variable d
5// CHECK: [ DW_TAG_variable ] [d] [line 6] [def]
6const int d = 100;
7
Devang Patel0554e0e2010-08-25 00:28:56 +00008// Two variables with same name in separate scope.
9// Radar 8330217.
10int main() {
Yunzhong Gao51a31e12013-08-30 05:37:02 +000011// CHECK-NOT: [ DW_TAG_variable ] [d] [line 13]
12// CHECK: [ DW_TAG_auto_variable ] [d] [line 13]
13 const int d = 4;
Devang Patel0554e0e2010-08-25 00:28:56 +000014 int j = 0;
15 int k = 0;
David Blaikiea6504852013-01-26 22:16:26 +000016// CHECK: DW_TAG_auto_variable ] [i]
Devang Patel0554e0e2010-08-25 00:28:56 +000017// CHECK-NEXT: DW_TAG_lexical_block
18 for (int i = 0; i < 10; i++)
19 j++;
David Blaikiea6504852013-01-26 22:16:26 +000020// CHECK: DW_TAG_auto_variable ] [i]
21// CHECK-NEXT: DW_TAG_lexical_block
Devang Patel0554e0e2010-08-25 00:28:56 +000022 for (int i = 0; i < 10; i++)
23 k++;
Yunzhong Gao51a31e12013-08-30 05:37:02 +000024 return d; // make a reference to d so that its debug info gets included
Devang Patel0554e0e2010-08-25 00:28:56 +000025}