From: David Blaikie Date: Sat, 24 Jan 2015 23:35:17 +0000 (+0000) Subject: DebugInfo: Correct the line location of geps on array accesses X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a63898178ce732973b20f259cadf94fecd91eea6;p=clang DebugInfo: Correct the line location of geps on array accesses git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227023 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 3354d3da41..6fdd110480 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -807,6 +807,7 @@ LValue CodeGenFunction::EmitCheckedLValue(const Expr *E, TypeCheckKind TCK) { /// length type, this is not possible. /// LValue CodeGenFunction::EmitLValue(const Expr *E) { + ApplyDebugLocation DL(*this, E->getLocStart()); switch (E->getStmtClass()) { default: return EmitUnsupportedLValue(E, "l-value expression"); diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp index dd04a4b9d5..87ea576cca 100644 --- a/test/CodeGenCXX/debug-info-line.cpp +++ b/test/CodeGenCXX/debug-info-line.cpp @@ -199,6 +199,14 @@ void f16(__complex float f) { f + 1; } +// CHECK-LABEL: define +void f17(int *x) { + 1, +// CHECK: getelementptr {{.*}}, !dbg [[DBG_F17:![0-9]*]] +#line 1900 + x[1]; +} + // CHECK: [[DBG_F1]] = !MDLocation(line: 100, // CHECK: [[DBG_FOO_VALUE]] = !MDLocation(line: 200, // CHECK: [[DBG_FOO_REF]] = !MDLocation(line: 202, @@ -221,3 +229,4 @@ void f16(__complex float f) { // CHECK: [[DBG_F14_CTOR_CALL]] = !MDLocation(line: 1600, // CHECK: [[DBG_F15]] = !MDLocation(line: 1700, // CHECK: [[DBG_F16]] = !MDLocation(line: 1800, +// CHECK: [[DBG_F17]] = !MDLocation(line: 1900,