]> granicus.if.org Git - clang/commitdiff
DebugInfo: Suppress the location of instructions in complex default arguments.
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 9 Feb 2015 18:55:57 +0000 (18:55 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 9 Feb 2015 18:55:57 +0000 (18:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprComplex.cpp
test/CodeGenCXX/debug-info-line.cpp

index b6adbf64f82e79df023aef1371a8c9730ef4d026..b4c652c3d8b96b6aca5d7b56a2856cdb228d76e3 100644 (file)
@@ -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<Expr*>(E));
+  bool hasDebugInfo = getDebugInfo();
+  if (isa<CXXDefaultArgExpr>(E))
+    disableDebugInfo();
+  auto R = ComplexExprEmitter(*this, IgnoreReal, IgnoreImag)
+                .Visit(const_cast<Expr *>(E));
+  if (isa<CXXDefaultArgExpr>(E) && hasDebugInfo)
+    enableDebugInfo();
+  return R;
 }
 
 void CodeGenFunction::EmitComplexExprIntoLValue(const Expr *E, LValue dest,
index 4a06145f5023c31c288df147ff3ab188b7fd0d0f..923f183d5433c41c40632c0fa4a1e57c92b56672 100644 (file)
@@ -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,