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 | a60cbcdfe6725a58078a46fd4bd88321ab75a754 (patch) | |
tree | 180c48aded0d632d21ee232165118225e8a661d2 /clang/lib/CodeGen/CGBlocks.cpp | |
parent | 9d54bd77c020b8770eedfa3354b85a67403c03f0 (diff) | |
download | bcm5719-llvm-a60cbcdfe6725a58078a46fd4bd88321ab75a754.tar.gz bcm5719-llvm-a60cbcdfe6725a58078a46fd4bd88321ab75a754.zip |
Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
llvm-svn: 68583
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index c8d9655951d..74b6af1425e 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/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); |