aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-08-04 21:58:42 +0000
committerMike Stump <mrs@apple.com>2009-08-04 21:58:42 +0000
commit104ffaaa05d31d0a3dc886b7b18ebb2496bc2af4 (patch)
tree200e5f5aba8558ac93cf5831d219ab6357a6ba74 /lib/CodeGen/CGCXX.cpp
parentac5fc7c6bcb494b60fee7ce615ac931c5db6135e (diff)
vtable building for simple inheritance. Still in progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78110 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 21fba14571..97937ea89a 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -169,7 +169,7 @@ GetNestedPaths(llvm::SmallVectorImpl<const CXXRecordDecl *> &NestedBasePaths,
if (i->isVirtual())
continue;
const CXXRecordDecl *Base =
- cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
+ cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
if (Base == BaseClassDecl) {
NestedBasePaths.push_back(BaseClassDecl);
return true;
@@ -543,6 +543,23 @@ llvm::Value *CodeGenFunction::GenerateVtable(const CXXRecordDecl *RD) {
int64_t offset = 0;
methods.push_back(m); offset += LLVMPointerWidth;
methods.push_back(GenerateRtti(RD)); offset += LLVMPointerWidth;
+
+ for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
+ e = RD->bases_end(); i != e; ++i) {
+ if (i->isVirtual())
+ continue;
+ const CXXRecordDecl *Base =
+ cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
+ for (meth_iter mi = Base->method_begin(), me = Base->method_end(); mi != me;
+ ++mi) {
+ if (mi->isVirtual()) {
+ m = CGM.GetAddrOfFunction(GlobalDecl(*mi));
+ m = llvm::ConstantExpr::getBitCast(m, Ptr8Ty);
+ methods.push_back(m);
+ }
+ }
+ }
+
for (meth_iter mi = RD->method_begin(), me = RD->method_end(); mi != me;
++mi) {
if (mi->isVirtual()) {