Skip to content

Commit 085f3d7

Browse files
committed
[region-isolation] Return the old way of printing ActorIsolation for use when printing SIL instructions.
1 parent 9504dc9 commit 085f3d7

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

include/swift/AST/ActorIsolation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ class ActorIsolation {
266266

267267
void print(llvm::raw_ostream &os) const;
268268

269+
void printForSIL(llvm::raw_ostream &os) const;
270+
269271
void printForDiagnostics(llvm::raw_ostream &os,
270272
StringRef openingQuotationMark = "'") const;
271273

lib/AST/TypeCheckRequests.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,30 @@ void ActorIsolation::print(llvm::raw_ostream &os) const {
17601760
llvm_unreachable("Covered switch isn't covered?!");
17611761
}
17621762

1763+
void ActorIsolation::printForSIL(llvm::raw_ostream &os) const {
1764+
switch (getKind()) {
1765+
case Unspecified:
1766+
os << "unspecified";
1767+
return;
1768+
case ActorInstance:
1769+
os << "actor_instance";
1770+
return;
1771+
case Nonisolated:
1772+
os << "nonisolated";
1773+
return;
1774+
case NonisolatedUnsafe:
1775+
os << "nonisolated_unsafe";
1776+
return;
1777+
case GlobalActor:
1778+
os << "global_actor";
1779+
return;
1780+
case Erased:
1781+
os << "erased";
1782+
return;
1783+
}
1784+
llvm_unreachable("Covered switch isn't covered?!");
1785+
}
1786+
17631787
void ActorIsolation::dumpForDiagnostics() const {
17641788
printForDiagnostics(llvm::dbgs());
17651789
llvm::dbgs() << '\n';

lib/SIL/IR/SILPrinter.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,11 +1550,17 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
15501550
*this << "[noasync] ";
15511551
if (auto isolationCrossing = AI->getIsolationCrossing()) {
15521552
auto callerIsolation = isolationCrossing->getCallerIsolation();
1553-
if (callerIsolation != ActorIsolation::Unspecified)
1554-
*this << "[callee_isolation=" << callerIsolation << "] ";
1553+
if (callerIsolation != ActorIsolation::Unspecified) {
1554+
*this << "[callee_isolation=";
1555+
callerIsolation.printForSIL(PrintState.OS);
1556+
*this << "] ";
1557+
}
15551558
auto calleeIsolation = isolationCrossing->getCalleeIsolation();
1556-
if (calleeIsolation != ActorIsolation::Unspecified)
1557-
*this << "[caller_isolation=" << calleeIsolation << "] ";
1559+
if (calleeIsolation != ActorIsolation::Unspecified) {
1560+
*this << "[caller_isolation=";
1561+
calleeIsolation.printForSIL(PrintState.OS);
1562+
*this << "] ";
1563+
}
15581564
}
15591565
visitApplyInstBase(AI);
15601566
}

0 commit comments

Comments
 (0)