[cfe-commits] r90391 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Wed Dec 2 18:12:04 PST 2009


Author: andersca
Date: Wed Dec  2 20:12:03 2009
New Revision: 90391

URL: http://llvm.org/viewvc/llvm-project?rev=90391&view=rev
Log:
Change the CovariantThunk map to use the vtable index as its key.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=90391&r1=90390&r2=90391&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Wed Dec  2 20:12:03 2009
@@ -84,7 +84,7 @@
     CovariantThunk(uint64_t Index, GlobalDecl GD,
                    const ThunkAdjustment &ReturnAdjustment, 
                    CanQualType ReturnType) 
-      : Index(Index), ReturnAdjustment(ReturnAdjustment), 
+      : Index(Index), GD(GD), ReturnAdjustment(ReturnAdjustment), 
       ReturnType(ReturnType) { }
     
     // Index - The index in the vtable.
@@ -100,7 +100,7 @@
   };
   
   /// CovariantThunks - The covariant thunks in a vtable.
-  typedef llvm::DenseMap<GlobalDecl, CovariantThunk> CovariantThunksMapTy;
+  typedef llvm::DenseMap<uint64_t, CovariantThunk> CovariantThunksMapTy;
   CovariantThunksMapTy CovariantThunks;
   
   /// PureVirtualMethods - Pure virtual methods.
@@ -269,7 +269,7 @@
   void InstallThunks() {
     for (CovariantThunksMapTy::const_iterator i = CovariantThunks.begin(),
          e = CovariantThunks.end(); i != e; ++i) {
-      GlobalDecl GD = i->first;
+      GlobalDecl GD = i->second.GD;
       const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
       if (MD->isPure())
         continue;
@@ -717,10 +717,10 @@
       ThunkAdjustment ReturnAdjustment;
       if (oret != ret) {
         // FIXME: calculate offsets for covariance
-        CovariantThunksMapTy::iterator i = CovariantThunks.find(OMD);
-        if (i != CovariantThunks.end()) {
-          oret = i->second.ReturnType;
-          CovariantThunks.erase(i);
+        CovariantThunksMapTy::iterator it = CovariantThunks.find(i);
+        if (it != CovariantThunks.end()) {
+          oret = it->second.ReturnType;
+          CovariantThunks.erase(it);
         }
         // FIXME: Double check oret
         Index_t nv = getNVOffset(oret, ret)/8;
@@ -765,7 +765,7 @@
         // FIXME: Do we always have to build a covariant thunk to save oret,
         // which is the containing virtual base class?
         if (!ReturnAdjustment.isEmpty())
-          CovariantThunks[GD] = CovariantThunk(i, GD, ReturnAdjustment, oret);
+          CovariantThunks[i] = CovariantThunk(i, GD, ReturnAdjustment, oret);
 
         if (!isPure && !ThisAdjustment.isEmpty())
           Thunks[GD] = Thunk(i, ThisAdjustment);
@@ -779,7 +779,7 @@
         ThunkAdjustment ThisAdjustment(NonVirtualAdjustment, 0);
         
         if (!ReturnAdjustment.isEmpty())
-          CovariantThunks[GD] = 
+          CovariantThunks[i] = 
             CovariantThunk(i, GD, ReturnAdjustment, oret);
 
         if (!isPure)





More information about the cfe-commits mailing list