summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-11-21 00:35:25 +0000
committerAdrian Prantl <aprantl@apple.com>2014-11-21 00:35:25 +0000
commit88eec39460db6bc00dcccaed44dbaa50c817e2fc (patch)
tree80e8870e63f4409051c6ed93f407dfc99e917085 /clang/test/CodeGenObjC
parentb5b4dd81ba02bce1a9818841c5f33d876423e04f (diff)
downloadbcm5719-llvm-88eec39460db6bc00dcccaed44dbaa50c817e2fc.tar.gz
bcm5719-llvm-88eec39460db6bc00dcccaed44dbaa50c817e2fc.zip
Debug info for blocks: Fix a bug caught by the Verifier.
When emitting nested block definitions, the insert-at-point variant of DIBuilder::insertDeclare() could be called with the insertion point set to the end-of-BasicBlock sentinel, causing the parent pointer of the CallInst to be set to the intentionally bogus value of the sentinel. Fixed by conditionally invoking the correct version of insertDeclare(). rdar://problem/19034882 llvm-svn: 222487
Diffstat (limited to 'clang/test/CodeGenObjC')
-rw-r--r--clang/test/CodeGenObjC/debug-info-nested-blocks.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/debug-info-nested-blocks.m b/clang/test/CodeGenObjC/debug-info-nested-blocks.m
new file mode 100644
index 00000000000..5817b86302c
--- /dev/null
+++ b/clang/test/CodeGenObjC/debug-info-nested-blocks.m
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -emit-llvm -gdwarf-2 -fblocks -o - -x objective-c %s| FileCheck %s
+// This code triggered a bug where a dbg.declare intrinsic ended up with the
+// wrong parent and subsequently failed the Verifier.
+void baz(id b);
+void fub(id block);
+int foo(void);
+void bar(void) {
+ fub(^() {
+ id a;
+ id b = [a bar:^(int e){}];
+ if (b) {
+ ^() {
+ if ((0 && foo()) ? 1 : 0) {
+ baz([a aMessage]);
+ }
+ };
+ }
+ });
+}
+
+// Verify that debug info for BlockPointerDbgLoc is emitted for the
+// innermost block.
+//
+// CHECK: define {{.*}}void @__bar_block_invoke_3(i8* %.block_descriptor)
+// CHECK: %[[BLOCKADDR:.*]] = alloca <{{.*}}>*, align 8
+// CHECK: call void @llvm.dbg.declare(metadata !{{.*}}%[[BLOCKADDR]]
OpenPOWER on IntegriCloud