@@ -501,33 +501,26 @@ class UseAfterTransferDiagnosticInferrer {
501501 : valueMap(valueMap) {}
502502 void init (const Operand *op);
503503
504- void addApplyUse (UseDiagnosticInfo diagnosticInfo) {
504+ void appendUseInfo (UseDiagnosticInfo diagnosticInfo) {
505505 applyUses.emplace_back (diagnosticInfo);
506506 }
507507
508508 ArrayRef<UseDiagnosticInfo> getApplyUses () const { return applyUses; }
509509
510510private:
511- // / Init for an apply that does not have an associated apply expr.
512- // /
513- // / This should only occur when writing SIL test cases today. In the future,
514- // / we may represent all of the actor isolation information at the SIL level,
515- // / but we are not there yet today.
516- void initForApply (ApplyIsolationCrossing isolationCrossing);
517511 bool initForIsolatedPartialApply (Operand *op, AbstractClosureExpr *ace);
518512
519513 void initForApply (const Operand *op, ApplyExpr *expr);
520- void initForApply (SILLocation valueLoc, Identifier valueName,
521- ApplyIsolationCrossing isolationCrossing);
522514 void initForAutoclosure (const Operand *op, AutoClosureExpr *expr);
523515
524516 void initForAssignmentToTransferringParameter (const Operand *op) {
525- addApplyUse (UseDiagnosticInfo::forTypedAssignmentIntoTransferringParameter (
526- baseLoc, op->get ()->getType ().getASTType ()));
517+ appendUseInfo (
518+ UseDiagnosticInfo::forTypedAssignmentIntoTransferringParameter (
519+ baseLoc, op->get ()->getType ().getASTType ()));
527520 }
528521
529522 void initForUseOfStronglyTransferredValue (const Operand *op) {
530- addApplyUse (UseDiagnosticInfo::forTypedUseOfStronglyTransferredValue (
523+ appendUseInfo (UseDiagnosticInfo::forTypedUseOfStronglyTransferredValue (
531524 baseLoc, op->get ()->getType ().getASTType ()));
532525 }
533526
@@ -565,7 +558,7 @@ bool UseAfterTransferDiagnosticInferrer::initForIsolatedPartialApply(
565558 unsigned opIndex = ApplySite (op->getUser ()).getAppliedArgIndex (*op);
566559 for (auto &p : foundCapturedIsolationCrossing) {
567560 if (std::get<1 >(p) == opIndex) {
568- addApplyUse (UseDiagnosticInfo::forTypedIsolationCrossingDueToCapture (
561+ appendUseInfo (UseDiagnosticInfo::forTypedIsolationCrossingDueToCapture (
569562 RegularLocation (std::get<0 >(p).getLoc ()), baseInferredType,
570563 std::get<2 >(p)));
571564 return true ;
@@ -575,19 +568,6 @@ bool UseAfterTransferDiagnosticInferrer::initForIsolatedPartialApply(
575568 return false ;
576569}
577570
578- void UseAfterTransferDiagnosticInferrer::initForApply (
579- ApplyIsolationCrossing isolationCrossing) {
580- addApplyUse (UseDiagnosticInfo::forTypedIsolationCrossing (
581- baseLoc, baseInferredType, isolationCrossing));
582- }
583-
584- void UseAfterTransferDiagnosticInferrer::initForApply (
585- SILLocation valueLoc, Identifier valueName,
586- ApplyIsolationCrossing isolationCrossing) {
587- addApplyUse (UseDiagnosticInfo::forNamedIsolationCrossing (
588- baseLoc, valueLoc, valueName, isolationCrossing));
589- }
590-
591571void UseAfterTransferDiagnosticInferrer::initForApply (const Operand *op,
592572 ApplyExpr *sourceApply) {
593573 auto isolationCrossing = sourceApply->getIsolationCrossing ().value ();
@@ -617,7 +597,7 @@ void UseAfterTransferDiagnosticInferrer::initForApply(const Operand *op,
617597
618598 auto inferredArgType =
619599 foundExpr ? foundExpr->findOriginalType () : baseInferredType;
620- addApplyUse (UseDiagnosticInfo::forTypedIsolationCrossing (
600+ appendUseInfo (UseDiagnosticInfo::forTypedIsolationCrossing (
621601 baseLoc, inferredArgType, isolationCrossing));
622602}
623603
@@ -663,7 +643,7 @@ struct UseAfterTransferDiagnosticInferrer::Walker : ASTWalker {
663643 if (!visitedCallExprDeclRefExprs.count (declRef)) {
664644 if (declRef->getDecl () == targetDecl) {
665645 visitedCallExprDeclRefExprs.insert (declRef);
666- foundTypeInfo.addApplyUse (
646+ foundTypeInfo.appendUseInfo (
667647 UseDiagnosticInfo::forTypeIsolationCrossingWithUnknownIsolation (
668648 foundTypeInfo.baseLoc , declRef->findOriginalType ()));
669649 return Action::Continue (expr);
@@ -681,7 +661,7 @@ struct UseAfterTransferDiagnosticInferrer::Walker : ASTWalker {
681661 if (declRef->getDecl () == targetDecl) {
682662 // Found our target!
683663 visitedCallExprDeclRefExprs.insert (declRef);
684- foundTypeInfo.addApplyUse (
664+ foundTypeInfo.appendUseInfo (
685665 UseDiagnosticInfo::forTypedIsolationCrossing (
686666 foundTypeInfo.baseLoc , declRef->findOriginalType (),
687667 *isolationCrossing));
@@ -752,14 +732,14 @@ void UseAfterTransferDiagnosticInferrer::init(const Operand *op) {
752732 if (auto rootValue =
753733 inferrer.inferByWalkingUsesToDefsReturningRoot (op->get ())) {
754734 if (auto *svi = dyn_cast<SingleValueInstruction>(rootValue)) {
755- return addApplyUse (UseDiagnosticInfo::forNamedIsolationCrossing (
735+ return appendUseInfo (UseDiagnosticInfo::forNamedIsolationCrossing (
756736 baseLoc, svi->getLoc (),
757737 astContext.getIdentifier (inferrer.getName ()),
758738 *sourceApply->getIsolationCrossing ()));
759739 }
760740
761741 if (auto *fArg = dyn_cast<SILFunctionArgument>(rootValue)) {
762- return addApplyUse (UseDiagnosticInfo::forNamedIsolationCrossing (
742+ return appendUseInfo (UseDiagnosticInfo::forNamedIsolationCrossing (
763743 baseLoc, RegularLocation (fArg ->getDecl ()->getLoc ()),
764744 astContext.getIdentifier (inferrer.getName ()),
765745 *sourceApply->getIsolationCrossing ()));
@@ -772,7 +752,8 @@ void UseAfterTransferDiagnosticInferrer::init(const Operand *op) {
772752
773753 if (auto fas = FullApplySite::isa (nonConstOp->getUser ())) {
774754 if (auto isolationCrossing = fas.getIsolationCrossing ()) {
775- return initForApply (*isolationCrossing);
755+ return appendUseInfo (UseDiagnosticInfo::forTypedIsolationCrossing (
756+ baseLoc, baseInferredType, *isolationCrossing));
776757 }
777758 }
778759
0 commit comments