rsmith added inline comments.

================
Comment at: lib/AST/MicrosoftCXXABI.cpp:253
+
+  MPI.HasPadding = MPI.Width % MPI.Align == 0;
 
----------------
rsmith wrote:
> erichkeane wrote:
> > rsmith wrote:
> > > This seems to be backwards?
> > > 
> > > Also, I'm not sure whether this is correct. In the strange case where 
> > > `Width` is not a multiple of `Align` (because we don't round up the 
> > > width), there is no padding. We should only set `HasPadding` to `true` in 
> > > the `alignTo` case below.
> > I think you're right about it being backwards.
> > 
> > However, doesn't the struct with a single Ptr and either 1 or 3 Ints have 
> > tail padding as well?  I do believe you're right about the alignTo 
> > situation below, but only if Width changes, right?
> I think the idea is that a struct with one pointer and an odd number of ints, 
> on 32-bit Windows, will have no padding per se, but its size will simply not 
> be a multiple of its alignment. (So struct layout can put things in the four 
> bytes after it, but will insert padding before it to place it at an 8 byte 
> boundary.)
See example here: https://godbolt.org/g/Nr8C2L


https://reviews.llvm.org/D39347



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to