[PATCH] D58544: [AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`

Aleksandr Urakov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 22 04:30:13 PST 2019


aleksandr.urakov created this revision.
aleksandr.urakov added reviewers: rnk, zturner, rsmith.
aleksandr.urakov added a project: clang.
Herald added subscribers: cfe-commits, jdoerfert.

This patch fixes several small problems with external layouts support in `MicrosoftRecordLayoutBuilder`:

- aligns properly the size of a struct that ends with a bit field. It was aligned on byte before, not on the size of the field, so the struct size was smaller than it should be;
- adjusts the struct size when injecting a vbptr in the case when there were no bases or fields allocated after the vbptr. Similarly, without the adjustment the struct was smaller than it should be;
- the same fix as above for the vfptr.

All these fixes affect the non-virtual size of a struct, so they are tested through non-virtual inheritance.


Repository:
  rC Clang

https://reviews.llvm.org/D58544

Files:
  lib/AST/RecordLayoutBuilder.cpp
  test/CodeGenCXX/Inputs/override-bit-field-layout.layout
  test/CodeGenCXX/Inputs/override-layout-virtual-base.layout
  test/CodeGenCXX/override-bit-field-layout.cpp
  test/CodeGenCXX/override-layout-virtual-base.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58544.187922.patch
Type: text/x-patch
Size: 4475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190222/6951ef52/attachment-0001.bin>


More information about the cfe-commits mailing list