File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2401,6 +2401,10 @@ class ConstraintSystem {
2401
2401
llvm::DenseMap<std::pair<TypeBase *, ProtocolDecl *>, ProtocolConformanceRef>
2402
2402
Conformances;
2403
2403
2404
+ // / A cache for unavailability checks peformed by the solver.
2405
+ llvm::DenseMap<std::pair<const Decl *, ConstraintLocator *>, bool >
2406
+ UnavailableDecls;
2407
+
2404
2408
// / The list of all generic requirements fixed along the current
2405
2409
// / solver path.
2406
2410
using FixedRequirement =
Original file line number Diff line number Diff line change @@ -4810,13 +4810,20 @@ void ConstraintSystem::diagnoseFailureFor(SyntacticElementTarget target) {
4810
4810
4811
4811
bool ConstraintSystem::isDeclUnavailable (const Decl *D,
4812
4812
ConstraintLocator *locator) const {
4813
+ auto found = UnavailableDecls.find (std::make_pair (D, locator));
4814
+ if (found != UnavailableDecls.end ())
4815
+ return found->second ;
4816
+
4813
4817
SourceLoc loc;
4814
4818
if (locator) {
4815
4819
if (auto anchor = locator->getAnchor ())
4816
4820
loc = getLoc (anchor);
4817
4821
}
4818
4822
4819
- return getUnsatisfiedAvailabilityConstraint (D, DC, loc).has_value ();
4823
+ auto result = getUnsatisfiedAvailabilityConstraint (D, DC, loc).has_value ();
4824
+ const_cast <ConstraintSystem *>(this )->UnavailableDecls .insert (
4825
+ std::make_pair (std::make_pair (D, locator), result));
4826
+ return result;
4820
4827
}
4821
4828
4822
4829
bool ConstraintSystem::isConformanceUnavailable (ProtocolConformanceRef conformance,
You can’t perform that action at this time.
0 commit comments