diff options
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 5 | ||||
-rw-r--r-- | clang/test/CodeGen/debug-info-block-decl.c | 19 |
2 files changed, 20 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index b33028b59db..54abbab2afd 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -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/clang/test/CodeGen/debug-info-block-decl.c b/clang/test/CodeGen/debug-info-block-decl.c new file mode 100644 index 00000000000..06c0e1ad319 --- /dev/null +++ b/clang/test/CodeGen/debug-info-block-decl.c @@ -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(); +} + |