[PATCH] [ms-cxxabi] Correctly compute the size of member pointers

John McCall rjmccall at apple.com
Thu Mar 28 11:00:27 PDT 2013


On Mar 27, 2013, at 6:38 PM, Reid Kleckner <rnk at google.com> wrote:
>    - Split function member pointer case from data case.
> 
> Hi rjmccall,
> 
> http://llvm-reviews.chandlerc.com/D568
> 
> CHANGE SINCE LAST DIFF
>  http://llvm-reviews.chandlerc.com/D568?vs=1406&id=1416#toc

+        RD->addAttr(::new (Context) UnspecifiedInheritanceAttr(
+            RD->getSourceRange(), Context));

For sanity's sake, you need to add this to all the declarations.  RD here
is likely to be only the first redeclaration, so I suspect you'll get this wrong
if you have:

  struct A; // this will get the UnspecifiedInheritanceAttr
  struct A; // but this won't
  int A::*mptr = 0; // this should have size 12
  struct A { // this becomes the RD in the type but has failed to inherit the attribute
    int x, y, z;
  };
  int A::*mptr2 = 0; // this should have size 12, but probably has size 4

John.



More information about the cfe-commits mailing list