This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Modify sanity check assert in AggExprEmitter::VisitInitListExpr to cover anonymous struct in a union GNU extension
ClosedPublic

Authored by shafik on Dec 3 2022, 2:43 PM.

Details

Summary

AggExprEmitter::VisitInitListExpr sanity checks that an empty union is really empty and not a semantic analysis failure. The assert is missing that we allow anonymous structs as a GNU extension. I have updated the assert to take that into account.

This fixes: https://github.com/llvm/llvm-project/issues/58800

Diff Detail

Event Timeline

shafik created this revision.Dec 3 2022, 2:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2022, 2:43 PM
shafik requested review of this revision.Dec 3 2022, 2:43 PM

I realize I am modifying codegen but the test is in sema, I am happy to move the test to somewhere more appropriate if someone has a good suggestion.

aaron.ballman accepted this revision.Dec 5 2022, 11:54 AM

LGTM with a formatting nit fixed, but you should add a release note for the fix when landing.

clang/lib/CodeGen/CGExprAgg.cpp
1688

Guessing at the way to solve the 80-col limit issue, but do whatever clang-format says.

This revision is now accepted and ready to land.Dec 5 2022, 11:54 AM
shafik updated this revision to Diff 484613.Dec 21 2022, 10:19 AM
  • Add Release note
clang/lib/CodeGen/CGExprAgg.cpp
1688

This is what clang-format likes.

This revision was landed with ongoing or failed builds.Dec 21 2022, 10:50 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 21 2022, 10:50 AM