r223828 - DebugInfo: Accurate location information for complex assignment

David Blaikie dblaikie at gmail.com
Tue Dec 9 13:10:43 PST 2014


Author: dblaikie
Date: Tue Dec  9 15:10:43 2014
New Revision: 223828

URL: http://llvm.org/viewvc/llvm-project?rev=223828&view=rev
Log:
DebugInfo: Accurate location information for complex assignment

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

Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=223828&r1=223827&r2=223828&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Tue Dec  9 15:10:43 2014
@@ -82,7 +82,7 @@ public:
   /// EmitStoreOfComplex - Store the specified real/imag parts into the
   /// specified value pointer.
   void EmitStoreOfComplex(ComplexPairTy Val, LValue LV, bool isInit,
-                          SourceLocation DbgLoc = SourceLocation());
+                          SourceLocation DbgLoc);
 
   /// EmitComplexToComplexCast - Emit a cast from complex value Val to DestType.
   ComplexPairTy EmitComplexToComplexCast(ComplexPairTy Val, QualType SrcType,
@@ -869,7 +869,8 @@ EmitCompoundAssignLValue(const CompoundA
   // Truncate the result and store it into the LHS lvalue.
   if (LHSTy->isAnyComplexType()) {
     ComplexPairTy ResVal = EmitComplexToComplexCast(Result, OpInfo.Ty, LHSTy);
-    EmitStoreOfComplex(ResVal, LHS, /*isInit*/ false);
+    // FIXME
+    EmitStoreOfComplex(ResVal, LHS, /*isInit*/ false, SourceLocation());
     Val = RValue::getComplex(ResVal);
   } else {
     llvm::Value *ResVal =
@@ -914,8 +915,7 @@ LValue ComplexExprEmitter::EmitBinAssign
   LValue LHS = CGF.EmitLValue(E->getLHS());
 
   // Store the result value into the LHS lvalue.
-  // FIXME
-  EmitStoreOfComplex(Val, LHS, /*isInit*/ false);
+  EmitStoreOfComplex(Val, LHS, /*isInit*/ false, E->getLocStart());
 
   return LHS;
 }

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=223828&r1=223827&r2=223828&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Tue Dec  9 15:10:43 2014
@@ -1,14 +1,16 @@
 // RUN: %clang_cc1 -g -std=c++11 -S -emit-llvm %s -o - | FileCheck %s
 
 int &src();
-int* sink();
+int *sink();
 __complex float complex_src();
+__complex float *complex_sink();
 
+// CHECK-LABEL: define
 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() = src();
+      // assignment expression here, regardless of the location of subexpressions.
+      sink() = src();
   // CHECK: store {{.*}}, !dbg [[DBG_F1:!.*]]
 }
 
@@ -19,22 +21,27 @@ struct foo {
   foo();
 };
 
+// CHECK-LABEL: define
 foo::foo()
-  :
+    :
 #line 200
-    i
-    (src()),
-    // CHECK: store i32 {{.*}} !dbg [[DBG_FOO_VALUE:!.*]]
-    j
-    (src()),
-    // CHECK: store i32* {{.*}} !dbg [[DBG_FOO_REF:!.*]]
-    k
-    (complex_src())
-    // CHECK: store float {{.*}} !dbg [[DBG_FOO_COMPLEX:!.*]]
-{
+      i // CHECK: store i32 {{.*}} !dbg [[DBG_FOO_VALUE:!.*]]
+      (src()),
+      j // CHECK: store i32* {{.*}} !dbg [[DBG_FOO_REF:!.*]]
+      (src()),
+      k // CHECK: store float {{.*}} !dbg [[DBG_FOO_COMPLEX:!.*]]
+      (complex_src()) {
+}
+
+// CHECK-LABEL: define
+void f2() {
+#line 300
+  * // CHECK: store float {{.*}} !dbg [[DBG_F2_COMPLEX:!.*]]
+      complex_sink() = complex_src();
 }
 
 // CHECK: [[DBG_F1]] = metadata !{i32 100,
 // CHECK: [[DBG_FOO_VALUE]] = metadata !{i32 200,
-// CHECK: [[DBG_FOO_REF]] = metadata !{i32 203,
-// CHECK: [[DBG_FOO_COMPLEX]] = metadata !{i32 206,
+// CHECK: [[DBG_FOO_REF]] = metadata !{i32 202,
+// CHECK: [[DBG_FOO_COMPLEX]] = metadata !{i32 204,
+// CHECK: [[DBG_F2_COMPLEX]] = metadata !{i32 300,





More information about the cfe-commits mailing list