[PATCH] Fix vbtable indices if a class shares the vbptr with a non-virtual base

Reid Kleckner rnk at google.com
Mon Nov 4 09:52:05 PST 2013


  Looks good!


================
Comment at: lib/AST/VTableBuilder.cpp:3314-3316
@@ +3313,5 @@
+    const ASTRecordLayout &BaseLayout = Context.getASTRecordLayout(CurBase);
+    if (!BaseLayout.hasVBPtr() ||
+        DerivedVBPtrOffset != BaseOffset + BaseLayout.getVBPtrOffset())
+      break;
+
----------------
I think this can just be:

  if (CurBase->getNumVBases() == 0)
    continue;

No need to get the ASTRecordLayout of the nvbases.

================
Comment at: include/clang/AST/VTableBuilder.h:462
@@ +461,3 @@
+  typedef llvm::SmallSetVector<const CXXRecordDecl *, 8> BasesSetVectorTy;
+  void EnumerateVFPtrs(const CXXRecordDecl *MostDerivedClass,
+                       const ASTRecordLayout &MostDerivedClassLayout,
----------------
Start with lowercase 'e' to match the new conventions?

================
Comment at: include/clang/AST/VTableBuilder.h:469
@@ +468,3 @@
+
+  void EnumerateVFPtrs(const CXXRecordDecl *ForClass,
+                       MicrosoftVTableContext::VFPtrListTy &Result);
----------------
ditto


http://llvm-reviews.chandlerc.com/D2089



More information about the cfe-commits mailing list