File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
include/swift/SILOptimizer/Utils Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,13 @@ class SILIsolationInfo {
291
291
llvm::dbgs () << ' \n ' ;
292
292
}
293
293
294
+ // / Prints out the message for a diagnostic that states that the value is
295
+ // / exposed to a specific code.
296
+ // /
297
+ // / We do this programatically since task-isolated code needs a very different
298
+ // / form of diagnostic than other cases.
299
+ void printForCodeDiagnostic (llvm::raw_ostream &os) const ;
300
+
294
301
void printForDiagnostics (llvm::raw_ostream &os) const ;
295
302
296
303
SWIFT_DEBUG_DUMPER (dumpForDiagnostics()) {
@@ -525,6 +532,10 @@ class SILDynamicMergedIsolationInfo {
525
532
innerInfo.dumpForDiagnostics ();
526
533
}
527
534
535
+ void printForCodeDiagnostic (llvm::raw_ostream &os) const {
536
+ innerInfo.printForCodeDiagnostic (os);
537
+ }
538
+
528
539
void printForOneLineLogging (llvm::raw_ostream &os) const {
529
540
innerInfo.printForOneLineLogging (os);
530
541
}
Original file line number Diff line number Diff line change @@ -1117,6 +1117,50 @@ void SILIsolationInfo::printForDiagnostics(llvm::raw_ostream &os) const {
1117
1117
}
1118
1118
}
1119
1119
1120
+ void SILIsolationInfo::printForCodeDiagnostic (llvm::raw_ostream &os) const {
1121
+ switch (Kind (*this )) {
1122
+ case Unknown:
1123
+ llvm::report_fatal_error (" Printing unknown for code diagnostic?!" );
1124
+ return ;
1125
+ case Disconnected:
1126
+ llvm::report_fatal_error (" Printing disconnected for code diagnostic?!" );
1127
+ return ;
1128
+ case Actor:
1129
+ if (auto instance = getActorInstance ()) {
1130
+ switch (instance.getKind ()) {
1131
+ case ActorInstance::Kind::Value: {
1132
+ SILValue value = instance.getValue ();
1133
+ if (auto name = VariableNameInferrer::inferName (value)) {
1134
+ os << " '" << *name << " '-isolated code" ;
1135
+ return ;
1136
+ }
1137
+ break ;
1138
+ }
1139
+ case ActorInstance::Kind::ActorAccessorInit:
1140
+ os << " 'self'-isolated code" ;
1141
+ return ;
1142
+ case ActorInstance::Kind::CapturedActorSelf:
1143
+ os << " 'self'-isolated code" ;
1144
+ return ;
1145
+ }
1146
+ }
1147
+
1148
+ if (getActorIsolation ().getKind () == ActorIsolation::ActorInstance) {
1149
+ if (auto *vd = getActorIsolation ().getActorInstance ()) {
1150
+ os << " '" << vd->getBaseIdentifier () << " '-isolated code" ;
1151
+ return ;
1152
+ }
1153
+ }
1154
+
1155
+ getActorIsolation ().printForDiagnostics (os);
1156
+ os << " code" ;
1157
+ return ;
1158
+ case Task:
1159
+ os << " code in the current task" ;
1160
+ return ;
1161
+ }
1162
+ }
1163
+
1120
1164
void SILIsolationInfo::printForOneLineLogging (llvm::raw_ostream &os) const {
1121
1165
switch (Kind (*this )) {
1122
1166
case Unknown:
You can’t perform that action at this time.
0 commit comments