[CodeGen] [CodeGen] Attach function attributes to functions created in

CGBlocks.cpp.

This commit fixes a bug in clang's code-gen where it creates the
following functions but doesn't attach function attributes to them:

__copy_helper_block_
__destroy_helper_block_
__Block_byref_object_copy_
__Block_byref_object_dispose_

rdar://problem/20828324

Differential Revision: http://reviews.llvm.org/D13525

llvm-svn: 249735
This commit is contained in:
Akira Hatanaka
2015-10-08 20:26:34 +00:00
parent ab2241f1b8
commit aec6b2c20e
4 changed files with 40 additions and 28 deletions

View File

@@ -1345,6 +1345,9 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
nullptr, SC_Static,
false,
false);
CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
auto NL = ApplyDebugLocation::CreateEmpty(*this);
StartFunction(FD, C.VoidTy, Fn, FI, args);
// Create a scope with an artificial location for the body of this function.
@@ -1516,6 +1519,9 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
SourceLocation(), II, C.VoidTy,
nullptr, SC_Static,
false, false);
CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
// Create a scope with an artificial location for the body of this function.
auto NL = ApplyDebugLocation::CreateEmpty(*this);
StartFunction(FD, C.VoidTy, Fn, FI, args);
@@ -1798,6 +1804,8 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
SC_Static,
false, false);
CGF.CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
CGF.StartFunction(FD, R, Fn, FI, args);
if (generator.needsCopy()) {
@@ -1869,6 +1877,9 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
SourceLocation(), II, R, nullptr,
SC_Static,
false, false);
CGF.CGM.SetInternalFunctionAttributes(nullptr, Fn, FI);
CGF.StartFunction(FD, R, Fn, FI, args);
if (generator.needsDispose()) {