@@ -926,7 +926,8 @@ TypeChecker::overApproximateAvailabilityAtLocation(SourceLoc loc,
926
926
}
927
927
928
928
Optional<UnavailabilityReason>
929
- TypeChecker::checkDeclarationAvailability (const Decl *D, ExportContext where) {
929
+ TypeChecker::checkDeclarationAvailability (const Decl *D,
930
+ const ExportContext &where) {
930
931
auto *referenceDC = where.getDeclContext ();
931
932
ASTContext &Context = referenceDC->getASTContext ();
932
933
if (Context.LangOpts .DisableAvailabilityChecking ) {
@@ -1668,7 +1669,7 @@ const AvailableAttr *TypeChecker::getDeprecated(const Decl *D) {
1668
1669
// / Returns true if the reference or any of its parents is an
1669
1670
// / unconditional unavailable declaration for the same platform.
1670
1671
static bool isInsideCompatibleUnavailableDeclaration (
1671
- const ValueDecl *D, ExportContext where,
1672
+ const ValueDecl *D, const ExportContext & where,
1672
1673
const AvailableAttr *attr) {
1673
1674
auto referencedPlatform = where.getUnavailablePlatformKind ();
1674
1675
if (!referencedPlatform)
@@ -2067,7 +2068,7 @@ getAccessorKindAndNameForDiagnostics(const ValueDecl *D) {
2067
2068
}
2068
2069
2069
2070
void TypeChecker::diagnoseIfDeprecated (SourceRange ReferenceRange,
2070
- ExportContext Where,
2071
+ const ExportContext & Where,
2071
2072
const ValueDecl *DeprecatedDecl,
2072
2073
const ApplyExpr *Call) {
2073
2074
const AvailableAttr *Attr = TypeChecker::getDeprecated (DeprecatedDecl);
@@ -2201,7 +2202,7 @@ void swift::diagnoseUnavailableOverride(ValueDecl *override,
2201
2202
// / marked as unavailable, either through "unavailable" or "obsoleted:".
2202
2203
bool swift::diagnoseExplicitUnavailability (const ValueDecl *D,
2203
2204
SourceRange R,
2204
- ExportContext Where,
2205
+ const ExportContext & Where,
2205
2206
const ApplyExpr *call,
2206
2207
DeclAvailabilityFlags Flags) {
2207
2208
return diagnoseExplicitUnavailability (D, R, Where, Flags,
@@ -2275,7 +2276,7 @@ bool isSubscriptReturningString(const ValueDecl *D, ASTContext &Context) {
2275
2276
bool swift::diagnoseExplicitUnavailability (
2276
2277
const ValueDecl *D,
2277
2278
SourceRange R,
2278
- ExportContext Where,
2279
+ const ExportContext & Where,
2279
2280
DeclAvailabilityFlags Flags,
2280
2281
llvm::function_ref<void (InFlightDiagnostic &)> attachRenameFixIts) {
2281
2282
auto *Attr = AvailableAttr::isUnavailable (D);
@@ -2430,10 +2431,10 @@ class ExprAvailabilityWalker : public ASTWalker {
2430
2431
ASTContext &Context;
2431
2432
MemberAccessContext AccessContext = MemberAccessContext::Getter;
2432
2433
SmallVector<const Expr *, 16 > ExprStack;
2433
- ExportContext Where;
2434
+ const ExportContext & Where;
2434
2435
2435
2436
public:
2436
- explicit ExprAvailabilityWalker (ExportContext Where)
2437
+ explicit ExprAvailabilityWalker (const ExportContext & Where)
2437
2438
: Context(Where.getDeclContext()->getASTContext()), Where(Where) {}
2438
2439
2439
2440
bool shouldWalkIntoSeparatelyCheckedClosure (ClosureExpr *expr) override {
@@ -2747,7 +2748,7 @@ bool
2747
2748
swift::diagnoseDeclAvailability (const ValueDecl *D,
2748
2749
SourceRange R,
2749
2750
const ApplyExpr *call,
2750
- ExportContext Where,
2751
+ const ExportContext & Where,
2751
2752
DeclAvailabilityFlags Flags) {
2752
2753
assert (!Where.isImplicit ());
2753
2754
@@ -3025,7 +3026,7 @@ void swift::diagnoseStmtAvailability(const Stmt *S, DeclContext *DC,
3025
3026
namespace {
3026
3027
3027
3028
class TypeReprAvailabilityWalker : public ASTWalker {
3028
- ExportContext where;
3029
+ const ExportContext & where;
3029
3030
DeclAvailabilityFlags flags;
3030
3031
3031
3032
bool checkComponentIdentTypeRepr (ComponentIdentTypeRepr *ITR) {
@@ -3053,7 +3054,7 @@ class TypeReprAvailabilityWalker : public ASTWalker {
3053
3054
public:
3054
3055
bool foundAnyIssues = false ;
3055
3056
3056
- TypeReprAvailabilityWalker (ExportContext where,
3057
+ TypeReprAvailabilityWalker (const ExportContext & where,
3057
3058
DeclAvailabilityFlags flags)
3058
3059
: where(where), flags(flags) {}
3059
3060
@@ -3088,7 +3089,8 @@ class TypeReprAvailabilityWalker : public ASTWalker {
3088
3089
3089
3090
}
3090
3091
3091
- bool swift::diagnoseTypeReprAvailability (const TypeRepr *T, ExportContext where,
3092
+ bool swift::diagnoseTypeReprAvailability (const TypeRepr *T,
3093
+ const ExportContext &where,
3092
3094
DeclAvailabilityFlags flags) {
3093
3095
if (!T)
3094
3096
return false ;
@@ -3101,11 +3103,11 @@ namespace {
3101
3103
3102
3104
class ProblematicTypeFinder : public TypeDeclFinder {
3103
3105
SourceLoc Loc;
3104
- ExportContext Where;
3106
+ const ExportContext & Where;
3105
3107
DeclAvailabilityFlags Flags;
3106
3108
3107
3109
public:
3108
- ProblematicTypeFinder (SourceLoc Loc, ExportContext Where,
3110
+ ProblematicTypeFinder (SourceLoc Loc, const ExportContext & Where,
3109
3111
DeclAvailabilityFlags Flags)
3110
3112
: Loc(Loc), Where(Where), Flags(Flags) {}
3111
3113
@@ -3179,15 +3181,16 @@ class ProblematicTypeFinder : public TypeDeclFinder {
3179
3181
3180
3182
}
3181
3183
3182
- void swift::diagnoseTypeAvailability (Type T, SourceLoc loc, ExportContext where,
3184
+ void swift::diagnoseTypeAvailability (Type T, SourceLoc loc,
3185
+ const ExportContext &where,
3183
3186
DeclAvailabilityFlags flags) {
3184
3187
if (!T)
3185
3188
return ;
3186
3189
T.walk (ProblematicTypeFinder (loc, where, flags));
3187
3190
}
3188
3191
3189
3192
void swift::diagnoseTypeAvailability (const TypeRepr *TR, Type T, SourceLoc loc,
3190
- ExportContext where,
3193
+ const ExportContext & where,
3191
3194
DeclAvailabilityFlags flags) {
3192
3195
if (diagnoseTypeReprAvailability (TR, where, flags))
3193
3196
return ;
@@ -3197,7 +3200,7 @@ void swift::diagnoseTypeAvailability(const TypeRepr *TR, Type T, SourceLoc loc,
3197
3200
bool
3198
3201
swift::diagnoseConformanceAvailability (SourceLoc loc,
3199
3202
ProtocolConformanceRef conformance,
3200
- ExportContext where) {
3203
+ const ExportContext & where) {
3201
3204
if (!conformance.isConcrete ())
3202
3205
return false ;
3203
3206
const ProtocolConformance *concreteConf = conformance.getConcrete ();
@@ -3216,7 +3219,7 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
3216
3219
bool
3217
3220
swift::diagnoseSubstitutionMapAvailability (SourceLoc loc,
3218
3221
SubstitutionMap subs,
3219
- ExportContext where) {
3222
+ const ExportContext & where) {
3220
3223
bool hadAnyIssues = false ;
3221
3224
for (ProtocolConformanceRef conformance : subs.getConformances ()) {
3222
3225
if (diagnoseConformanceAvailability (loc, conformance, where))
0 commit comments