summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-07 17:37:13 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-07 17:37:13 +0000
commit6d0e5bd8f35e8152d5cf071da875eb873e8aec7b (patch)
tree8d8df0514273de54a706fdb762e1fc8ce793b7c0 /clang/lib/CodeGen/CGExprConstant.cpp
parent0e027fb32bab35376fb5370742efabd0ddf5cf23 (diff)
downloadbcm5719-llvm-6d0e5bd8f35e8152d5cf071da875eb873e8aec7b.tar.gz
bcm5719-llvm-6d0e5bd8f35e8152d5cf071da875eb873e8aec7b.zip
Use the right type when taking the address of a non-virtual member function pointer. Fixes PR6258.
llvm-svn: 95524
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index dca09feebc9..5800ce770c3 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud