diff options
author | Anders Carlsson <andersca@mac.com> | 2010-03-29 01:04:16 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-03-29 01:04:16 +0000 |
commit | 8baeaf0a267cd1a78e83691a740bb63ed575496a (patch) | |
tree | 66fa08fadd1297f686b29f085274fafe6c8e88c4 /clang/lib/CodeGen | |
parent | 3e69c3ed311760e6e2aae5b32793b50aae5a1843 (diff) | |
download | bcm5719-llvm-8baeaf0a267cd1a78e83691a740bb63ed575496a.tar.gz bcm5719-llvm-8baeaf0a267cd1a78e83691a740bb63ed575496a.zip |
Two bug fixes, we weren't updating the thunk index when creating the vtable initializer and we weren't storing the secondary virtual pointer indices.
llvm-svn: 99786
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGVTT.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGVtable.cpp | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGVTT.cpp b/clang/lib/CodeGen/CGVTT.cpp index f2b2945290a..6b21046b4c7 100644 --- a/clang/lib/CodeGen/CGVTT.cpp +++ b/clang/lib/CodeGen/CGVTT.cpp @@ -165,6 +165,13 @@ VTTBuilder::GetAddrOfVTable(BaseSubobject Base, bool BaseIsVirtual, void VTTBuilder::AddVTablePointer(BaseSubobject Base, llvm::Constant *VTable, const CXXRecordDecl *VTableClass, const AddressPointsMapTy& AddressPoints) { + // Store the vtable pointer index if we're generating the primary VTT. + if (Base.getBase() == MostDerivedClass) { + assert(!SecondaryVirtualPointerIndices.count(Base) && + "A virtual pointer index already exists for this base subobject!"); + SecondaryVirtualPointerIndices[Base] = VTTComponents.size(); + } + if (!GenerateDefinition) { VTTComponents.push_back(0); return; diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 4bdda985aa7..804c6843618 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -4080,6 +4080,8 @@ CodeGenVTables::CreateVTableInitializer(const CXXRecordDecl *RD, const ThunkInfo &Thunk = VTableThunks[NextVTableThunkIndex].second; Init = CGM.GetAddrOfThunk(GD, Thunk); + + NextVTableThunkIndex++; } else { const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl()); const llvm::Type *Ty = CGM.getTypes().GetFunctionTypeForVtable(MD); |