[cfe-commits] r130719 - in /cfe/trunk: lib/CodeGen/CGBlocks.cpp test/CodeGenObjC/debug-info-block-helper.m

Devang Patel dpatel at apple.com
Mon May 2 13:37:09 PDT 2011


Author: dpatel
Date: Mon May  2 15:37:08 2011
New Revision: 130719

URL: http://llvm.org/viewvc/llvm-project?rev=130719&view=rev
Log:
Emit debug info for __destroy_helper_block_ and __copy_helper_block.

Added:
    cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m
Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=130719&r1=130718&r2=130719&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon May  2 15:37:08 2011
@@ -1063,6 +1063,10 @@
   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 @@
     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_");
 

Added: cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m?rev=130719&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-block-helper.m Mon May  2 15:37:08 2011
@@ -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
+
+ at interface NSObject {
+  struct objc_object *isa;
+}
+ at end
+
+ at interface A:NSObject @end
+ at 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();
+}
+ at end
+
+void foo(void(^x)(void)) {}
+





More information about the cfe-commits mailing list