diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-08-13 00:19:55 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-08-13 00:19:55 +0000 |
commit | f7f020bb2afe2943f2f351c5d5e91f5587aa7661 (patch) | |
tree | cfdbc4769f01ea8d7e94ce1015279b3f0df65d3b /clang/lib/CodeGen/CGBlocks.cpp | |
parent | 2a0ca3e93760e211c0fdfcbb662f8e423606e494 (diff) | |
download | bcm5719-llvm-f7f020bb2afe2943f2f351c5d5e91f5587aa7661.tar.gz bcm5719-llvm-f7f020bb2afe2943f2f351c5d5e91f5587aa7661.zip |
Make use of __func__ in a block actually refer to
block's helper function. Fixes radar 7860965.
llvm-svn: 110988
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index bb81bf56b5f..1dceb32a5ce 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -790,7 +790,11 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, const BlockExpr *BExpr, Name.getString(), &CGM.getModule()); CGM.SetInternalFunctionAttributes(BD, Fn, FI); - + StartFunction(BD, ResultType, Fn, Args, + BExpr->getBody()->getLocEnd()); + + CurFuncDecl = OuterFuncDecl; + QualType FnType(BlockFunctionType, 0); bool HasPrototype = isa<FunctionProtoType>(BlockFunctionType); @@ -802,12 +806,19 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, const BlockExpr *BExpr, FunctionDecl::Static, FunctionDecl::None, false, HasPrototype); + if (FunctionProtoType *FT = dyn_cast<FunctionProtoType>(FnType)) { + const FunctionDecl *CFD = dyn_cast<FunctionDecl>(CurCodeDecl); + FunctionDecl *FD = const_cast<FunctionDecl *>(CFD); + llvm::SmallVector<ParmVarDecl*, 16> Params; + for (unsigned i = 0, e = FT->getNumArgs(); i != e; ++i) + Params.push_back(ParmVarDecl::Create(getContext(), FD, + SourceLocation(), 0, + FT->getArgType(i), /*TInfo=*/0, + VarDecl::None, VarDecl::None, 0)); + FD->setParams(Params.data(), Params.size()); + } + - StartFunction(BD, ResultType, Fn, Args, - BExpr->getBody()->getLocEnd()); - - CurFuncDecl = OuterFuncDecl; - // If we have a C++ 'this' reference, go ahead and force it into // existence now. if (Info.CXXThisRef) { |