]> granicus.if.org Git - clang/commitdiff
DebugInfo: Fix line table for comparisons harder/better for the sake of C (& the...
authorDavid Blaikie <dblaikie@gmail.com>
Sat, 31 Jan 2015 01:10:11 +0000 (01:10 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Sat, 31 Jan 2015 01:10:11 +0000 (01:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227663 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp
test/CodeGen/debug-info-line.c [new file with mode: 0644]

index ae78aa00e3a8f10195a32c4b0fb5b040a8edbeae..e152bfd74910af5282f8f698f65295e4bec3d46a 100644 (file)
@@ -1190,7 +1190,11 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
                                                   CurrentCount - TrueCount);
 
   // Emit the code with the fully general case.
-  llvm::Value *CondV = EvaluateExprAsBool(Cond);
+  llvm::Value *CondV;
+  {
+    ApplyDebugLocation DL(*this, Cond);
+    CondV = EvaluateExprAsBool(Cond);
+  }
   Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights);
 }
 
diff --git a/test/CodeGen/debug-info-line.c b/test/CodeGen/debug-info-line.c
new file mode 100644 (file)
index 0000000..2e044d2
--- /dev/null
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -w -gline-tables-only -fexceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s
+
+int f1(int a, int b) {
+  // CHECK: icmp {{.*}}, !dbg [[DBG_F1:!.*]]
+#line 100
+  return a  //
+         && //
+         b;
+}
+
+// CHECK: [[DBG_F1]] = !MDLocation(line: 100,