]> granicus.if.org Git - clang/commitdiff
Remove an ugly hack that was meant to eliminate the breakpoint ambiguity
authorAdrian Prantl <aprantl@apple.com>
Tue, 18 Jun 2013 00:27:36 +0000 (00:27 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 18 Jun 2013 00:27:36 +0000 (00:27 +0000)
between a block assignment and the entry of the block function. In reality
this wouldn't work anyway because blocks are predominantly created
on-the-fly inside of an ObjC method invocation.
The proper fix for the ambiguity is to use -gcolumn-info to differentiate
the breakpoints.

This is expected to break some block-related darwin-gdb tests.

rdar://problem/14039866

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184157 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
test/CodeGen/debug-info-block-decl.c [new file with mode: 0644]

index b33028b59dbc655ebfb0903e443d1540c897bf11..54abbab2afd9940ab9b0cb6f7e915f21406f5c12 100644 (file)
@@ -34,10 +34,7 @@ using namespace CodeGen;
 void CodeGenFunction::EmitStopPoint(const Stmt *S) {
   if (CGDebugInfo *DI = getDebugInfo()) {
     SourceLocation Loc;
-    if (isa<DeclStmt>(S))
-      Loc = S->getLocEnd();
-    else
-      Loc = S->getLocStart();
+    Loc = S->getLocStart();
     DI->EmitLocation(Builder, Loc);
 
     LastStopPoint = Loc;
diff --git a/test/CodeGen/debug-info-block-decl.c b/test/CodeGen/debug-info-block-decl.c
new file mode 100644 (file)
index 0000000..06c0e1a
--- /dev/null
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -fblocks -emit-llvm -o - %s | FileCheck %s
+// Assignment and block entry should point to the same line.
+// rdar://problem/14039866
+
+// CHECK: define{{.*}}@main()
+// CHECK: store{{.*}}bitcast{{.*}}, !dbg ![[ASSIGNMENT:[0-9]+]]
+// CHECK: define {{.*}} @__main_block_invoke
+// CHECK: dbg ![[BLOCK_ENTRY:[0-9]+]]
+
+int main()
+{
+// CHECK: [[ASSIGNMENT]] = metadata !{i32 [[@LINE+2]],
+// CHECK: [[BLOCK_ENTRY]] = metadata !{i32 [[@LINE+1]],
+    int (^blockptr)(void) = ^(void) {
+      return 0;
+    };
+    return blockptr();
+}
+