]> granicus.if.org Git - clang/commitdiff
DebugInfo: Correct the line location of geps on array accesses
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 24 Jan 2015 23:35:17 +0000 (23:35 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 24 Jan 2015 23:35:17 +0000 (23:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227023 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
test/CodeGenCXX/debug-info-line.cpp

index 3354d3da415a25df93f2175966241cea8d46fa09..6fdd1104803b5632f91b3dadf0c3a8547b6e71f9 100644 (file)
@@ -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");
 
index dd04a4b9d51ef6cfc4e0d8ab0deef6181b405bf0..87ea576ccab791066a0a49cff77725d1e46b4798 100644 (file)
@@ -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,