Page MenuHomePhabricator

[clang] Add cc1 option for dumping layout for all complete types
ClosedPublic

Authored by daltenty on Jun 17 2021, 1:09 PM.

Details

Summary

This change adds an option which, in addition to dumping the record
layout as is done by -fdump-record-layouts, causes us to compute the
layout for all complete record types (rather than the as-needed basis
which is usually done by clang), so that we will dump them as well.
This is useful if we are looking for layout differences across large
code bases without needing to instantiate every type we are interested in.

Diff Detail

Event Timeline

daltenty created this revision.Jun 17 2021, 1:09 PM
daltenty requested review of this revision.Jun 17 2021, 1:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2021, 1:09 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dexonsmith added inline comments.Jun 17 2021, 1:28 PM
clang/lib/AST/Decl.cpp
4585

Nit: please add whitespace around =. (Have you run git-clang-format? That should fix this.)

4586

Probably this deserves a comment, explaining that computing the record layout has a side effect of dumping it.

Nit: I think we usually skip braces for one-line if statements.

4587

Might be reasonable to cast to (void) rather than assigning to an ignored variable.

daltenty updated this revision to Diff 353636.Jun 22 2021, 7:02 AM
  • clang-format
  • Address comments
daltenty marked 3 inline comments as done.Jun 22 2021, 7:03 AM
This revision is now accepted and ready to land.Jun 22 2021, 11:31 AM

This breaks check-clang: http://45.33.8.238/linux/49502/step_7.txt

Please take a look and revert for now if it takes a while to fix. It's been a pretty rough day for the tree.

Probably the "need to bump AST serialization Version after adding a langopt" thing again?