summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-11-27 20:47:55 +0000
committerAnders Carlsson <andersca@mac.com>2009-11-27 20:47:55 +0000
commitf942ee029767cce398e0535d9e45b0559c8c86a0 (patch)
treedef5d08fff4775e000aadd6a3152f1077385b511 /clang/lib/CodeGen/CGExprConstant.cpp
parent4ee17e1482e4858fa38f460faa2dcfc4db45796e (diff)
downloadbcm5719-llvm-f942ee029767cce398e0535d9e45b0559c8c86a0.tar.gz
bcm5719-llvm-f942ee029767cce398e0535d9e45b0559c8c86a0.zip
Don't build the entire vtable when all we want is the index of a virtual method.
llvm-svn: 90017
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index d0475dd8df1..54e3fa4744d 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -413,9 +413,10 @@ public:
// Get the function pointer (or index if this is a virtual function).
if (MD->isVirtual()) {
- int64_t Index = CGM.getVtableInfo().getMethodVtableIndex(MD);
+ uint64_t Index = CGM.getVtableInfo().getMethodVtableIndex(MD);
- Values[0] = llvm::ConstantInt::get(PtrDiffTy, Index + 1);
+ // The pointer is 1 + the virtual table offset in bytes.
+ Values[0] = llvm::ConstantInt::get(PtrDiffTy, (Index * 8) + 1);
} else {
llvm::Constant *FuncPtr = CGM.GetAddrOfFunction(MD);
OpenPOWER on IntegriCloud