@@ -695,16 +695,29 @@ class UseAfterSendDiagnosticEmitter {
695
695
}
696
696
}
697
697
698
+ SmallString<64 > calleeIsolationStr;
699
+ {
700
+ llvm::raw_svector_ostream os (calleeIsolationStr);
701
+ SILIsolationInfo::printActorIsolationForDiagnostics (
702
+ isolationCrossing.getCalleeIsolation (), os);
703
+ }
704
+
705
+ SmallString<64 > callerIsolationStr;
706
+ {
707
+ llvm::raw_svector_ostream os (callerIsolationStr);
708
+ SILIsolationInfo::printActorIsolationForDiagnostics (
709
+ isolationCrossing.getCallerIsolation (), os);
710
+ }
711
+
698
712
if (auto callee = getSendingCallee ()) {
699
713
diagnoseNote (
700
714
loc, diag::regionbasedisolation_named_info_send_yields_race_callee,
701
- name, descriptiveKindStr, isolationCrossing. getCalleeIsolation (),
702
- callee. value (), isolationCrossing. getCallerIsolation () );
715
+ name, descriptiveKindStr, calleeIsolationStr, callee. value (),
716
+ callerIsolationStr );
703
717
} else {
704
718
diagnoseNote (loc, diag::regionbasedisolation_named_info_send_yields_race,
705
- name, descriptiveKindStr,
706
- isolationCrossing.getCalleeIsolation (),
707
- isolationCrossing.getCallerIsolation ());
719
+ name, descriptiveKindStr, calleeIsolationStr,
720
+ callerIsolationStr);
708
721
}
709
722
emitRequireInstDiagnostics ();
710
723
}
@@ -729,10 +742,24 @@ class UseAfterSendDiagnosticEmitter {
729
742
}
730
743
}
731
744
732
- diagnoseNote (
733
- loc, diag::regionbasedisolation_named_info_send_yields_race_callee,
734
- name, descriptiveKindStr, isolationCrossing.getCalleeIsolation (),
735
- callee, isolationCrossing.getCallerIsolation ());
745
+ SmallString<64 > calleeIsolationStr;
746
+ {
747
+ llvm::raw_svector_ostream os (calleeIsolationStr);
748
+ SILIsolationInfo::printActorIsolationForDiagnostics (
749
+ isolationCrossing.getCalleeIsolation (), os);
750
+ }
751
+
752
+ SmallString<64 > callerIsolationStr;
753
+ {
754
+ llvm::raw_svector_ostream os (callerIsolationStr);
755
+ SILIsolationInfo::printActorIsolationForDiagnostics (
756
+ isolationCrossing.getCallerIsolation (), os);
757
+ }
758
+
759
+ diagnoseNote (loc,
760
+ diag::regionbasedisolation_named_info_send_yields_race_callee,
761
+ name, descriptiveKindStr, calleeIsolationStr, callee,
762
+ callerIsolationStr);
736
763
emitRequireInstDiagnostics ();
737
764
}
738
765
@@ -755,14 +782,27 @@ class UseAfterSendDiagnosticEmitter {
755
782
.highlight (loc.getSourceRange ())
756
783
.limitBehaviorIf (getBehaviorLimit ());
757
784
785
+ SmallString<64 > calleeIsolationStr;
786
+ {
787
+ llvm::raw_svector_ostream os (calleeIsolationStr);
788
+ SILIsolationInfo::printActorIsolationForDiagnostics (
789
+ isolationCrossing.getCalleeIsolation (), os);
790
+ }
791
+
792
+ SmallString<64 > callerIsolationStr;
793
+ {
794
+ llvm::raw_svector_ostream os (callerIsolationStr);
795
+ SILIsolationInfo::printActorIsolationForDiagnostics (
796
+ isolationCrossing.getCallerIsolation (), os);
797
+ }
798
+
758
799
if (auto callee = getSendingCallee ()) {
759
800
diagnoseNote (loc, diag::regionbasedisolation_type_use_after_send_callee,
760
- inferredType, isolationCrossing. getCalleeIsolation (),
761
- callee. value (), isolationCrossing. getCallerIsolation () );
801
+ inferredType, calleeIsolationStr, callee. value (),
802
+ callerIsolationStr );
762
803
} else {
763
804
diagnoseNote (loc, diag::regionbasedisolation_type_use_after_send,
764
- inferredType, isolationCrossing.getCalleeIsolation (),
765
- isolationCrossing.getCallerIsolation ());
805
+ inferredType, calleeIsolationStr, callerIsolationStr);
766
806
}
767
807
emitRequireInstDiagnostics ();
768
808
}
@@ -817,10 +857,23 @@ class UseAfterSendDiagnosticEmitter {
817
857
}
818
858
}
819
859
860
+ SmallString<64 > calleeIsolationStr;
861
+ {
862
+ llvm::raw_svector_ostream os (calleeIsolationStr);
863
+ SILIsolationInfo::printActorIsolationForDiagnostics (
864
+ isolationCrossing.getCalleeIsolation (), os);
865
+ }
866
+
867
+ SmallString<64 > callerIsolationStr;
868
+ {
869
+ llvm::raw_svector_ostream os (callerIsolationStr);
870
+ SILIsolationInfo::printActorIsolationForDiagnostics (
871
+ isolationCrossing.getCallerIsolation (), os);
872
+ }
873
+
820
874
diagnoseNote (
821
875
loc, diag::regionbasedisolation_named_isolated_closure_yields_race,
822
- descriptiveKindStr, name, isolationCrossing.getCalleeIsolation (),
823
- isolationCrossing.getCallerIsolation ())
876
+ descriptiveKindStr, name, calleeIsolationStr, callerIsolationStr)
824
877
.highlight (loc.getSourceRange ());
825
878
emitRequireInstDiagnostics ();
826
879
}
@@ -832,10 +885,24 @@ class UseAfterSendDiagnosticEmitter {
832
885
inferredType)
833
886
.highlight (loc.getSourceRange ())
834
887
.limitBehaviorIf (getBehaviorLimit ());
888
+
889
+ SmallString<64 > calleeIsolationStr;
890
+ {
891
+ llvm::raw_svector_ostream os (calleeIsolationStr);
892
+ SILIsolationInfo::printActorIsolationForDiagnostics (
893
+ isolationCrossing.getCalleeIsolation (), os);
894
+ }
895
+
896
+ SmallString<64 > callerIsolationStr;
897
+ {
898
+ llvm::raw_svector_ostream os (callerIsolationStr);
899
+ SILIsolationInfo::printActorIsolationForDiagnostics (
900
+ isolationCrossing.getCallerIsolation (), os);
901
+ }
902
+
835
903
diagnoseNote (loc,
836
904
diag::regionbasedisolation_type_isolated_capture_yields_race,
837
- inferredType, isolationCrossing.getCalleeIsolation (),
838
- isolationCrossing.getCallerIsolation ());
905
+ inferredType, calleeIsolationStr, callerIsolationStr);
839
906
emitRequireInstDiagnostics ();
840
907
}
841
908
@@ -1377,16 +1444,22 @@ class SendNeverSentDiagnosticEmitter {
1377
1444
getIsolationRegionInfo ().printForDiagnostics (os);
1378
1445
}
1379
1446
1447
+ SmallString<64 > calleeIsolationStr;
1448
+ {
1449
+ llvm::raw_svector_ostream os (calleeIsolationStr);
1450
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1451
+ crossing.getCalleeIsolation (), os);
1452
+ }
1453
+
1380
1454
if (auto callee = getSendingCallee ()) {
1381
1455
diagnoseNote (
1382
1456
loc,
1383
1457
diag::regionbasedisolation_typed_sendneversendable_via_arg_callee,
1384
- descriptiveKindStr, inferredType, crossing.getCalleeIsolation (),
1385
- callee.value ());
1458
+ descriptiveKindStr, inferredType, calleeIsolationStr, callee.value ());
1386
1459
} else {
1387
- diagnoseNote (
1388
- loc, diag::regionbasedisolation_typed_sendneversendable_via_arg,
1389
- descriptiveKindStr, inferredType, crossing. getCalleeIsolation () );
1460
+ diagnoseNote (loc,
1461
+ diag::regionbasedisolation_typed_sendneversendable_via_arg,
1462
+ descriptiveKindStr, inferredType, calleeIsolationStr );
1390
1463
}
1391
1464
}
1392
1465
@@ -1401,10 +1474,24 @@ class SendNeverSentDiagnosticEmitter {
1401
1474
os << ' ' ;
1402
1475
}
1403
1476
}
1404
- diagnoseNote (loc,
1405
- diag::regionbasedisolation_named_isolated_closure_yields_race,
1406
- descriptiveKindStr, name, crossing.getCalleeIsolation (),
1407
- crossing.getCallerIsolation ())
1477
+
1478
+ SmallString<64 > calleeIsolationStr;
1479
+ {
1480
+ llvm::raw_svector_ostream os (calleeIsolationStr);
1481
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1482
+ crossing.getCalleeIsolation (), os);
1483
+ }
1484
+
1485
+ SmallString<64 > callerIsolationStr;
1486
+ {
1487
+ llvm::raw_svector_ostream os (callerIsolationStr);
1488
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1489
+ crossing.getCallerIsolation (), os);
1490
+ }
1491
+
1492
+ diagnoseNote (
1493
+ loc, diag::regionbasedisolation_named_isolated_closure_yields_race,
1494
+ descriptiveKindStr, name, calleeIsolationStr, callerIsolationStr)
1408
1495
.highlight (loc.getSourceRange ());
1409
1496
}
1410
1497
@@ -1623,16 +1710,23 @@ class SendNeverSentDiagnosticEmitter {
1623
1710
descriptiveKindStrWithSpace.push_back (' ' );
1624
1711
}
1625
1712
}
1713
+
1714
+ SmallString<64 > calleeIsolationStr;
1715
+ {
1716
+ llvm::raw_svector_ostream os (calleeIsolationStr);
1717
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1718
+ isolationCrossing.getCalleeIsolation (), os);
1719
+ }
1720
+
1626
1721
if (auto callee = getSendingCallee ()) {
1627
1722
diagnoseNote (loc,
1628
1723
diag::regionbasedisolation_named_send_never_sendable_callee,
1629
- name, descriptiveKindStrWithSpace,
1630
- isolationCrossing.getCalleeIsolation (), callee.value (),
1631
- descriptiveKindStr);
1724
+ name, descriptiveKindStrWithSpace, calleeIsolationStr,
1725
+ callee.value (), descriptiveKindStr);
1632
1726
} else {
1633
1727
diagnoseNote (loc, diag::regionbasedisolation_named_send_never_sendable,
1634
- name, descriptiveKindStrWithSpace,
1635
- isolationCrossing. getCalleeIsolation (), descriptiveKindStr);
1728
+ name, descriptiveKindStrWithSpace, calleeIsolationStr,
1729
+ descriptiveKindStr);
1636
1730
}
1637
1731
}
1638
1732
@@ -2623,17 +2717,31 @@ void NonSendableIsolationCrossingResultDiagnosticEmitter::emit() {
2623
2717
if (!isolationCrossing)
2624
2718
return emitUnknownPatternError ();
2625
2719
2720
+ SmallString<64 > calleeIsolationStr;
2721
+ {
2722
+ llvm::raw_svector_ostream os (calleeIsolationStr);
2723
+ SILIsolationInfo::printActorIsolationForDiagnostics (
2724
+ isolationCrossing->getCalleeIsolation (), os);
2725
+ }
2726
+
2727
+ SmallString<64 > callerIsolationStr;
2728
+ {
2729
+ llvm::raw_svector_ostream os (callerIsolationStr);
2730
+ SILIsolationInfo::printActorIsolationForDiagnostics (
2731
+ isolationCrossing->getCallerIsolation (), os);
2732
+ }
2733
+
2626
2734
auto type = getType ();
2627
2735
if (getCalledDecl ()) {
2628
- diagnoseError (error.op ->getSourceInst (), diag::rbi_isolation_crossing_result,
2629
- type, isolationCrossing-> getCalleeIsolation (), getCalledDecl () ,
2630
- isolationCrossing-> getCallerIsolation () )
2631
- .limitBehaviorIf (getBehaviorLimit ());
2736
+ diagnoseError (error.op ->getSourceInst (),
2737
+ diag::rbi_isolation_crossing_result, type, calleeIsolationStr ,
2738
+ getCalledDecl (), callerIsolationStr )
2739
+ .limitBehaviorIf (getBehaviorLimit ());
2632
2740
} else {
2633
- diagnoseError (error.op ->getSourceInst (), diag::rbi_isolation_crossing_result_no_decl,
2634
- type, isolationCrossing-> getCalleeIsolation () ,
2635
- isolationCrossing-> getCallerIsolation () )
2636
- .limitBehaviorIf (getBehaviorLimit ());
2741
+ diagnoseError (error.op ->getSourceInst (),
2742
+ diag::rbi_isolation_crossing_result_no_decl, type ,
2743
+ calleeIsolationStr, callerIsolationStr )
2744
+ .limitBehaviorIf (getBehaviorLimit ());
2637
2745
}
2638
2746
if (type->is <FunctionType>()) {
2639
2747
diagnoseNote (error.op ->getSourceInst (),
0 commit comments