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 99a69a4..f26d79c 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -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_");
diff --git a/test/CodeGenObjC/debug-info-block-helper.m b/test/CodeGenObjC/debug-info-block-helper.m
new file mode 100644
index 0000000..216f88a
--- /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)) {}
+