Skip to content

Commit c2ce908

Browse files
authored
Merge pull request #81613 from tshortli/suppress-package-cmo-spam-6.2
[6.2] Frontend: Suppress some unsupported option warnings when verifying interfaces
2 parents 5830079 + 590deff commit c2ce908

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,10 +1455,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
14551455
if (Opts.AllowNonResilientAccess &&
14561456
FrontendOptions::doesActionBuildModuleFromInterface(
14571457
FrontendOpts.RequestedAction)) {
1458-
Diags.diagnose(
1459-
SourceLoc(), diag::warn_ignore_option_overriden_by,
1460-
"-allow-non-resilient-access",
1461-
"-compile-module-from-interface or -typecheck-module-from-interface");
1458+
if (FrontendOpts.RequestedAction !=
1459+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
1460+
Diags.diagnose(SourceLoc(), diag::warn_ignore_option_overriden_by,
1461+
"-allow-non-resilient-access",
1462+
"-compile-module-from-interface");
14621463
Opts.AllowNonResilientAccess = false;
14631464
}
14641465
}
@@ -2988,9 +2989,10 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
29882989
Args.hasArg(OPT_PackageCMO) ||
29892990
LangOpts.hasFeature(Feature::PackageCMO)) {
29902991
if (!LangOpts.AllowNonResilientAccess) {
2991-
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
2992-
"-package-cmo",
2993-
"-allow-non-resilient-access");
2992+
if (FEOpts.RequestedAction !=
2993+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
2994+
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
2995+
"-package-cmo", "-allow-non-resilient-access");
29942996
} else if (!FEOpts.EnableLibraryEvolution) {
29952997
Diags.diagnose(SourceLoc(), diag::package_cmo_requires_library_evolution);
29962998
} else {

stdlib/public/Concurrency/Executor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ extension SerialExecutor {
377377
#if SWIFT_CONCURRENCY_USES_DISPATCH
378378
@available(SwiftStdlib 6.2, *)
379379
private var _dispatchQueue: OpaquePointer? {
380-
return _getDispatchQueueForExecutor(self.asUnownedSerialExecutor())
380+
return unsafe _getDispatchQueueForExecutor(self.asUnownedSerialExecutor())
381381
}
382382
#endif
383383

@@ -387,8 +387,8 @@ extension SerialExecutor {
387387
return true
388388
}
389389
#if SWIFT_CONCURRENCY_USES_DISPATCH
390-
if let rhsQueue = rhs._dispatchQueue {
391-
if let ourQueue = _dispatchQueue, ourQueue == rhsQueue {
390+
if let rhsQueue = unsafe rhs._dispatchQueue {
391+
if let ourQueue = unsafe _dispatchQueue, ourQueue == rhsQueue {
392392
return true
393393
}
394394
return false

stdlib/public/core/EmbeddedRuntime.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ func swift_isUniquelyReferenced_nonNull_native(object: UnsafeMutablePointer<Heap
307307
}
308308

309309
@_cdecl("swift_retain")
310+
@discardableResult
310311
public func swift_retain(object: Builtin.RawPointer) -> Builtin.RawPointer {
311312
if !isValidPointerForNativeRetain(object: object) { return object }
312313

@@ -335,6 +336,7 @@ func swift_retain_n_(object: UnsafeMutablePointer<HeapObject>, n: UInt32) -> Uns
335336
}
336337

337338
@_cdecl("swift_bridgeObjectRetain")
339+
@discardableResult
338340
public func swift_bridgeObjectRetain(object: Builtin.RawPointer) -> Builtin.RawPointer {
339341
return swift_bridgeObjectRetain_n(object: object, n: 1)
340342
}

stdlib/toolchain/CompatibilitySpan/FakeStdlib.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ internal func _overrideLifetime<
7474
}
7575

7676
extension Range {
77-
@_alwaysEmitIntoClient
78-
internal init(_uncheckedBounds bounds: (lower: Bound, upper: Bound)) {
79-
self.init(uncheckedBounds: bounds)
80-
}
77+
@unsafe
78+
@_alwaysEmitIntoClient
79+
internal init(_uncheckedBounds bounds: (lower: Bound, upper: Bound)) {
80+
self.init(uncheckedBounds: bounds)
81+
}
8182
}
8283

8384
extension Optional {
@@ -90,4 +91,4 @@ extension Optional {
9091
_internalInvariantFailure("_unsafelyUnwrappedUnchecked of nil optional")
9192
}
9293
}
93-
}
94+
}

test/SILGen/package_allow_non_resilient_access.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
// RUN: -allow-non-resilient-access \
131131
// RUN: %t/Utils.package.swiftinterface -o %t/Utils.swiftmodule \
132132
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-INTERFACE
133-
// CHECK-DIAG-INTERFACE: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface or -typecheck-module-from-interface)
133+
// CHECK-DIAG-INTERFACE: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface)
134134
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-OFF
135135
// CHECK-OFF-NOT: ALLOW_NON_RESILIENT_ACCESS
136136

0 commit comments

Comments
 (0)