@@ -1627,11 +1627,18 @@ class PartitionAnalysis {
1627
1627
}
1628
1628
};
1629
1629
1630
+ } // namespace
1631
+
1632
+ // ===----------------------------------------------------------------------===//
1633
+ // MARK: Top Level Entrypoint
1634
+ // ===----------------------------------------------------------------------===//
1635
+
1636
+ namespace {
1637
+
1630
1638
// this class is the entry point to the region-based Sendable analysis,
1631
1639
// after certain checks are performed to ensure the analysis can be completed
1632
1640
// a PartitionAnalysis object is created and used to run the analysis.
1633
1641
class SendNonSendable : public SILFunctionTransform {
1634
-
1635
1642
// find any ApplyExprs in this function, and check if any of them make an
1636
1643
// unsatisfied isolation jump, emitting appropriate diagnostics if so
1637
1644
void run () override {
@@ -1651,19 +1658,20 @@ class SendNonSendable : public SILFunctionTransform {
1651
1658
Feature::SendNonSendable))
1652
1659
return ;
1653
1660
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.
1657
1664
if (!function->getASTContext ().getProtocol (KnownProtocolKind::Sendable))
1658
- return ;
1665
+ llvm::report_fatal_error ( " Sendable protocol not available! " ) ;
1659
1666
1660
1667
PartitionAnalysis::performForFunction (function);
1661
1668
}
1662
1669
};
1663
- }
1670
+
1671
+ } // end anonymous namespace
1664
1672
1665
1673
// / This pass is known to depend on the following passes having run before it:
1666
- // / none so far
1674
+ // / none so far.
1667
1675
SILTransform *swift::createSendNonSendable () {
1668
1676
return new SendNonSendable ();
1669
1677
}
0 commit comments