-
Notifications
You must be signed in to change notification settings - Fork 100
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
[ClangIR][CIRGen] Handle nested union in arrays of struct #1007
[ClangIR][CIRGen] Handle nested union in arrays of struct #1007
Conversation
Just a heads up: I usually don't review patches failing to pass tests, let me know when this is ready |
(Triggering rerunning) |
@bcardosolopes the CI is green now |
I'm working on adding an |
Yes, this was the reason I called it as a |
I think one motivating example may be, if in some transformation we changed the init of a union into a undef, then it looks slightly prettier:
than
at least we know the expected initialized field. |
Yeah, that makes sense to me, though I'll wait for Bruno to weigh in too :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! Comments inline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, one more round of reviews
looks like new CI failures! |
949f67d
to
55374fa
Compare
It looks like the windows failure is not relevant. |
Reproducer:
ClangIR now failed to recognize
data
as an array since it failed to recognize the initializer for union. This comes from a fundamental difference between CIR and LLVM IR. In LLVM IR, the union is simply a struct with the largest member. So it is fine to have only one init element. But in CIR, the union has the information for all members. So if we only pass a single init element, we may be in trouble. We solve the problem by appending placeholder attribute for the uninitialized fields.