Work-in-progess rewrite of thunks: move thunk generation outside of vtable
generation, and make sure we generate thunks when the function is defined
rather than when the vtable is defined.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90722 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGVtable.h b/lib/CodeGen/CGVtable.h
index fd7a486..1507725 100644
--- a/lib/CodeGen/CGVtable.h
+++ b/lib/CodeGen/CGVtable.h
@@ -15,6 +15,7 @@
 #define CLANG_CODEGEN_CGVTABLE_H
 
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/GlobalVariable.h"
 #include "GlobalDecl.h"
 
@@ -83,6 +84,11 @@
   /// pointers in the vtable for a given record decl.
   llvm::DenseMap<const CXXRecordDecl *, uint64_t> NumVirtualFunctionPointers;
 
+  typedef llvm::DenseMap<std::pair<GlobalDecl, GlobalDecl>,
+                         ThunkAdjustment> SavedThisAdjustmentsTy;
+  SavedThisAdjustmentsTy SavedThisAdjustments;
+  llvm::DenseSet<const CXXRecordDecl*> SavedThisAdjustmentRecords;
+
   /// getNumVirtualFunctionPointers - Return the number of virtual function
   /// pointers in the vtable for a given record decl.
   uint64_t getNumVirtualFunctionPointers(const CXXRecordDecl *RD);
@@ -122,6 +128,8 @@
   int64_t getVirtualBaseOffsetIndex(const CXXRecordDecl *RD,
                                     const CXXRecordDecl *VBase);
 
+  ThunkAdjustment getThisAdjustment(GlobalDecl GD, GlobalDecl OGD);
+
   /// getVtableAddressPoint - returns the address point of the vtable for the
   /// given record decl.
   /// FIXME: This should return a list of address points.