From: David Blaikie Date: Wed, 10 Dec 2014 01:16:09 +0000 (+0000) Subject: DebugInfo: Fix another case of array access line information X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a31be7142b6fcadb3b0343f12a859accda207f5;p=clang DebugInfo: Fix another case of array access line information git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223897 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index e7caf835ce..ca06e852d0 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2452,6 +2452,9 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, // 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 diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp index 396a3f7750..33c188af59 100644 --- a/test/CodeGenCXX/debug-info-line.cpp +++ b/test/CodeGenCXX/debug-info-line.cpp @@ -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,