From: Anders Carlsson Date: Mon, 29 Mar 2010 02:53:58 +0000 (+0000) Subject: Only add thunks for the most derived class. This fixes some link errors I was seeing... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acfa6ae66e8b8bb83edc13e1e560fd14ad72f783;p=clang Only add thunks for the most derived class. This fixes some link errors I was seeing in files generated by the vtable tester utility. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99801 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 3322510815..f44b7ccb18 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -1803,8 +1803,9 @@ VtableBuilder::AddMethods(BaseSubobject Base, uint64_t BaseOffsetInLayoutClass, ComputeThisAdjustment(OverriddenMD, BaseOffsetInLayoutClass, Overrider); - if (ThisAdjustment.VCallOffsetOffset) { - // This is a virtual thunk, add it. + if (ThisAdjustment.VCallOffsetOffset && + Overrider.Method->getParent() == MostDerivedClass) { + // This is a virtual thunk for the most derived class, add it. AddThunk(Overrider.Method, ThunkInfo(ThisAdjustment, ReturnAdjustment())); }