r223897 - DebugInfo: Fix another case of array access line information

David Blaikie dblaikie at gmail.com
Tue Dec 9 17:16:09 PST 2014


Author: dblaikie
Date: Tue Dec  9 19:16:09 2014
New Revision: 223897

URL: http://llvm.org/viewvc/llvm-project?rev=223897&view=rev
Log:
DebugInfo: Fix another case of array access line information

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-line.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=223897&r1=223896&r2=223897&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Dec  9 19:16:09 2014
@@ -2452,6 +2452,9 @@ LValue CodeGenFunction::EmitArraySubscri
     // Propagate the alignment from the array itself to the result.
     ArrayAlignment = ArrayLV.getAlignment();
 
+    if (auto *DI = getDebugInfo())
+      DI->EmitLocation(Builder, E->getLocStart());
+
     if (getLangOpts().isSignedOverflowDefined())
       Address = Builder.CreateGEP(ArrayPtr, Args, "arrayidx");
     else

Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=223897&r1=223896&r2=223897&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Tue Dec  9 19:16:09 2014
@@ -81,6 +81,15 @@ void f7() {
       src1())[src2()];
 }
 
+// CHECK-LABEL: define
+void f8() {
+  int src1[1];
+  int src2();
+#line 900
+  int x = ( // CHECK: load {{.*}} !dbg [[DBG_F8:!.*]]
+      src1)[src2()];
+}
+
 // CHECK: [[DBG_F1]] = metadata !{i32 100,
 // CHECK: [[DBG_FOO_VALUE]] = metadata !{i32 200,
 // CHECK: [[DBG_FOO_REF]] = metadata !{i32 202,
@@ -91,3 +100,4 @@ void f7() {
 // CHECK: [[DBG_F5]] = metadata !{i32 600,
 // CHECK: [[DBG_F6]] = metadata !{i32 700,
 // CHECK: [[DBG_F7]] = metadata !{i32 800,
+// CHECK: [[DBG_F8]] = metadata !{i32 900,





More information about the cfe-commits mailing list