[PATCH] D11859: Generating vptr assume loads

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 20:10:09 PDT 2015


Prazek added inline comments.

================
Comment at: lib/CodeGen/CodeGenFunction.h:1328-1334
@@ -1320,8 +1327,9 @@
   typedef llvm::SmallPtrSet<const CXXRecordDecl *, 4> VisitedVirtualBasesSetTy;
-  void InitializeVTablePointers(BaseSubobject Base,
-                                const CXXRecordDecl *NearestVBase,
-                                CharUnits OffsetFromNearestVBase,
-                                bool BaseIsNonVirtualPrimaryBase,
-                                const CXXRecordDecl *VTableClass,
-                                VisitedVirtualBasesSetTy& VBases);
+  VPtrsVector getVTablePointers(const CXXRecordDecl *VTableClass);
+
+  void getVTablePointers(BaseSubobject Base, const CXXRecordDecl *NearestVBase,
+                         CharUnits OffsetFromNearestVBase,
+                         bool BaseIsNonVirtualPrimaryBase,
+                         const CXXRecordDecl *VTableClass,
+                         VisitedVirtualBasesSetTy &VBases, VPtrsVector &vptrs);
 
----------------
majnemer wrote:
> Would it make more sense for these to live in `CGClass` ?
What do You mean? These functions are defined in CGClass.cpp 

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:223-228
@@ +222,8 @@
+  // with the 'novtable' attribute.
+  bool canInitilizeVPtr(const CXXRecordDecl *VTableClass,
+                        const CXXRecordDecl *Base,
+                        const CXXRecordDecl *NearestVBase) override {
+    return !VTableClass->hasAttr<MSNoVTableAttr>() ||
+           (Base != VTableClass && Base != NearestVBase);
+  }
+
----------------
Prazek wrote:
> majnemer wrote:
> > In the MS ABI, derived classes never share vtables with bases.  Why do you need to do anything other than check that the most derived class doesn't have the `__declspec(novtable)` ?
> I don't know, I just took previous code assuming it is correct.
ok, I see. I just took code that suposed to work with microsoft and itanium abi. You are right


http://reviews.llvm.org/D11859





More information about the cfe-commits mailing list