diff options
author | Anders Carlsson <andersca@mac.com> | 2010-05-02 23:53:25 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-05-02 23:53:25 +0000 |
commit | c11bb2191088b9e74bec5007a4e05c78b41a8f64 (patch) | |
tree | c98f1e98f1d5973da52a7d539babd27835c2ed06 | |
parent | fcaeef2ae00ec643eb024e0aca2c98701cf5627c (diff) |
Have getSubVTTIndex take a BaseSubobject instead of just a base.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102885 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/CGVTT.cpp | 4 | ||||
-rw-r--r-- | lib/CodeGen/CGVTables.h | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index 9c4ccc9fd0..93b1897583 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -473,7 +473,13 @@ static llvm::Value *GetVTTParameter(CodeGenFunction &CGF, GlobalDecl GD, assert(!ForVirtualBase && "Can't have same class as virtual base!"); SubVTTIndex = 0; } else { - SubVTTIndex = CGF.CGM.getVTables().getSubVTTIndex(RD, Base); + const ASTRecordLayout &Layout = + CGF.getContext().getASTRecordLayout(RD); + uint64_t BaseOffset = ForVirtualBase ? + Layout.getVBaseClassOffset(Base) : Layout.getBaseClassOffset(Base); + + SubVTTIndex = + CGF.CGM.getVTables().getSubVTTIndex(RD, BaseSubobject(Base, BaseOffset)); assert(SubVTTIndex != 0 && "Sub-VTT index must be greater than zero!"); } diff --git a/lib/CodeGen/CGVTT.cpp b/lib/CodeGen/CGVTT.cpp index 68bb655fcf..3118fa2f53 100644 --- a/lib/CodeGen/CGVTT.cpp +++ b/lib/CodeGen/CGVTT.cpp @@ -435,8 +435,8 @@ bool CodeGenVTables::needsVTTParameter(GlobalDecl GD) { } uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD, - const CXXRecordDecl *Base) { - ClassPairTy ClassPair(RD, Base); + BaseSubobject Base) { + ClassPairTy ClassPair(RD, Base.getBase()); SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassPair); if (I != SubVTTIndicies.end()) diff --git a/lib/CodeGen/CGVTables.h b/lib/CodeGen/CGVTables.h index bc113ec42f..3cfdb181f9 100644 --- a/lib/CodeGen/CGVTables.h +++ b/lib/CodeGen/CGVTables.h @@ -311,7 +311,7 @@ public: /// getSubVTTIndex - Return the index of the sub-VTT for the base class of the /// given record decl. - uint64_t getSubVTTIndex(const CXXRecordDecl *RD, const CXXRecordDecl *Base); + uint64_t getSubVTTIndex(const CXXRecordDecl *RD, BaseSubobject Base); /// getSecondaryVirtualPointerIndex - Return the index in the VTT where the /// virtual pointer for the given subobject is located. |