This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] unnamed bitfields should be discarded in InitListExpr
ClosedPublic

Authored by paulsemel on Feb 27 2023, 10:18 AM.

Details

Summary

There is a mapping issue between InitListExpr inits and RecordDecl's fields when dealing with Unnamed bitfields. Indeed, those are only used for padding, and thus are not appearing in InitlistExpr inits, which means we can off-by-one the fields to inits mapping while initializing struct's fields.

Diff Detail

Event Timeline

paulsemel created this revision.Feb 27 2023, 10:18 AM
paulsemel requested review of this revision.Feb 27 2023, 10:18 AM
paulsemel updated this revision to Diff 500887.
paulsemel updated this revision to Diff 500918.Feb 27 2023, 2:37 PM
paulsemel added a reviewer: xazax.hun.
paulsemel added inline comments.Feb 27 2023, 2:40 PM
clang/lib/Analysis/FlowSensitive/Transfer.cpp
739

Is there a better way to do this? I tried using llvm::make_filter_range instead, but it didn't seem to work well with llvm::zip...

Thanks for this fix! Would you mind expanding the description a bit? I had trouble understanding the details of the problem that is being addressed. Thanks!

clang/lib/Analysis/FlowSensitive/Transfer.cpp
735–743

Please comment indicating why you're dropping the unnamed bit fields.

clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
5101

Please add comment explaining why there is not contents to the lambda.

paulsemel updated this revision to Diff 501111.Feb 28 2023, 5:54 AM
paulsemel edited the summary of this revision. (Show Details)
paulsemel marked 2 inline comments as done.
ymandel accepted this revision.Feb 28 2023, 6:33 AM

Thanks!

clang/lib/Analysis/FlowSensitive/Transfer.cpp
735–743
This revision is now accepted and ready to land.Feb 28 2023, 6:33 AM
This revision was landed with ongoing or failed builds.Feb 28 2023, 7:43 AM
This revision was automatically updated to reflect the committed changes.