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

Refactor ReturnTypeInfo and InitRepr. #4169

Merged
merged 11 commits into from
Jul 25, 2024

Conversation

zygoloid
Copy link
Contributor

Rename ReturnInfo to ReturnTypeInfo. Move it and InitRepr into type_info.h alongside ValueRepr. Replace ReturnSlot with InitRepr, and extend InitRepr to be able to represent the incomplete-type case instead of CHECK-failing. Remove has_return_slot from InitRepr and instead only provide that as part of ReturnTypeInfo.

@github-actions github-actions bot requested a review from jonmeow July 25, 2024 21:08
Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to merge when you're comfortable (unless you do a big refactor again, I guess)

};

// Returns information about the initializing representation to use for a type.
auto GetInitRepr(const File& file, TypeId type_id) -> InitRepr;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be InitRepr::ForType similar to below? (plus, member functions for factories makes sense to me)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 78 to 82
auto GetReturnTypeInfo(const File& file,
SpecificId specific_id = SpecificId::Invalid) const
-> ReturnTypeInfo {
return ReturnTypeInfo::ForType(file,
GetDeclaredReturnType(file, specific_id));
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, if it worked, maybe ReturnTypeInfo::ForFunction instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@zygoloid zygoloid enabled auto-merge July 25, 2024 21:33
@zygoloid zygoloid added this pull request to the merge queue Jul 25, 2024
Merged via the queue into carbon-language:trunk with commit 37a8bfa Jul 25, 2024
7 checks passed
@zygoloid zygoloid deleted the toolchain-generic-10 branch July 25, 2024 21:51
brymer-meneses pushed a commit to brymer-meneses/carbon-lang that referenced this pull request Aug 15, 2024
Rename `ReturnInfo` to `ReturnTypeInfo`. Move it and `InitRepr` into
`type_info.h` alongside `ValueRepr`. Replace `ReturnSlot` with
`InitRepr`, and extend `InitRepr` to be able to represent the
incomplete-type case instead of CHECK-failing. Remove `has_return_slot`
from `InitRepr` and instead only provide that as part of
`ReturnTypeInfo`.
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.

2 participants