From 3b908ce403318fbf38932c7ab566ed3a8d6ee85d Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 3 Dec 2009 02:41:55 +0000 Subject: [PATCH] Remove the index from the Thunk struct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90400 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGVtable.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index e76ae834af..007960e998 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -59,15 +59,11 @@ private: /// Thunk - Represents a single thunk. struct Thunk { - Thunk() - : Index(0) { } + Thunk() { } - Thunk(uint64_t Index, GlobalDecl GD, const ThunkAdjustment &Adjustment) - : Index(Index), GD(GD), Adjustment(Adjustment) { } + Thunk(GlobalDecl GD, const ThunkAdjustment &Adjustment) + : GD(GD), Adjustment(Adjustment) { } - /// Index - The index in the vtable. - uint64_t Index; - GlobalDecl GD; /// Adjustment - The thunk adjustment. @@ -298,16 +294,16 @@ public: for (ThunksMapTy::const_iterator i = Thunks.begin(), e = Thunks.end(); i != e; ++i) { - GlobalDecl GD = i->second.GD; + uint64_t Index = i->first; + const Thunk& Thunk = i->second; + + GlobalDecl GD = Thunk.GD; const CXXMethodDecl *MD = cast(GD.getDecl()); assert(!MD->isPure() && "Can't thunk pure virtual methods!"); - - const Thunk& Thunk = i->second; - uint64_t Index = Thunk.Index; assert(Index == VtableBuilder::Index[GD] && "Thunk index mismatch!"); - submethods[Thunk.Index] = CGM.BuildThunk(MD, Extern, Thunk.Adjustment); + submethods[Index] = CGM.BuildThunk(MD, Extern, Thunk.Adjustment); } Thunks.clear(); @@ -851,7 +847,7 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m, VirtualAdjustment); if (!isPure && !ThisAdjustment.isEmpty()) - Thunks[i] = Thunk(i, GD, ThisAdjustment); + Thunks[i] = Thunk(GD, ThisAdjustment); return true; } @@ -862,7 +858,7 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m, ThunkAdjustment ThisAdjustment(NonVirtualAdjustment, 0); if (!isPure) - Thunks[i] = Thunk(i, GD, ThisAdjustment); + Thunks[i] = Thunk(GD, ThisAdjustment); } return true; } -- 2.40.0