[cfe-commits] r102885 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CGVTT.cpp CGVTables.h

Anders Carlsson andersca at mac.com
Sun May 2 16:53:25 PDT 2010


Author: andersca
Date: Sun May  2 18:53:25 2010
New Revision: 102885

URL: http://llvm.org/viewvc/llvm-project?rev=102885&view=rev
Log:
Have getSubVTTIndex take a BaseSubobject instead of just a base.

Modified:
    cfe/trunk/lib/CodeGen/CGClass.cpp
    cfe/trunk/lib/CodeGen/CGVTT.cpp
    cfe/trunk/lib/CodeGen/CGVTables.h

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=102885&r1=102884&r2=102885&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sun May  2 18:53:25 2010
@@ -473,7 +473,13 @@
     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!");
   }
   

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=102885&r1=102884&r2=102885&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Sun May  2 18:53:25 2010
@@ -435,8 +435,8 @@
 }
 
 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())

Modified: cfe/trunk/lib/CodeGen/CGVTables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.h?rev=102885&r1=102884&r2=102885&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.h (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.h Sun May  2 18:53:25 2010
@@ -311,7 +311,7 @@
 
   /// 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.





More information about the cfe-commits mailing list