r223699 - DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression

David Blaikie dblaikie at gmail.com
Mon Dec 8 13:48:57 PST 2014


Author: dblaikie
Date: Mon Dec  8 15:48:57 2014
New Revision: 223699

URL: http://llvm.org/viewvc/llvm-project?rev=223699&view=rev
Log:
DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression

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

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=223699&r1=223698&r2=223699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Dec  8 15:48:57 2014
@@ -3133,6 +3133,8 @@ LValue CodeGenFunction::EmitBinaryOperat
 
     RValue RV = EmitAnyExpr(E->getRHS());
     LValue LV = EmitCheckedLValue(E->getLHS(), TCK_Store);
+    if (CGDebugInfo *DI = getDebugInfo())
+      DI->EmitLocation(Builder, E->getLocStart());
     EmitStoreThroughLValue(RV, LV);
     return LV;
   }

Added: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=223699&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Mon Dec  8 15:48:57 2014
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s
+
+int src(); int* sink();
+
+void f1() {
+#line 100
+  * // The store for the assignment should be attributed to the start of the
+    // assignment expression here, regardless of the location of subexpressions.
+  (
+  sink
+  (
+  )
+  +
+  3
+  )
+  =
+  src
+  (
+  )
+  +
+  42
+  ;
+  // CHECK: store {{.*}}, !dbg [[DBG1:!.*]]
+}
+
+// CHECK: [[DBG1]] = metadata !{i32 100, {{.*}}





More information about the cfe-commits mailing list