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

Anders Carlsson andersca at mac.com
Sun May 2 17:55:11 PDT 2010


Author: andersca
Date: Sun May  2 19:55:11 2010
New Revision: 102890

URL: http://llvm.org/viewvc/llvm-project?rev=102890&view=rev
Log:
Store the entire base subobject in SubVTTIndices.

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

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=102890&r1=102889&r2=102890&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Sun May  2 19:55:11 2010
@@ -43,7 +43,7 @@
 
   /// SubVTTIndicies - The sub-VTT indices for the bases of the most derived
   /// class.
-  llvm::DenseMap<const CXXRecordDecl *, uint64_t> SubVTTIndicies;
+  llvm::DenseMap<BaseSubobject, uint64_t> SubVTTIndicies;
 
   /// SecondaryVirtualPointerIndices - The secondary virtual pointer indices of
   /// all subobjects of the most derived class.
@@ -116,8 +116,7 @@
   }
   
   /// getSubVTTIndicies - Returns a reference to the sub-VTT indices.
-  const llvm::DenseMap<const CXXRecordDecl *, uint64_t> &
-  getSubVTTIndicies() const {
+  const llvm::DenseMap<BaseSubobject, uint64_t> &getSubVTTIndicies() const {
     return SubVTTIndicies;
   }
   
@@ -341,7 +340,7 @@
 
   if (!IsPrimaryVTT) {
     // Remember the sub-VTT index.
-    SubVTTIndicies[RD] = VTTComponents.size();
+    SubVTTIndicies[Base] = VTTComponents.size();
   }
 
   AddressPointsMapTy AddressPoints;
@@ -436,24 +435,24 @@
 
 uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD, 
                                         BaseSubobject Base) {
-  ClassPairTy ClassPair(RD, Base.getBase());
+  BaseSubobjectPairTy ClassSubobjectPair(RD, Base);
 
-  SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassPair);
+  SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassSubobjectPair);
   if (I != SubVTTIndicies.end())
     return I->second;
   
   VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false);
 
-  for (llvm::DenseMap<const CXXRecordDecl *, uint64_t>::const_iterator I =
+  for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
        Builder.getSubVTTIndicies().begin(), 
        E = Builder.getSubVTTIndicies().end(); I != E; ++I) {
     // Insert all indices.
-    ClassPairTy ClassPair(RD, I->first);
+    BaseSubobjectPairTy ClassSubobjectPair(RD, I->first);
     
-    SubVTTIndicies.insert(std::make_pair(ClassPair, I->second));
+    SubVTTIndicies.insert(std::make_pair(ClassSubobjectPair, I->second));
   }
     
-  I = SubVTTIndicies.find(ClassPair);
+  I = SubVTTIndicies.find(ClassSubobjectPair);
   assert(I != SubVTTIndicies.end() && "Did not find index!");
   
   return I->second;

Modified: cfe/trunk/lib/CodeGen/CGVTables.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.h?rev=102890&r1=102889&r2=102890&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.h (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.h Sun May  2 19:55:11 2010
@@ -216,8 +216,8 @@
   /// integers are the vtable components.
   VTableLayoutMapTy VTableLayoutMap;
 
-  typedef llvm::DenseMap<std::pair<const CXXRecordDecl *, 
-                                   BaseSubobject>, uint64_t> AddressPointsMapTy;
+  typedef std::pair<const CXXRecordDecl *, BaseSubobject> BaseSubobjectPairTy;
+  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> AddressPointsMapTy;
   
   /// Address points - Address points for all vtables.
   AddressPointsMapTy AddressPoints;
@@ -247,14 +247,12 @@
     return &Components[1];
   }
 
-  typedef llvm::DenseMap<ClassPairTy, uint64_t> SubVTTIndiciesMapTy;
+  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> SubVTTIndiciesMapTy;
   
   /// SubVTTIndicies - Contains indices into the various sub-VTTs.
   SubVTTIndiciesMapTy SubVTTIndicies;
 
-   
-  typedef llvm::DenseMap<std::pair<const CXXRecordDecl *, 
-                                   BaseSubobject>, uint64_t>
+  typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t>
     SecondaryVirtualPointerIndicesMapTy;
 
   /// SecondaryVirtualPointerIndices - Contains the secondary virtual pointer





More information about the cfe-commits mailing list