Skip to content

Commit bfb2046

Browse files
committed
[send-non-sendable] Cleanup the main SILFunctionTransform.
1 parent 80f4588 commit bfb2046

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lib/SILOptimizer/Mandatory/SendNonSendable.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,11 +1627,18 @@ class PartitionAnalysis {
16271627
}
16281628
};
16291629

1630+
} // namespace
1631+
1632+
//===----------------------------------------------------------------------===//
1633+
// MARK: Top Level Entrypoint
1634+
//===----------------------------------------------------------------------===//
1635+
1636+
namespace {
1637+
16301638
// this class is the entry point to the region-based Sendable analysis,
16311639
// after certain checks are performed to ensure the analysis can be completed
16321640
// a PartitionAnalysis object is created and used to run the analysis.
16331641
class SendNonSendable : public SILFunctionTransform {
1634-
16351642
// find any ApplyExprs in this function, and check if any of them make an
16361643
// unsatisfied isolation jump, emitting appropriate diagnostics if so
16371644
void run() override {
@@ -1651,19 +1658,20 @@ class SendNonSendable : public SILFunctionTransform {
16511658
Feature::SendNonSendable))
16521659
return;
16531660

1654-
// if the Sendable protocol is not available, don't perform this checking
1655-
// because we'd have to conservatively treat every value as non-Sendable
1656-
// which would be very expensive
1661+
// The sendable protocol should /always/ be available if SendNonSendable is
1662+
// enabled. If not, there is a major bug in the compiler and we should fail
1663+
// loudly.
16571664
if (!function->getASTContext().getProtocol(KnownProtocolKind::Sendable))
1658-
return;
1665+
llvm::report_fatal_error("Sendable protocol not available!");
16591666

16601667
PartitionAnalysis::performForFunction(function);
16611668
}
16621669
};
1663-
}
1670+
1671+
} // end anonymous namespace
16641672

16651673
/// This pass is known to depend on the following passes having run before it:
1666-
/// none so far
1674+
/// none so far.
16671675
SILTransform *swift::createSendNonSendable() {
16681676
return new SendNonSendable();
16691677
}

0 commit comments

Comments
 (0)