[PATCH] Add MicrosoftVFTableContext to AST

John McCall rjmccall at apple.com
Thu Jul 25 14:14:31 PDT 2013

On Jul 25, 2013, at 10:16 AM, Timur Iskhodzhanov <timurrrr at google.com> wrote:
>  Fixed wording in one of the comments.

+visitAllOverriddenMethods(const CXXMethodDecl *MD,
+                          VisitorTy &Visitor,
+                          OverriddenMethodsSetTy &VisitedMethods) {

Don’t have this take VisitedMethods.  Make the visitor that cares about
collecting methods collect them.

-ComputeAllOverriddenMethods(const CXXMethodDecl *MD,
-                            OverriddenMethodsSetTy& OverriddenMethods) {

You can actually leave this function around if you like.  It’s just:

namespace {
  struct MethodCollector {
    OverriddenMethodsSetTy *Methods;
    bool visit(const CXXMethodDecl *MD) {
      return true;
void ComputeAllOverriddenMethods(const CXXMethodDecl *MD,
                            OverriddenMethodsSetTy& OverriddenMethods) {
  MethodCollector collector = { &OverriddenMethods };
  visitAllOverriddenMethods(MD, collector);

+static const CXXMethodDecl *
 FindNearestOverriddenMethod(const CXXMethodDecl *MD,
-                            VTableBuilder::PrimaryBasesSetVectorTy &Bases) {
+                            BasesSetVectorTy &Bases) {

Sorry, I didn’t mean to ask you to rewrite this algorithm; I just wanted a way to
re-use the recursive visitation without redundantly copying them out into an array
if that wasn’t needed.

+    ThisAdjustment ThisAdjustmentOffset;
+    // Check if this virtual member function overrides
+    // a method in one of the visited bases.
+    if (const CXXMethodDecl *OverriddenMD =
+            FindDirectlyOverriddenMethodInBases(MD, VisitedBases)) {
+      // Replace the method info of the overridden method with our own
+      // method - only if it's in the vftable we're laying out.
+      MethodInfoMapTy::iterator OverriddenMDIterator =

I’m confused about what’s actually going into MethodInfoMap and what
needs to be replaced, exactly.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130725/f9309863/attachment.html>

More information about the cfe-commits mailing list