2015-10-08 12:24:12 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin %s -o - | FileCheck %s
|
2012-05-09 02:56:47 +08:00
|
|
|
|
|
|
|
void testVLAwithSize(int s)
|
|
|
|
{
|
[DebugInfo] Enable debug information for C99 VLA types
Summary:
This patch enables debugging of C99 VLA types by generating more precise
LLVM Debug metadata, using the extended DISubrange 'count' field that
takes a DIVariable.
This should implement:
Bug 30553: Debug info generated for arrays is not what GDB expects (not as good as GCC's)
https://bugs.llvm.org/show_bug.cgi?id=30553
Reviewers: echristo, aprantl, dexonsmith, clayborg, pcc, kristof.beyls, dblaikie
Reviewed By: aprantl
Subscribers: jholewinski, schweitz, davide, fhahn, JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D41698
llvm-svn: 323952
2018-02-01 19:25:10 +08:00
|
|
|
// CHECK-DAG: dbg.declare({{.*}} %vla_expr, metadata ![[VLAEXPR:[0-9]+]]
|
|
|
|
// CHECK-DAG: dbg.declare({{.*}} %vla, metadata ![[VAR:[0-9]+]]
|
|
|
|
// CHECK-DAG: ![[VLAEXPR]] = !DILocalVariable(name: "vla_expr"
|
|
|
|
// CHECK-DAG: ![[VAR]] = !DILocalVariable(name: "vla",{{.*}} line: [[@LINE+2]]
|
|
|
|
// CHECK-DAG: !DISubrange(count: ![[VLAEXPR]])
|
2012-05-09 02:56:47 +08:00
|
|
|
int vla[s];
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < s; i++) {
|
|
|
|
vla[i] = i*i;
|
|
|
|
}
|
|
|
|
}
|