Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type_graph: avoid overwriting explicitly set alignment #443

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

JakeHillion
Copy link
Contributor

type_graph: avoid overwriting explicitly set alignment

Previously AlignmentCalc calculates the alignment and sets packing for every
type except a member with explicit alignment. Change this to check whether an
alignment has been previously set for a type before calculating it. Use this in
ClangTypeParser where the full alignment of the type is available.

Remove explicitly aligning members by the type because that was previously
reserved for members with explicit alignment. AlignmentCalc will correctly
align a member to the underlying type without this. Explicit member alignment
is still missing, as before this change.

Test plan:

  • CI
  • Too little. Gets further into a production type than without this change.

@JakeHillion JakeHillion marked this pull request as ready for review December 22, 2023 17:01
@JakeHillion JakeHillion requested a review from ajor January 3, 2024 17:39
@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (31ba865) 62.50% compared to head (09dd1cb) 62.48%.

Files Patch % Lines
oi/type_graph/AlignmentCalc.cpp 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
- Coverage   62.50%   62.48%   -0.02%     
==========================================
  Files         123      123              
  Lines       12067    12068       +1     
  Branches     1965     1966       +1     
==========================================
- Hits         7542     7541       -1     
- Misses       3571     3572       +1     
- Partials      954      955       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JakeHillion JakeHillion requested a review from arsarwade January 16, 2024 19:13
Previously AlignmentCalc calculates the alignment and sets packing for every
type except a member with explicit alignment. Change this to check whether an
alignment has been previously set for a type before calculating it. Use this in
ClangTypeParser where the full alignment of the type is available.

Remove explicitly aligning members by the type because that was previously
reserved for members with explicit alignment. AlignmentCalc will correctly
align a member to the underlying type without this. Explicit member alignment
is still missing, as before this change.

Test plan:
- CI
- Too little. Gets further into a production type than without this change.
Copy link
Contributor

@ajor ajor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No tests for ClangTypeParser? 😢

@JakeHillion
Copy link
Contributor Author

No tests for ClangTypeParser? 😢

Unfortunately not... I was hoping to enable all the integration tests and get coverage that way then add unit tests later. The integration tests PR is stalled because of the build system stuff so I might look into adding unit tests similar to DrgnParser next week - it's also not trivial though because it needs the compilation command of the integration test target and not just the compiled binary from CMake.

@JakeHillion JakeHillion merged commit 7eebee2 into facebookexperimental:main Jan 18, 2024
11 checks passed
@JakeHillion JakeHillion deleted the pr443 branch January 18, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants