]> granicus.if.org Git - clang/commitdiff
Emit debug info for __destroy_helper_block_ and __copy_helper_block.
authorDevang Patel <dpatel@apple.com>
Mon, 2 May 2011 20:37:08 +0000 (20:37 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 2 May 2011 20:37:08 +0000 (20:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130719 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBlocks.cpp
test/CodeGenObjC/debug-info-block-helper.m [new file with mode: 0644]

index 99a69a4f4a93f3503f94e8fbbc17216ff8d3835a..f26d79c0667dd266a0cb68ca2a59bfbf39a31bce 100644 (file)
@@ -1063,6 +1063,10 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
   IdentifierInfo *II
     = &CGM.getContext().Idents.get("__copy_helper_block_");
 
+  // Check if we should generate debug info for this block helper function.
+  if (CGM.getModuleDebugInfo())
+    DebugInfo = CGM.getModuleDebugInfo();
+
   FunctionDecl *FD = FunctionDecl::Create(C,
                                           C.getTranslationUnitDecl(),
                                           SourceLocation(),
@@ -1150,6 +1154,10 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
     llvm::Function::Create(LTy, llvm::GlobalValue::InternalLinkage,
                            "__destroy_helper_block_", &CGM.getModule());
 
+  // Check if we should generate debug info for this block destroy function.
+  if (CGM.getModuleDebugInfo())
+    DebugInfo = CGM.getModuleDebugInfo();
+
   IdentifierInfo *II
     = &CGM.getContext().Idents.get("__destroy_helper_block_");
 
diff --git a/test/CodeGenObjC/debug-info-block-helper.m b/test/CodeGenObjC/debug-info-block-helper.m
new file mode 100644 (file)
index 0000000..216f88a
--- /dev/null
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -masm-verbose -S -fblocks -g  -triple x86_64-apple-darwin10  %s -o - | FileCheck %s
+extern void foo(void(^)(void));
+
+// CHECK:      .ascii   "__destroy_helper_block_" ## DW_AT_name
+
+@interface NSObject {
+  struct objc_object *isa;
+}
+@end
+
+@interface A:NSObject @end
+@implementation A
+- (void) helper {
+ int master = 0;
+ __block int m2 = 0;
+ __block int dbTransaction = 0;
+ int (^x)(void) = ^(void) { (void) self; 
+       (void) master; 
+       (void) dbTransaction; 
+       m2++;
+       return m2;
+
+       };
+  master = x();
+}
+@end
+
+void foo(void(^x)(void)) {}
+