On Fri, Mar 22, 2013 at 1:46 PM, John McCall <[email protected]> wrote:

>
> On Mar 22, 2013, at 12:02 PM, Reid Kleckner <[email protected]> wrote:
>
> > Author: rnk
> > Date: Fri Mar 22 14:02:54 2013
> > New Revision: 177753
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=177753&view=rev
> > Log:
> > [ms-cxxabi] Implement member data pointers for non-dynamic classes
> >
> > Summary:
> > For non-dynamic classes (no virtual bases), member data pointers are
> > simple offsets from the base of the record.  Dynamic classes use an
> > aggregate for member data pointers and are therefore currently
> > unsupported.
> >
> > Unlike Itanium, the ms ABI uses 0 to represent null for polymorphic
> > classes.  Non-polymorphic classes use -1 like Itanium, since 0 is a
> > valid field offset.
>
> Oh, you should also implement isZeroInitializable.


I looked into this, and MSVC seems to zero-initialize most things
regardless of the null representation.

For example:
struct POD { int a; };
int POD::*pod_memptr;  // should be -1, but goes into .bss and becomes 0
int POD::*null_memptr = 0;  // gets -1 and goes into .data as expected

But we probably don't have to be bug-for-bug compatible here.  IMO the
right thing is to use -1 and .data for this case.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to