DebugInfo: Correct location information for array accesses to elements of variable array type.

llvm-svn: 223902
This commit is contained in:
David Blaikie 2014-12-10 01:34:25 +00:00
parent 859e4b5da1
commit 7c5da41c70
2 changed files with 13 additions and 0 deletions

View File

@ -2407,6 +2407,9 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
// The element count here is the total number of non-VLA elements.
llvm::Value *numElements = getVLASize(vla).first;
if (auto *DI = getDebugInfo())
DI->EmitLocation(Builder, E->getLocStart());
// Effectively, the multiply by the VLA size is part of the GEP.
// GEP indexes are signed, and scaling an index isn't permitted to
// signed-overflow, so we use the same semantics for our explicit

View File

@ -90,6 +90,15 @@ void f8() {
src1)[src2()];
}
// CHECK-LABEL: define
void f9(int i) {
int src1[1][i];
int src2();
#line 1000
auto x = ( // CHECK: getelementptr {{.*}} !dbg [[DBG_F9:!.*]]
src1)[src2()];
}
// CHECK: [[DBG_F1]] = metadata !{i32 100,
// CHECK: [[DBG_FOO_VALUE]] = metadata !{i32 200,
// CHECK: [[DBG_FOO_REF]] = metadata !{i32 202,
@ -101,3 +110,4 @@ void f8() {
// CHECK: [[DBG_F6]] = metadata !{i32 700,
// CHECK: [[DBG_F7]] = metadata !{i32 800,
// CHECK: [[DBG_F8]] = metadata !{i32 900,
// CHECK: [[DBG_F9]] = metadata !{i32 1000,