From: Devang Patel Date: Mon, 2 May 2011 20:37:08 +0000 (+0000) Subject: Emit debug info for __destroy_helper_block_ and __copy_helper_block. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58dc5ca0841900b197de7733197196f435bf0cc3;p=clang Emit debug info for __destroy_helper_block_ and __copy_helper_block. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130719 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 99a69a4f4a..f26d79c066 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -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 index 0000000000..216f88a8d8 --- /dev/null +++ b/test/CodeGenObjC/debug-info-block-helper.m @@ -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)) {} +