@@ -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
@@ -1358,16 +1425,22 @@ class SendNeverSentDiagnosticEmitter {
1358
1425
getIsolationRegionInfo ().printForDiagnostics (os);
1359
1426
}
1360
1427
1428
+ SmallString<64 > calleeIsolationStr;
1429
+ {
1430
+ llvm::raw_svector_ostream os (calleeIsolationStr);
1431
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1432
+ crossing.getCalleeIsolation (), os);
1433
+ }
1434
+
1361
1435
if (auto callee = getSendingCallee ()) {
1362
1436
diagnoseNote (
1363
1437
loc,
1364
1438
diag::regionbasedisolation_typed_sendneversendable_via_arg_callee,
1365
- descriptiveKindStr, inferredType, crossing.getCalleeIsolation (),
1366
- callee.value ());
1439
+ descriptiveKindStr, inferredType, calleeIsolationStr, callee.value ());
1367
1440
} else {
1368
- diagnoseNote (
1369
- loc, diag::regionbasedisolation_typed_sendneversendable_via_arg,
1370
- descriptiveKindStr, inferredType, crossing. getCalleeIsolation () );
1441
+ diagnoseNote (loc,
1442
+ diag::regionbasedisolation_typed_sendneversendable_via_arg,
1443
+ descriptiveKindStr, inferredType, calleeIsolationStr );
1371
1444
}
1372
1445
}
1373
1446
@@ -1382,10 +1455,24 @@ class SendNeverSentDiagnosticEmitter {
1382
1455
os << ' ' ;
1383
1456
}
1384
1457
}
1385
- diagnoseNote (loc,
1386
- diag::regionbasedisolation_named_isolated_closure_yields_race,
1387
- descriptiveKindStr, name, crossing.getCalleeIsolation (),
1388
- crossing.getCallerIsolation ())
1458
+
1459
+ SmallString<64 > calleeIsolationStr;
1460
+ {
1461
+ llvm::raw_svector_ostream os (calleeIsolationStr);
1462
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1463
+ crossing.getCalleeIsolation (), os);
1464
+ }
1465
+
1466
+ SmallString<64 > callerIsolationStr;
1467
+ {
1468
+ llvm::raw_svector_ostream os (callerIsolationStr);
1469
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1470
+ crossing.getCallerIsolation (), os);
1471
+ }
1472
+
1473
+ diagnoseNote (
1474
+ loc, diag::regionbasedisolation_named_isolated_closure_yields_race,
1475
+ descriptiveKindStr, name, calleeIsolationStr, callerIsolationStr)
1389
1476
.highlight (loc.getSourceRange ());
1390
1477
}
1391
1478
@@ -1605,16 +1692,23 @@ class SendNeverSentDiagnosticEmitter {
1605
1692
descriptiveKindStrWithSpace.push_back (' ' );
1606
1693
}
1607
1694
}
1695
+
1696
+ SmallString<64 > calleeIsolationStr;
1697
+ {
1698
+ llvm::raw_svector_ostream os (calleeIsolationStr);
1699
+ SILIsolationInfo::printActorIsolationForDiagnostics (
1700
+ isolationCrossing.getCalleeIsolation (), os);
1701
+ }
1702
+
1608
1703
if (auto callee = getSendingCallee ()) {
1609
1704
diagnoseNote (loc,
1610
1705
diag::regionbasedisolation_named_send_never_sendable_callee,
1611
- name, descriptiveKindStrWithSpace,
1612
- isolationCrossing.getCalleeIsolation (), callee.value (),
1613
- descriptiveKindStr);
1706
+ name, descriptiveKindStrWithSpace, calleeIsolationStr,
1707
+ callee.value (), descriptiveKindStr);
1614
1708
} else {
1615
1709
diagnoseNote (loc, diag::regionbasedisolation_named_send_never_sendable,
1616
- name, descriptiveKindStrWithSpace,
1617
- isolationCrossing. getCalleeIsolation (), descriptiveKindStr);
1710
+ name, descriptiveKindStrWithSpace, calleeIsolationStr,
1711
+ descriptiveKindStr);
1618
1712
}
1619
1713
}
1620
1714
@@ -2605,17 +2699,31 @@ void NonSendableIsolationCrossingResultDiagnosticEmitter::emit() {
2605
2699
if (!isolationCrossing)
2606
2700
return emitUnknownPatternError ();
2607
2701
2702
+ SmallString<64 > calleeIsolationStr;
2703
+ {
2704
+ llvm::raw_svector_ostream os (calleeIsolationStr);
2705
+ SILIsolationInfo::printActorIsolationForDiagnostics (
2706
+ isolationCrossing->getCalleeIsolation (), os);
2707
+ }
2708
+
2709
+ SmallString<64 > callerIsolationStr;
2710
+ {
2711
+ llvm::raw_svector_ostream os (callerIsolationStr);
2712
+ SILIsolationInfo::printActorIsolationForDiagnostics (
2713
+ isolationCrossing->getCallerIsolation (), os);
2714
+ }
2715
+
2608
2716
auto type = getType ();
2609
2717
if (getCalledDecl ()) {
2610
- diagnoseError (error.op ->getSourceInst (), diag::rbi_isolation_crossing_result,
2611
- type, isolationCrossing-> getCalleeIsolation (), getCalledDecl () ,
2612
- isolationCrossing-> getCallerIsolation () )
2613
- .limitBehaviorIf (getBehaviorLimit ());
2718
+ diagnoseError (error.op ->getSourceInst (),
2719
+ diag::rbi_isolation_crossing_result, type, calleeIsolationStr ,
2720
+ getCalledDecl (), callerIsolationStr )
2721
+ .limitBehaviorIf (getBehaviorLimit ());
2614
2722
} else {
2615
- diagnoseError (error.op ->getSourceInst (), diag::rbi_isolation_crossing_result_no_decl,
2616
- type, isolationCrossing-> getCalleeIsolation () ,
2617
- isolationCrossing-> getCallerIsolation () )
2618
- .limitBehaviorIf (getBehaviorLimit ());
2723
+ diagnoseError (error.op ->getSourceInst (),
2724
+ diag::rbi_isolation_crossing_result_no_decl, type ,
2725
+ calleeIsolationStr, callerIsolationStr )
2726
+ .limitBehaviorIf (getBehaviorLimit ());
2619
2727
}
2620
2728
if (type->is <FunctionType>()) {
2621
2729
diagnoseNote (error.op ->getSourceInst (),
0 commit comments