@@ -2677,7 +2677,6 @@ namespace {
2677
2677
});
2678
2678
2679
2679
if (!nonSendableTypes.empty ()) {
2680
- auto &ctx = dc->getASTContext ();
2681
2680
{
2682
2681
auto diag = ctx.Diags .diagnose (
2683
2682
funcConv->getLoc (),
@@ -2710,8 +2709,7 @@ namespace {
2710
2709
if (!safeToDropGlobalActor (dc, fromActor, toType,
2711
2710
getImmediateApply ())) {
2712
2711
// otherwise, it's not a safe cast.
2713
- dc->getASTContext ()
2714
- .Diags
2712
+ ctx.Diags
2715
2713
.diagnose (funcConv->getLoc (),
2716
2714
diag::converting_func_loses_global_actor, fromType,
2717
2715
toType, fromActor)
@@ -2879,10 +2877,9 @@ namespace {
2879
2877
isolation->second == ActorIsolation::Nonisolated) {
2880
2878
requiredIsolation[dc] = refinedIsolation;
2881
2879
} else if (isolation->second != refinedIsolation) {
2882
- dc->getASTContext ().Diags .diagnose (
2883
- requiredIsolationLoc,
2884
- diag::conflicting_default_argument_isolation,
2885
- isolation->second , refinedIsolation);
2880
+ ctx.Diags .diagnose (requiredIsolationLoc,
2881
+ diag::conflicting_default_argument_isolation,
2882
+ isolation->second , refinedIsolation);
2886
2883
requiredIsolation.clear ();
2887
2884
return true ;
2888
2885
}
@@ -2930,7 +2927,6 @@ namespace {
2930
2927
// / Check closure captures for Sendable violations.
2931
2928
void checkLocalCaptures (AnyFunctionRef localFunc) {
2932
2929
auto *dc = getDeclContext ();
2933
- ASTContext &ctx = dc->getASTContext ();
2934
2930
2935
2931
auto *closure = localFunc.getAbstractClosureExpr ();
2936
2932
auto *explicitClosure = dyn_cast_or_null<ClosureExpr>(closure);
@@ -3081,8 +3077,6 @@ namespace {
3081
3077
}
3082
3078
3083
3079
ActorIsolation computeRequiredIsolation (Expr *expr) {
3084
- auto &ctx = getDeclContext ()->getASTContext ();
3085
-
3086
3080
if (ctx.LangOpts .hasFeature (Feature::IsolatedDefaultValues))
3087
3081
requiredIsolationLoc = expr->getLoc ();
3088
3082
@@ -3581,7 +3575,6 @@ namespace {
3581
3575
// /
3582
3576
// / \returns true if we diagnosed the entity, \c false otherwise.
3583
3577
bool diagnoseReferenceToUnsafeGlobal (ValueDecl *value, SourceLoc loc) {
3584
- auto &ctx = value->getASTContext ();
3585
3578
switch (ctx.LangOpts .StrictConcurrencyLevel ) {
3586
3579
case StrictConcurrency::Minimal:
3587
3580
case StrictConcurrency::Targeted:
@@ -4124,10 +4117,9 @@ namespace {
4124
4117
4125
4118
// / Check whether there are _unsafeInheritExecutor_ workarounds in the
4126
4119
// / given _Concurrency module.
4127
- static bool hasUnsafeInheritExecutorWorkarounds (
4128
- DeclContext *dc, SourceLoc loc
4129
- ) {
4130
- ASTContext &ctx = dc->getASTContext ();
4120
+ static bool hasUnsafeInheritExecutorWorkarounds (ASTContext &ctx,
4121
+ DeclContext *dc,
4122
+ SourceLoc loc) {
4131
4123
Identifier name =
4132
4124
ctx.getIdentifier (" _unsafeInheritExecutor_withUnsafeContinuation" );
4133
4125
NameLookupOptions lookupOptions = defaultUnqualifiedLookupOptions;
@@ -4158,7 +4150,7 @@ namespace {
4158
4150
diag.limitBehaviorIf (inConcurrencyModule, DiagnosticBehavior::Warning);
4159
4151
4160
4152
if (!inConcurrencyModule &&
4161
- !hasUnsafeInheritExecutorWorkarounds (func, func->getLoc ())) {
4153
+ !hasUnsafeInheritExecutorWorkarounds (ctx, func, func->getLoc ())) {
4162
4154
diag.limitBehavior (DiagnosticBehavior::Warning);
4163
4155
}
4164
4156
@@ -4777,7 +4769,6 @@ bool ActorIsolationChecker::mayExecuteConcurrentlyWith(
4777
4769
if (useIsolation == defIsolation)
4778
4770
return false ;
4779
4771
4780
- auto &ctx = useContext->getASTContext ();
4781
4772
bool regionIsolationEnabled =
4782
4773
ctx.LangOpts .hasFeature (Feature::RegionBasedIsolation);
4783
4774
0 commit comments