r228588 - DebugInfo: Suppress the location of instructions in aggregate default arguments.

David Blaikie dblaikie at gmail.com
Mon Feb 9 10:47:14 PST 2015


Author: dblaikie
Date: Mon Feb  9 12:47:14 2015
New Revision: 228588

URL: http://llvm.org/viewvc/llvm-project?rev=228588&view=rev
Log:
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).

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

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=228588&r1=228587&r2=228588&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon Feb  9 12:47:14 2015
@@ -1387,7 +1387,12 @@ void CodeGenFunction::EmitAggExpr(const
   // Optimize the slot if possible.
   CheckAggExprForMemSetUse(Slot, E, *this);
  
+  bool hasDebugInfo = getDebugInfo();
+  if (isa<CXXDefaultArgExpr>(E))
+    disableDebugInfo();
   AggExprEmitter(*this, Slot).Visit(const_cast<Expr*>(E));
+  if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
+    enableDebugInfo();
 }
 
 LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) {

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=228588&r1=228587&r2=228588&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Mon Feb  9 12:47:14 2015
@@ -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,





More information about the cfe-commits mailing list