|
1 | | -#include "../../Sema/TypeCheckConcurrency.h" |
2 | | -#include "../../Sema/TypeChecker.h" |
| 1 | +//===--- SendNonSendable.cpp ----------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift.org open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See https://swift.org/LICENSE.txt for license information |
| 9 | +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
3 | 13 | #include "swift/AST/DiagnosticsSIL.h" |
4 | 14 | #include "swift/AST/Expr.h" |
5 | 15 | #include "swift/AST/Type.h" |
@@ -256,18 +266,17 @@ class PartitionOpTranslator { |
256 | 266 | switch (type.getASTType()->getKind()) { |
257 | 267 | case TypeKind::BuiltinNativeObject: |
258 | 268 | case TypeKind::BuiltinRawPointer: |
259 | | - // these are very unsafe... definitely not Sendable |
| 269 | + // These are very unsafe... definitely not Sendable. |
260 | 270 | return true; |
261 | 271 | default: |
262 | | - // consider caching this if it's a performance bottleneck |
263 | | - return TypeChecker::conformsToProtocol( |
264 | | - type.getASTType(), sendableProtocol, function->getParentModule()) |
| 272 | + // Consider caching this if it's a performance bottleneck. |
| 273 | + return type.conformsToProtocol(function, sendableProtocol) |
265 | 274 | .hasMissingConformance(function->getParentModule()); |
266 | 275 | } |
267 | 276 | } |
268 | 277 |
|
269 | | - // used to statefully track the instruction currently being translated, |
270 | | - // for insertion into generated PartitionOps |
| 278 | + // Used to statefully track the instruction currently being translated, for |
| 279 | + // insertion into generated PartitionOps. |
271 | 280 | SILInstruction *currentInstruction; |
272 | 281 |
|
273 | 282 | // =========================================================================== |
@@ -1586,12 +1595,13 @@ class PartitionAnalysis { |
1586 | 1595 | if (!argExpr) |
1587 | 1596 | assert(false && "sourceExpr should be populated for ApplyExpr consumptions"); |
1588 | 1597 |
|
1589 | | - function->getASTContext().Diags.diagnose( |
1590 | | - argExpr->getLoc(), diag::call_site_consumption_yields_race, |
1591 | | - findOriginalValueType(argExpr), |
1592 | | - isolationCrossing.value().getCallerIsolation(), |
1593 | | - isolationCrossing.value().getCalleeIsolation(), |
1594 | | - numDisplayed, numDisplayed != 1, numHidden > 0, numHidden) |
| 1598 | + function->getASTContext() |
| 1599 | + .Diags |
| 1600 | + .diagnose(argExpr->getLoc(), diag::call_site_consumption_yields_race, |
| 1601 | + argExpr->findOriginalType(), |
| 1602 | + isolationCrossing.value().getCallerIsolation(), |
| 1603 | + isolationCrossing.value().getCalleeIsolation(), numDisplayed, |
| 1604 | + numDisplayed != 1, numHidden > 0, numHidden) |
1595 | 1605 | .highlight(argExpr->getSourceRange()); |
1596 | 1606 | return true; |
1597 | 1607 | } |
|
0 commit comments