From c6593075bf338c0eddb1934e884983d23df2f9b4 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sun, 18 Jan 2015 01:57:54 +0000 Subject: [PATCH] DebugInfo: Attribute complex expressions to the source location of the expression Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for complex expressions. llvm-svn: 226390 --- clang/lib/CodeGen/CGExprComplex.cpp | 1 + clang/test/CodeGenCXX/debug-info-line.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 1580bbe..2cbd42b 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -95,6 +95,7 @@ public: //===--------------------------------------------------------------------===// ComplexPairTy Visit(Expr *E) { + ApplyDebugLocation DL(CGF, E->getLocStart()); return StmtVisitor::Visit(E); } diff --git a/clang/test/CodeGenCXX/debug-info-line.cpp b/clang/test/CodeGenCXX/debug-info-line.cpp index 8278b1d..36b7a94 100644 --- a/clang/test/CodeGenCXX/debug-info-line.cpp +++ b/clang/test/CodeGenCXX/debug-info-line.cpp @@ -182,6 +182,7 @@ struct f14_use { f14_use::f14_use() = default; // CHECK-LABEL: define +// CHECK-LABEL: define void func(foo); void f15(foo *f) { func( @@ -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, -- 2.7.4