diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-07 17:37:13 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-07 17:37:13 +0000 |
commit | 585fa68ca00421af6c8289866a7bde27a8e8c0ce (patch) | |
tree | 523ea9e204ba16f2a2dcdc9abb972f30693496d4 /lib/CodeGen/CGExprConstant.cpp | |
parent | 63644fae3970d4146200e4cb25dd9aace34a3398 (diff) |
Use the right type when taking the address of a non-virtual member function pointer. Fixes PR6258.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
-rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index dca09feebc..5800ce770c 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -425,8 +425,12 @@ public: // (in bytes) of the function, represented as a ptrdiff_t. Values[0] = llvm::ConstantInt::get(PtrDiffTy, (Index * 8) + 1); } else { - llvm::Constant *FuncPtr = CGM.GetAddrOfFunction(MD); + const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>(); + const llvm::Type *Ty = + CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD), + FPT->isVariadic()); + llvm::Constant *FuncPtr = CGM.GetAddrOfFunction(MD, Ty); Values[0] = llvm::ConstantExpr::getPtrToInt(FuncPtr, PtrDiffTy); } |