Skip to content

Commit 60f049d

Browse files
authored
Merge pull request swiftlang#76349 from tshortli/resolve-warnings
Resolve recently introduced warnings
2 parents 8d28ed4 + 28bc3ca commit 60f049d

19 files changed

+36
-30
lines changed

lib/AST/InlinableText.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@ struct ExtractInactiveRanges : public ASTWalker {
192192
};
193193
} // end anonymous namespace
194194

195+
#if SWIFT_BUILD_SWIFT_SYNTAX
196+
#pragma clang diagnostic push
197+
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
198+
extern "C" BridgedStringRef
199+
swift_ASTGen_extractInlinableText(BridgedASTContext ctx,
200+
BridgedStringRef sourceText);
201+
#pragma clang diagnostic pop
202+
#else
195203
/// Appends the textual contents of the provided source range, stripping
196204
/// the contents of comments that appear in the source.
197205
///
@@ -292,10 +300,7 @@ static void appendRange(
292300
scratch.append(text.begin(), text.end());
293301
}
294302
}
295-
296-
extern "C"
297-
BridgedStringRef swift_ASTGen_extractInlinableText(
298-
BridgedASTContext ctx, BridgedStringRef sourceText);
303+
#endif // SWIFT_BUILD_SWIFT_SYNTAX
299304

300305
StringRef swift::extractInlinableText(ASTContext &ctx, ASTNode node,
301306
SmallVectorImpl<char> &scratch) {

lib/Sema/ImportResolution.cpp

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,26 @@ void UnboundImport::validateInterfaceWithPackageName(ModuleDecl *topLevelModule,
790790
}
791791
}
792792

793+
/// Returns true if the importer and importee tuple are on an allow list for
794+
/// use of `@_implementationOnly import`, which is deprecated. Some existing
795+
/// uses of `@_implementationOnly import` cannot be safely replaced by
796+
/// `internal import` because the existence of the imported module must always
797+
/// be hidden from clients.
798+
static bool shouldSuppressNonResilientImplementationOnlyImportDiagnostic(
799+
StringRef targetName, StringRef importerName) {
800+
if (targetName == "SwiftConcurrencyInternalShims")
801+
return importerName == "_Concurrency";
802+
803+
if (targetName == "CCryptoBoringSSL" || targetName == "CCryptoBoringSSLShims")
804+
return importerName == "Crypto" || importerName == "_CryptoExtras" ||
805+
importerName == "CryptoBoringWrapper";
806+
807+
if (targetName == "CNIOBoringSSL" || targetName == "CNIOBoringSSLShims")
808+
return importerName != "NIOSSL";
809+
810+
return false;
811+
}
812+
793813
void UnboundImport::validateResilience(NullablePtr<ModuleDecl> topLevelModule,
794814
SourceFile &SF) {
795815
if (!topLevelModule)
@@ -825,14 +845,8 @@ void UnboundImport::validateResilience(NullablePtr<ModuleDecl> topLevelModule,
825845
inFlight.fixItReplace(import.implementationOnlyRange, "internal");
826846
}
827847
} else if ( // Non-resilient client
828-
!(((targetName.str() == "CCryptoBoringSSL" ||
829-
targetName.str() == "CCryptoBoringSSLShims") &&
830-
(importerName.str() == "Crypto" ||
831-
importerName.str() == "_CryptoExtras" ||
832-
importerName.str() == "CryptoBoringWrapper")) ||
833-
((targetName.str() == "CNIOBoringSSL" ||
834-
targetName.str() == "CNIOBoringSSLShims") &&
835-
importerName.str() == "NIOSSL"))) {
848+
!shouldSuppressNonResilientImplementationOnlyImportDiagnostic(
849+
targetName.str(), importerName.str())) {
836850
ctx.Diags.diagnose(import.importLoc,
837851
diag::implementation_only_requires_library_evolution,
838852
importerName);

stdlib/public/Concurrency/Actor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
/// Common marker protocol providing a shared "base" for both (local) `Actor`
1716
/// and (potentially remote) `DistributedActor` types.

stdlib/public/Concurrency/AsyncLet.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
// ==== Async Let -------------------------------------------------------------
1716
// Only has internal / builtin functions as it is not really accessible directly

stdlib/public/Concurrency/DiscardingTaskGroup.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
// ==== DiscardingTaskGroup ---------------------------------------------------
1716

stdlib/public/Concurrency/Errors.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
@available(SwiftStdlib 5.1, *)
1716
@_silgen_name("swift_deletedAsyncMethodError")

stdlib/public/Concurrency/GlobalConcurrentExecutor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
// None of TaskExecutor APIs are available in task-to-thread concurrency model.
1716
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
// TODO(swift): rename the file to ExecutorJob.swift eventually, we don't use PartialTask terminology anymore
1716

stdlib/public/Concurrency/SourceCompatibilityShims.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//===----------------------------------------------------------------------===//
1515

1616
import Swift
17-
@_implementationOnly import _SwiftConcurrencyShims
1817

1918
@available(SwiftStdlib 5.1, *)
2019
extension Task where Success == Never, Failure == Never {

stdlib/public/Concurrency/Task+TaskExecutor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Swift
14-
@_implementationOnly import _SwiftConcurrencyShims
1514

1615
// None of TaskExecutor APIs are available in task-to-thread concurrency model.
1716
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

0 commit comments

Comments
 (0)