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

Anders Carlsson andersca at mac.com
Wed Dec 2 19:15:31 PST 2009


Author: andersca
Date: Wed Dec  2 21:15:31 2009
New Revision: 90402

URL: http://llvm.org/viewvc/llvm-project?rev=90402&view=rev
Log:
Use Eli's ComputeThunkAdjustment for calculating the return adjustment.

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=90402&r1=90401&r2=90402&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Wed Dec  2 21:15:31 2009
@@ -274,18 +274,20 @@
         
         Thunks.erase(i);
       }
-      
-      // Construct the return adjustment.
+
+      QualType BaseType = QualType(Thunk.ReturnType)->getPointeeType();
       QualType DerivedType = 
-        MD->getType()->getAs<FunctionType>()->getResultType();
+        MD->getType()->getAs<FunctionType>()->getResultType()->getPointeeType();
       
-      int64_t NonVirtualAdjustment = 
-        getNVOffset(Thunk.ReturnType, DerivedType) / 8;
+      const CXXRecordDecl *BaseDecl = 
+        cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
       
-      int64_t VirtualAdjustment = 
-        getVbaseOffset(Thunk.ReturnType, DerivedType);
+      const CXXRecordDecl *DerivedDecl = 
+        cast<CXXRecordDecl>(DerivedType->getAs<RecordType>()->getDecl());
       
-      ThunkAdjustment ReturnAdjustment(NonVirtualAdjustment, VirtualAdjustment);
+      // Construct the return adjustment.
+      ThunkAdjustment ReturnAdjustment = 
+        CGM.ComputeThunkAdjustment(DerivedDecl, BaseDecl);
       
       CovariantThunkAdjustment Adjustment(ThisAdjustment, ReturnAdjustment);
       submethods[Index] = CGM.BuildCovariantThunk(MD, Extern, Adjustment);
@@ -745,7 +747,7 @@
   }
   
   const CXXRecordDecl *DerivedDecl = 
-  cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
+    cast<CXXRecordDecl>(cast<RecordType>(CanDerivedType)->getDecl());
   
   const CXXRecordDecl *BaseDecl = 
   cast<CXXRecordDecl>(cast<RecordType>(CanBaseType)->getDecl());





More information about the cfe-commits mailing list