-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Refactor ExtInfo to use the builder pattern for construction. #33118
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 ExtInfo to use the builder pattern for construction. #33118
Conversation
7ebd1b4
to
b56f000
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b56f000
to
a93b5bf
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a93b5bf
to
b399a97
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0775c1e
to
9c35c66
Compare
e89d647
to
7187b8f
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Since the two ExtInfos share a common ClangTypeInfo, and C++ doesn't let us forward declare nested classes, we need to hoist out AnyFunctionType::ExtInfo and SILFunctionType::ExtInfo to the top-level. We also add some convenience APIs on (AST|SIL)ExtInfo for frequently used withXYZ methods. Note that all non-default construction still goes through the builder's build() method. We do not add any checks for invariants here; those will be added later.
In the future, we will remove the UseClangFunctionTypes language option, but we temporarily need the scaffolding for equality checks to be consistent in all places.
7187b8f
to
29188e3
Compare
Marked a bunch of things @swift-ci please smoke test |
@CodaFi any pending concerns/LGTY? |
Hi @varungandhi-apple – Thanks for doing this. Why were a bunch of methods made |
I don't follow why it should cause additional compile times unless we actually use the |
You might want to double check with your colleagues at Apple, but I think I remember one of them pointing out that |
Constant-folding at IR-generation time can take care of a lot of this, certainly. But there aren't really wild layers of |
I agree that these specific cases should be harmless. I think the point this colleague was trying to make was educational: one should prefer |
We could probably reduce some of the duplication with more helper methods that call.intoBuilder()
andbuild()
git-clang-format
had a bit of a field day with reformatting the surrounding code, so that's a bit unfortunate...The first commit in present in a separate PR. [NFC] Rename ExtInfo::Uncommon to ExtInfo::ClangTypeInfo. #33117