From 74bfe1069dd02c30239bc4d72eb684b248ed3f08 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 9 Feb 2015 18:55:57 +0000 Subject: [PATCH] DebugInfo: Suppress the location of instructions in complex default arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228589 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprComplex.cpp | 10 ++++++++-- test/CodeGenCXX/debug-info-line.cpp | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index b6adbf64f8..b4c652c3d8 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -1033,8 +1033,14 @@ ComplexPairTy CodeGenFunction::EmitComplexExpr(const Expr *E, bool IgnoreReal, assert(E && getComplexType(E->getType()) && "Invalid complex expression to emit"); - return ComplexExprEmitter(*this, IgnoreReal, IgnoreImag) - .Visit(const_cast(E)); + bool hasDebugInfo = getDebugInfo(); + if (isa(E)) + disableDebugInfo(); + auto R = ComplexExprEmitter(*this, IgnoreReal, IgnoreImag) + .Visit(const_cast(E)); + if (isa(E) && hasDebugInfo) + enableDebugInfo(); + return R; } void CodeGenFunction::EmitComplexExprIntoLValue(const Expr *E, LValue dest, diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp index 4a06145f50..923f183d54 100644 --- a/test/CodeGenCXX/debug-info-line.cpp +++ b/test/CodeGenCXX/debug-info-line.cpp @@ -285,6 +285,14 @@ void f23() { f23_b(); } +// CHECK-LABEL: define +void f24_a(__complex float = complex_src()); +void f24() { +// CHECK: call {{.*}}complex_src{{.*}}, !dbg [[DBG_F24:![0-9]*]] +#line 2600 + f24_a(); +} + // CHECK: [[DBG_F1]] = !MDLocation(line: 100, // CHECK: [[DBG_FOO_VALUE]] = !MDLocation(line: 200, // CHECK: [[DBG_FOO_REF]] = !MDLocation(line: 202, @@ -314,3 +322,4 @@ void f23() { // CHECK: [[DBG_F19_2]] = !MDLocation(line: 2101, // CHECK: [[DBG_F20_1]] = !MDLocation(line: 2200, // CHECK: [[DBG_F23]] = !MDLocation(line: 2500, +// CHECK: [[DBG_F24]] = !MDLocation(line: 2600, -- 2.40.0