]> granicus.if.org Git - clang/commitdiff
DebugInfo: Attribute complex expressions to the source location of the expression
authorDavid Blaikie <dblaikie@gmail.com>
Sun, 18 Jan 2015 01:57:54 +0000 (01:57 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sun, 18 Jan 2015 01:57:54 +0000 (01:57 +0000)
Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the
same for complex expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226390 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 1580bbe6a2943b15a4117f889d071bd22479f176..2cbd42b7ee5ba2f1d09676f048e0ffd7a1e52d0a 100644 (file)
@@ -95,6 +95,7 @@ public:
   //===--------------------------------------------------------------------===//
 
   ComplexPairTy Visit(Expr *E) {
+    ApplyDebugLocation DL(CGF, E->getLocStart());
     return StmtVisitor<ComplexExprEmitter, ComplexPairTy>::Visit(E);
   }
 
index 8278b1d53f757cf2cae7e367222bd337a19d9b95..36b7a94a5146ec03d88b18eb641070df42aa50b9 100644 (file)
@@ -181,6 +181,7 @@ struct f14_use {
 
 f14_use::f14_use() = default;
 
+// CHECK-LABEL: define
 // CHECK-LABEL: define
 void func(foo);
 void f15(foo *f) {
@@ -190,6 +191,14 @@ void f15(foo *f) {
       f[3]);
 }
 
+// CHECK-LABEL: define
+void f16(__complex float f) {
+  __complex float g = //
+// CHECK: add {{.*}}, !dbg [[DBG_F16:![0-9]*]]
+#line 1800
+      f + 1;
+}
+
 // CHECK: [[DBG_F1]] = !MDLocation(line: 100,
 // CHECK: [[DBG_FOO_VALUE]] = !MDLocation(line: 200,
 // CHECK: [[DBG_FOO_REF]] = !MDLocation(line: 202,
@@ -211,3 +220,4 @@ void f15(foo *f) {
 // CHECK: [[DBG_F13]] = !MDLocation(line: 1500,
 // CHECK: [[DBG_F14_CTOR_CALL]] = !MDLocation(line: 1600,
 // CHECK: [[DBG_F15]] = !MDLocation(line: 1700,
+// CHECK: [[DBG_F16]] = !MDLocation(line: 1800,