summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/debug-info-scope.c
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2013-08-30 05:37:02 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2013-08-30 05:37:02 +0000
commitbe8d7ba93a5e19017096faaf5df54335a6d52000 (patch)
tree2075bfb4188bd16bfa22392c4b4fab81f47bd777 /clang/test/CodeGen/debug-info-scope.c
parentb7ecc3e6afefc521fb0aa1e48ff3e64e34a46b8e (diff)
downloadbcm5719-llvm-be8d7ba93a5e19017096faaf5df54335a6d52000.tar.gz
bcm5719-llvm-be8d7ba93a5e19017096faaf5df54335a6d52000.zip
Fixing a bug where debug info for a local variable gets emitted at file scope.
The patch was discussed in Phabricator. See: http://llvm-reviews.chandlerc.com/D1281 llvm-svn: 189649
Diffstat (limited to 'clang/test/CodeGen/debug-info-scope.c')
-rw-r--r--clang/test/CodeGen/debug-info-scope.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/CodeGen/debug-info-scope.c b/clang/test/CodeGen/debug-info-scope.c
index 9decaeafd50..05cd299ff36 100644
--- a/clang/test/CodeGen/debug-info-scope.c
+++ b/clang/test/CodeGen/debug-info-scope.c
@@ -1,7 +1,16 @@
// RUN: %clang_cc1 -g -emit-llvm < %s | FileCheck %s
+
+// Make sure that the debug info of the local variable d does not shadow
+// the global variable d
+// CHECK: [ DW_TAG_variable ] [d] [line 6] [def]
+const int d = 100;
+
// Two variables with same name in separate scope.
// Radar 8330217.
int main() {
+// CHECK-NOT: [ DW_TAG_variable ] [d] [line 13]
+// CHECK: [ DW_TAG_auto_variable ] [d] [line 13]
+ const int d = 4;
int j = 0;
int k = 0;
// CHECK: DW_TAG_auto_variable ] [i]
@@ -12,5 +21,5 @@ int main() {
// CHECK-NEXT: DW_TAG_lexical_block
for (int i = 0; i < 10; i++)
k++;
- return 0;
+ return d; // make a reference to d so that its debug info gets included
}
OpenPOWER on IntegriCloud