diff options
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 10 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 13 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.h | 2 |
3 files changed, 6 insertions, 19 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); diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 43db767158e..e3f824fc742 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -53,19 +53,6 @@ CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionProtoType *FTP) { return getFunctionInfo(FTP->getResultType(), ArgTys); } -const -CGFunctionInfo &CodeGenTypes::getFunctionInfo(const BlockPointerType *BPT) { - llvm::SmallVector<QualType, 16> ArgTys; - const FunctionProtoType *FTP = - BPT->getPointeeType()->getAsFunctionProtoType(); - - // Add the block pointer. - ArgTys.push_back(Context.getPointerType(Context.VoidTy)); - for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) - ArgTys.push_back(FTP->getArgType(i)); - return getFunctionInfo(FTP->getResultType(), ArgTys); -} - const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const CXXMethodDecl *MD) { llvm::SmallVector<QualType, 16> ArgTys; // Add the 'this' pointer. diff --git a/clang/lib/CodeGen/CodeGenTypes.h b/clang/lib/CodeGen/CodeGenTypes.h index b09531f5ca3..a23b8f651a8 100644 --- a/clang/lib/CodeGen/CodeGenTypes.h +++ b/clang/lib/CodeGen/CodeGenTypes.h @@ -172,11 +172,9 @@ public: const CGFunctionInfo &getFunctionInfo(const FunctionNoProtoType *FTNP); const CGFunctionInfo &getFunctionInfo(const FunctionProtoType *FTP); - const CGFunctionInfo &getFunctionInfo(const BlockPointerType *BPT); const CGFunctionInfo &getFunctionInfo(const FunctionDecl *FD); const CGFunctionInfo &getFunctionInfo(const CXXMethodDecl *MD); const CGFunctionInfo &getFunctionInfo(const ObjCMethodDecl *MD); -//private: const CGFunctionInfo &getFunctionInfo(QualType ResTy, const CallArgList &Args); public: |