diff options
author | Mike Stump <mrs@apple.com> | 2009-08-07 21:54:03 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-08-07 21:54:03 +0000 |
commit | 57cf2f3abad1c3541cd388d9b7882d65cf6daa7c (patch) | |
tree | 148617981940f0436c8df432bbe7d16a1cf40955 /lib/CodeGen/CGCXX.cpp | |
parent | 89ed850a1b586a4ed303ee8a8140bed11b85b390 (diff) |
Add vbase offsets to the vtable. Wow, having an rbegin was so
fortuitous. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGCXX.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index cb6a6f8271..d79e1cef09 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -616,6 +616,18 @@ llvm::Value *CodeGenFunction::GenerateVtable(const CXXRecordDecl *RD) { const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase(); const bool PrimaryBaseWasVirtual = Layout.getPrimaryBaseWasVirtual(); + // The virtual base offsets come first. + for (CXXRecordDecl::reverse_base_class_const_iterator i = RD->vbases_rbegin(), + e = RD->vbases_rend(); i != e; ++i) { + const CXXRecordDecl *Base = + cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl()); + int64_t BaseOffset = Layout.getBaseClassOffset(Base) / 8; + llvm::Constant *m; + m = llvm::ConstantInt::get(llvm::Type::Int64Ty, BaseOffset); + m = llvm::ConstantExpr::getIntToPtr(m, Ptr8Ty); + methods.push_back(m); + } + // The primary base comes first. GenerateVtableForBase(PrimaryBase, RD, rtti, methods, true, PrimaryBaseWasVirtual); |