-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Requestify LifetimeDependenceInfo #72916
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
Conversation
Query and cache lifetime dependence info via evaluator requests
9514caa
to
d576e1d
Compare
@swift-ci test |
@swift-ci build toolchain |
d576e1d
to
afd2052
Compare
@swift-ci smoke test |
} | ||
|
||
std::optional<LifetimeDependenceInfo> | ||
LifetimeDependenceInfo::infer(AbstractFunctionDecl *afd, Type resultType) { | ||
LifetimeDependenceInfo::infer(AbstractFunctionDecl *afd) { |
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.
In a subsequent PR, please refactor this logic so that LifetimeDependence methods are implemented in AST. Perhaps these functions can just be static, if they're only used in the implementation of the request evaluate() method?
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.
Will do.
@@ -3098,3 +3097,9 @@ ImplicitKnownProtocolConformanceRequest::evaluate(Evaluator &evaluator, | |||
llvm_unreachable("non-implicitly derived KnownProtocol"); | |||
} | |||
} | |||
|
|||
std::optional<LifetimeDependenceInfo> | |||
LifetimeDependenceInfoRequest::evaluate(Evaluator &evaluator, |
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.
You can move this into lib/Sema/LifetimeDependence.cpp, and turn LifetimeDependence::get() into a static method
Should this be cherry-picked to 6.0? Or is it too intrusive a change? |
Use the request evaluator method to query LifetimeDependenceInfo
With this change, LifetimeDependenceInfo is serialized in both explicit and inferred cases. And on deserialization, LifetimeDependenceInfo is cached on the decl, so that InterfaceTypeRequest does not have to recompute this info.
Also piggybacking some minor changes.