]> granicus.if.org Git - clang/commitdiff
DebugInfo: Suppress the location of instructions in aggregate default arguments.
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 9 Feb 2015 18:47:14 +0000 (18:47 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 9 Feb 2015 18:47:14 +0000 (18:47 +0000)
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
test/CodeGenCXX/debug-info-line.cpp

index 80b16dd5ba3c15570900e4f21067856f6e472a23..7d05d48e85ddbcf1680db21c6dec7b3d07a895be 100644 (file)
@@ -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<CXXDefaultArgExpr>(E))
+    disableDebugInfo();
   AggExprEmitter(*this, Slot).Visit(const_cast<Expr*>(E));
+  if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
+    enableDebugInfo();
 }
 
 LValue CodeGenFunction::EmitAggExprToLValue(const Expr *E) {
index f6ce53e2e3243a1fa92f684750d0670e6b6accb9..4a06145f5023c31c288df147ff3ab188b7fd0d0f 100644 (file)
@@ -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,