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

John McCall rjmccall at apple.com
Tue Mar 26 15:58:35 PDT 2013


On Mar 26, 2013, at 3:28 PM, Reid Kleckner <rnk at google.com> wrote:
> On Tue, Mar 26, 2013 at 3:02 PM, John McCall <rjmccall at apple.com> wrote:
> On Mar 26, 2013, at 2:46 PM, Reid Kleckner <rnk at google.com> wrote:
>> +    RequireCompleteType(Loc, Class, 0);
>> 
>> This would be an excellent opportunity to implicitly add your
>> UnspecifiedInheritanceAttr to all the existing declarations. :)
>> 
>> Is it OK if I just implicitly add the right attribute if there isn't one present already?  I suppose the unspecified model is the only one that I need to add for correctness.
>> 
>> It's actually important to lock this in at some point so we don't have different sizes at different TU points.  In MSVC, if you declare a member pointer variable before the class definition, it uses the unspecified model.  If you wait until after the definition, it will pick a more restrictive model.
> 
> Yeah, I saw your comment to this effect earlier.  I think adding UnspecifiedInheritanceAttr when you make a member pointer for a forward-declared class that lacks an explicit inheritance attribute makes sense.  I wouldn't go down the road of adding, say, SingleInheritanceAttr to every class with single inheritance.
> 
> For sanity's sake, please add the attribute to all the existing declarations, though.
> 
> I'm not 100% clear on what you mean.  I added a SingleInheritanceAttr to every class that uses member pointers, but you're right this is kind of spammy and uses extra memory when we can easily check the class hierarchy later.
> 
> Should I remove those attrs, and only ever add the Unspecified attr?

Yes, I would change this to only ever add artificial Unspecified attributes.

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


More information about the cfe-commits mailing list