Skip to content

Commit 02aed9a

Browse files
committed
Sema: Unconditionally cache property wrapper-related requests
1 parent 79a6aac commit 02aed9a

File tree

2 files changed

+9
-60
lines changed

2 files changed

+9
-60
lines changed

include/swift/AST/TypeCheckRequests.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ class PropertyWrapperTypeInfoRequest
606606

607607
public:
608608
// Caching
609-
bool isCached() const;
609+
bool isCached() const { return true; }
610610
};
611611

612612
/// Request the nominal type declaration to which the given custom attribute
@@ -627,7 +627,7 @@ class AttachedPropertyWrappersRequest :
627627

628628
public:
629629
// Caching
630-
bool isCached() const;
630+
bool isCached() const { return true; }
631631
};
632632

633633
/// Request the raw (possibly unbound generic) type of the property wrapper
@@ -648,7 +648,7 @@ class AttachedPropertyWrapperTypeRequest :
648648

649649
public:
650650
// Caching
651-
bool isCached() const;
651+
bool isCached() const { return true; }
652652
};
653653

654654
/// Request the nominal type declaration to which the given custom attribute
@@ -669,7 +669,7 @@ class PropertyWrapperBackingPropertyTypeRequest :
669669

670670
public:
671671
// Caching
672-
bool isCached() const;
672+
bool isCached() const { return true; }
673673
};
674674

675675
/// Request information about the mutability of composed property wrappers.
@@ -689,7 +689,7 @@ class PropertyWrapperMutabilityRequest :
689689

690690
public:
691691
// Caching
692-
bool isCached() const;
692+
bool isCached() const { return true; }
693693
};
694694

695695
/// Request information about the l-valueness of composed property wrappers.
@@ -709,7 +709,7 @@ class PropertyWrapperLValuenessRequest :
709709

710710
public:
711711
// Caching
712-
bool isCached() const;
712+
bool isCached() const { return true; }
713713
};
714714

715715
/// Request the synthesized auxiliary declarations for a wrapped property.
@@ -729,7 +729,7 @@ class PropertyWrapperAuxiliaryVariablesRequest :
729729

730730
public:
731731
// Caching
732-
bool isCached() const;
732+
bool isCached() const { return true; }
733733
};
734734

735735
/// Request information about initialization of the backing property
@@ -750,7 +750,7 @@ class PropertyWrapperInitializerInfoRequest :
750750

751751
public:
752752
// Caching
753-
bool isCached() const;
753+
bool isCached() const { return true; }
754754
};
755755

756756
/// Retrieve the structural type of an alias type.
@@ -833,7 +833,7 @@ class AttachedResultBuilderRequest :
833833

834834
public:
835835
// Caching
836-
bool isCached() const;
836+
bool isCached() const { return true; }
837837
};
838838

839839
/// Request the result builder type attached to the given declaration,

lib/AST/TypeCheckRequests.cpp

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -468,47 +468,6 @@ void DefaultTypeRequest::cacheResult(Type value) const {
468468
cacheEntry = value;
469469
}
470470

471-
bool PropertyWrapperTypeInfoRequest::isCached() const {
472-
auto nominal = std::get<0>(getStorage());
473-
return nominal->getAttrs().hasAttribute<PropertyWrapperAttr>();;
474-
}
475-
476-
bool AttachedPropertyWrappersRequest::isCached() const {
477-
auto var = std::get<0>(getStorage());
478-
return !var->getAttrs().isEmpty();
479-
}
480-
481-
bool AttachedPropertyWrapperTypeRequest::isCached() const {
482-
auto var = std::get<0>(getStorage());
483-
return !var->getAttrs().isEmpty();
484-
}
485-
486-
bool PropertyWrapperBackingPropertyTypeRequest::isCached() const {
487-
auto var = std::get<0>(getStorage());
488-
return !var->getAttrs().isEmpty() &&
489-
!(isa<ParamDecl>(var) && isa<ClosureExpr>(var->getDeclContext()));
490-
}
491-
492-
bool PropertyWrapperAuxiliaryVariablesRequest::isCached() const {
493-
auto var = std::get<0>(getStorage());
494-
return !var->getAttrs().isEmpty() || var->hasImplicitPropertyWrapper();
495-
}
496-
497-
bool PropertyWrapperInitializerInfoRequest::isCached() const {
498-
auto var = std::get<0>(getStorage());
499-
return !var->getAttrs().isEmpty() || var->hasImplicitPropertyWrapper();
500-
}
501-
502-
bool PropertyWrapperMutabilityRequest::isCached() const {
503-
auto var = std::get<0>(getStorage());
504-
return !var->getAttrs().isEmpty() || var->hasImplicitPropertyWrapper();
505-
}
506-
507-
bool PropertyWrapperLValuenessRequest::isCached() const {
508-
auto var = std::get<0>(getStorage());
509-
return !var->getAttrs().isEmpty() || var->hasImplicitPropertyWrapper();
510-
}
511-
512471
void swift::simple_display(
513472
llvm::raw_ostream &out, const PropertyWrapperTypeInfo &propertyWrapper) {
514473
out << "{ ";
@@ -609,16 +568,6 @@ void swift::simple_display(llvm::raw_ostream &out,
609568
<< (value.allowUsableFromInline ? "true" : "false");
610569
}
611570

612-
//----------------------------------------------------------------------------//
613-
// ResultBuilder-related requests.
614-
//----------------------------------------------------------------------------//
615-
616-
bool AttachedResultBuilderRequest::isCached() const {
617-
// Only needs to be cached if there are any custom attributes.
618-
auto var = std::get<0>(getStorage());
619-
return var->getAttrs().hasAttribute<CustomAttr>();
620-
}
621-
622571
//----------------------------------------------------------------------------//
623572
// SelfAccessKindRequest computation.
624573
//----------------------------------------------------------------------------//

0 commit comments

Comments
 (0)