diff options
author | Anders Carlsson <andersca@mac.com> | 2009-04-08 02:55:55 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-04-08 02:55:55 +0000 |
commit | a17d7ccc2ed77e321855990e180f2a34ec304bfc (patch) | |
tree | 7e751994646020d3b779e38310393a07cc22495e /lib/CodeGen/CGBlocks.cpp | |
parent | 437bb4b6ecf23bd016203dee80983402cdcb761e (diff) |
Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68583 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | lib/CodeGen/CGBlocks.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index c8d9655951..74b6af1425 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -444,13 +444,15 @@ RValue CodeGenFunction::EmitBlockCallExpr(const CallExpr* E) { // Load the function. llvm::Value *Func = Builder.CreateLoad(FuncPtr, false, "tmp"); - const CGFunctionInfo &FnInfo = CGM.getTypes().getFunctionInfo(BPT); - bool IsVariadic = - BPT->getPointeeType()->getAsFunctionProtoType()->isVariadic(); + QualType FnType = BPT->getPointeeType(); + QualType ResultType = FnType->getAsFunctionType()->getResultType(); + + const CGFunctionInfo &FnInfo = + CGM.getTypes().getFunctionInfo(ResultType, Args); // Cast the function pointer to the right type. const llvm::Type *BlockFTy = - CGM.getTypes().GetFunctionType(FnInfo, IsVariadic); + CGM.getTypes().GetFunctionType(FnInfo, false); const llvm::Type *BlockFTyPtr = llvm::PointerType::getUnqual(BlockFTy); Func = Builder.CreateBitCast(Func, BlockFTyPtr); |