Skip to content

Commit b507fa2

Browse files
authored
Merge pull request swiftlang#19797 from eeckstein/remove-dead-bridging-calls
2 parents 6ba5ebd + 6e6aae8 commit b507fa2

34 files changed

+75
-3
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,12 @@ bool IRGenerator::canEmitWitnessTableLazily(SILWitnessTable *wt) {
711711
if (Opts.UseJIT)
712712
return false;
713713

714+
// Regardless of the access level, if the witness table is shared it means
715+
// we can safely not emit it. Every other module which needs it will generate
716+
// its own shared copy of it.
717+
if (wt->getLinkage() == SILLinkage::Shared)
718+
return true;
719+
714720
NominalTypeDecl *ConformingTy =
715721
wt->getConformance()->getType()->getNominalOrBoundGenericNominal();
716722

stdlib/public/SDK/Dispatch/Data.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ extension DispatchData {
356356
return true
357357
}
358358

359+
@_effects(readonly)
359360
public static func _unconditionallyBridgeFromObjectiveC(_ source: __DispatchData?) -> DispatchData {
360361
var result: DispatchData?
361362
_forceBridgeFromObjectiveC(source!, result: &result)

stdlib/public/SDK/Foundation/AffineTransform.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ extension AffineTransform : _ObjectiveCBridgeable {
317317
return true // Can't fail
318318
}
319319

320+
@_effects(readonly)
320321
public static func _unconditionallyBridgeFromObjectiveC(_ x: NSAffineTransform?) -> AffineTransform {
321322
guard let src = x else { return AffineTransform.identity }
322323
return AffineTransform(reference: src)

stdlib/public/SDK/Foundation/Calendar.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ extension Calendar : _ObjectiveCBridgeable {
11131113
return true
11141114
}
11151115

1116+
@_effects(readonly)
11161117
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSCalendar?) -> Calendar {
11171118
var result: Calendar?
11181119
_forceBridgeFromObjectiveC(source!, result: &result)

stdlib/public/SDK/Foundation/CharacterSet.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ extension CharacterSet : _ObjectiveCBridgeable {
782782
return true
783783
}
784784

785+
@_effects(readonly)
785786
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSCharacterSet?) -> CharacterSet {
786787
guard let src = source else { return CharacterSet() }
787788
return CharacterSet(_bridged: src)

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,8 @@ extension Data : _ObjectiveCBridgeable {
19021902
result = Data(referencing: input)
19031903
return true
19041904
}
1905-
1905+
1906+
@_effects(readonly)
19061907
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSData?) -> Data {
19071908
guard let src = source else { return Data() }
19081909
return Data(referencing: src)

stdlib/public/SDK/Foundation/Date.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ extension Date : _ObjectiveCBridgeable {
257257
return true
258258
}
259259

260+
@_effects(readonly)
260261
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSDate?) -> Date {
261262
var result: Date?
262263
_forceBridgeFromObjectiveC(source!, result: &result)

stdlib/public/SDK/Foundation/DateComponents.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ extension DateComponents : _ObjectiveCBridgeable {
338338
return true
339339
}
340340

341+
@_effects(readonly)
341342
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSDateComponents?) -> DateComponents {
342343
guard let src = source else { return DateComponents() }
343344
return DateComponents(reference: src)

stdlib/public/SDK/Foundation/DateInterval.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ extension DateInterval : _ObjectiveCBridgeable {
216216
return true
217217
}
218218

219+
@_effects(readonly)
219220
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSDateInterval?) -> DateInterval {
220221
var result: DateInterval?
221222
_forceBridgeFromObjectiveC(source!, result: &result)

stdlib/public/SDK/Foundation/Decimal.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ extension Decimal : _ObjectiveCBridgeable {
487487
return true
488488
}
489489

490+
@_effects(readonly)
490491
public static func _unconditionallyBridgeFromObjectiveC(_ source: NSDecimalNumber?) -> Decimal {
491492
guard let src = source else { return Decimal(_exponent: 0, _length: 0, _isNegative: 0, _isCompact: 0, _reserved: 0, _mantissa: (0, 0, 0, 0, 0, 0, 0, 0)) }
492493
return src.decimalValue

0 commit comments

Comments
 (0)