From d6f7af5087ff637d559b815f5f2dd748677185da Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 3 Dec 2009 02:12:03 +0000 Subject: [PATCH] Change the CovariantThunk map to use the vtable index as its key. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90391 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGVtable.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index be9c85ad44..45b8be937c 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -84,7 +84,7 @@ private: 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 @@ private: }; /// CovariantThunks - The covariant thunks in a vtable. - typedef llvm::DenseMap CovariantThunksMapTy; + typedef llvm::DenseMap CovariantThunksMapTy; CovariantThunksMapTy CovariantThunks; /// PureVirtualMethods - Pure virtual methods. @@ -269,7 +269,7 @@ public: 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(GD.getDecl()); if (MD->isPure()) continue; @@ -717,10 +717,10 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m, 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 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m, // 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 @@ bool VtableBuilder::OverrideMethod(GlobalDecl GD, llvm::Constant *m, ThunkAdjustment ThisAdjustment(NonVirtualAdjustment, 0); if (!ReturnAdjustment.isEmpty()) - CovariantThunks[GD] = + CovariantThunks[i] = CovariantThunk(i, GD, ReturnAdjustment, oret); if (!isPure) -- 2.40.0