summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/override-layout.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`Aleksandr Urakov2019-03-131-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: 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. Reviewers: rnk, zturner, rsmith Reviewed By: rnk Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58544 llvm-svn: 356047
* Reland r230446, "MS ABI: Try to respect external AST source record layouts"Reid Kleckner2015-02-251-3/+3
| | | | | | | | | It broke test/PCH/headersearch.cpp because it was using -Wpadding, which only works for Itanium layout. Before this commit, we would use Itanium record layout when using PCH, which is crazy. Now that the test uses an explicit Itanium triple, we can reland. llvm-svn: 230525
* Revert r230446, "MS ABI: Try to respect external AST source record layouts"NAKAMURA Takumi2015-02-251-3/+3
| | | | | | It fails on Clang::PCH/headersearch.cpp for targeting msvc. llvm-svn: 230474
* MS ABI: Try to respect external AST source record layoutsReid Kleckner2015-02-251-3/+3
| | | | | | | | Covered by existing tests in test/CodeGen/override-layout.c and test/CodeGenCXX/override-layout.cpp. Seriously, they found real bugs in my code. :) llvm-svn: 230446
* Changes so that a few tests do not fail when running under guarded malloc.Argyrios Kyrtzidis2013-07-121-3/+3
| | | | | | | Guarded malloc emits some messages at the beginning in stderr when enabled. These messages caused a few tests to fail. llvm-svn: 186219
* When an externally-supplied record layout has a size that clearlyDouglas Gregor2012-10-261-1/+14
| | | | | | | | | | | doesn't include padding up to the alignment of the record, take this as a cue that the alignment of the record should (conservatively) be set to 1. This is similar to other the other cues we use to determine that the record has a lower alignment, e.g., that the externally-supplied layout places fields at lower offsets than we would. Fixes <rdar://problem/12582052>; test case in LLDB. llvm-svn: 166824
* Make sure that the layout-override parser grabs the size, not the dataDouglas Gregor2012-02-031-11/+25
| | | | | | size. Otherwise, we can end up with bogus layouts. llvm-svn: 149703
* Extend the ExternalASTSource interface to allow the AST source toDouglas Gregor2012-01-261-0/+50
provide the layout of records, rather than letting Clang compute the layout itself. LLDB provides the motivation for this feature: because various layout-altering attributes (packed, aligned, etc.) don't get reliably get placed into DWARF, the record layouts computed by LLDB from the reconstructed records differ from the actual layouts, and badness occurs. This interface lets the DWARF data drive layout, so we don't need the attributes preserved to get the answer write. The testing methodology for this change is fun. I've introduced a variant of -fdump-record-layouts called -fdump-record-layouts-simple that always has the simple C format and provides size/alignment/field offsets. There is also a -cc1 option -foverride-record-layout=<file> to take the output of -fdump-record-layouts-simple and parse it to produce a set of overridden layouts, which is introduced into the AST via a testing-only ExternalASTSource (called LayoutOverrideSource). Each test contains a number of records to lay out, which use various layout-changing attributes, and then dumps the layouts. We then run the test again, using the preprocessor to eliminate the layout-changing attributes entirely (which would give us different layouts for the records), but supplying the previously-computed record layouts. Finally, we diff the layouts produced from the two runs to be sure that they are identical. Note that this code makes the assumption that we don't *have* to provide the offsets of bases or virtual bases to get the layout right, because the alignment attributes don't affect it. I believe this assumption holds, but if it does not, we can extend LayoutOverrideSource to also provide base offset information. Fixes the Clang side of <rdar://problem/10169539>. llvm-svn: 149055
OpenPOWER on IntegriCloud