r177753 - [ms-cxxabi] Implement member data pointers for non-dynamic classes
Reid Kleckner
rnk at google.com
Fri Mar 29 09:20:18 PDT 2013
On Fri, Mar 22, 2013 at 1:46 PM, John McCall <rjmccall at apple.com> wrote:
>
> On Mar 22, 2013, at 12:02 PM, Reid Kleckner <reid at kleckner.net> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130329/9ee8ef7d/attachment.html>
More information about the cfe-commits
mailing list