From 40a73dbd40a7a7813c7bbd0ada5b9561418c800b Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 9 Feb 2015 18:47:14 +0000 Subject: [PATCH] DebugInfo: Suppress the location of instructions in aggregate default arguments. Matches the existing code for scalar default arguments. Complex default arguments probably need the same handling too (test/fix to that coming next). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228588 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 5 +++++ test/CodeGenCXX/debug-info-line.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 80b16dd5ba..7d05d48e85 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -1387,7 +1387,12 @@ void CodeGenFunction::EmitAggExpr(const Expr *E, AggValueSlot Slot) { // Optimize the slot if possible. CheckAggExprForMemSetUse(Slot, E, *this); + bool hasDebugInfo = getDebugInfo(); + if (isa(E)) + disableDebugInfo(); AggExprEmitter(*this, Slot).Visit(const_cast(E)); + if (isa(E) && hasDebugInfo) + enableDebugInfo(); } LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) { diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp index f6ce53e2e3..4a06145f50 100644 --- a/test/CodeGenCXX/debug-info-line.cpp +++ b/test/CodeGenCXX/debug-info-line.cpp @@ -274,6 +274,17 @@ void f22() { } } +// CHECK-LABEL: define +struct f23_struct { +}; +f23_struct f23_a(); +void f23_b(f23_struct = f23_a()); +void f23() { +// CHECK: call {{.*}}f23_a{{.*}}, !dbg [[DBG_F23:![0-9]*]] +#line 2500 + f23_b(); +} + // CHECK: [[DBG_F1]] = !MDLocation(line: 100, // CHECK: [[DBG_FOO_VALUE]] = !MDLocation(line: 200, // CHECK: [[DBG_FOO_REF]] = !MDLocation(line: 202, @@ -302,3 +313,4 @@ void f22() { // CHECK: [[DBG_F19_1]] = !MDLocation(line: 2100, // CHECK: [[DBG_F19_2]] = !MDLocation(line: 2101, // CHECK: [[DBG_F20_1]] = !MDLocation(line: 2200, +// CHECK: [[DBG_F23]] = !MDLocation(line: 2500, -- 2.40.0