Skip to content

Commit d1698ba

Browse files
committed
Use a _bridgeable suffix for newly introduced fast bridging functions. NFC.
Dave explained that stdlib usually uses the suffix notation in such cases. This change follows his advice. Swift SVN r27177
1 parent c650436 commit d1698ba

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

include/swift/AST/KnownDecls.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ FUNC_DECL(ConditionallyBridgeFromObjectiveC,
5858
FUNC_DECL(BecomeNSError,
5959
"_becomeNSError")
6060

61-
FUNC_DECL(KnownForceBridgeFromObjectiveC,
62-
"_knownForceBridgeFromObjectiveC")
63-
FUNC_DECL(KnownConditionallyBridgeFromObjectiveC,
64-
"_knownConditionallyBridgeFromObjectiveC")
61+
FUNC_DECL(ForceBridgeFromObjectiveCBridgeable,
62+
"_forceBridgeFromObjectiveC_bridgeable")
63+
FUNC_DECL(ConditionallyBridgeFromObjectiveCBridgeable,
64+
"_conditionallyBridgeFromObjectiveC_bridgeable")
6565

6666
FUNC_DECL(DidEnterMain, "_didEnterMain")
6767
FUNC_DECL(DiagnoseUnexpectedNilOptional, "_diagnoseUnexpectedNilOptional")

lib/SILPasses/Utils/Local.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,9 +778,10 @@ static Type getCastFromObjC(SILModule &M, CanType source, CanType target) {
778778
return BridgedTy.getValue();
779779
}
780780

781-
/// Create a call of _forceBridgeFromObjectiveC or
782-
/// _knownConditionallyBridgeFromObjectiveC which converts an an ObjC instance
783-
/// into a corresponding Swift type, conforming to _ObjectiveCBridgeable.
781+
/// Create a call of _forceBridgeFromObjectiveC_bridgeable or
782+
/// _conditionallyBridgeFromObjectiveC_bridgeable which converts an an ObjC
783+
/// instance into a corresponding Swift type, conforming to
784+
/// _ObjectiveCBridgeable.
784785
SILInstruction *
785786
CastOptimizer::
786787
optimizeBridgedObjCToSwiftCast(SILInstruction *Inst,
@@ -836,7 +837,7 @@ optimizeBridgedObjCToSwiftCast(SILInstruction *Inst,
836837

837838
// Now emit the a cast from the casted ObjC object into a target type.
838839
// This is done by means of calling _forceBridgeFromObjectiveC or
839-
// _knownConditionallyBridgeFromObjectiveC from the Target type.
840+
// _conditionallyBridgeFromObjectiveC_birdgeable from the Target type.
840841
// Lookup the required function in the Target type.
841842

842843
// Lookup the _ObjectiveCBridgeable protocol.
@@ -854,8 +855,8 @@ optimizeBridgedObjCToSwiftCast(SILInstruction *Inst,
854855
// to _BridgedToObjectiveC can be proven.
855856
FuncDecl *BridgeFuncDecl =
856857
isConditional
857-
? M.getASTContext().getKnownConditionallyBridgeFromObjectiveC(nullptr)
858-
: M.getASTContext().getKnownForceBridgeFromObjectiveC(nullptr);
858+
? M.getASTContext().getConditionallyBridgeFromObjectiveCBridgeable(nullptr)
859+
: M.getASTContext().getForceBridgeFromObjectiveCBridgeable(nullptr);
859860

860861
assert(BridgeFuncDecl && "_forceBridgeFromObjectiveC should exist");
861862

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,8 @@ namespace {
14831483
// Retrieve the bridging operation to be used if a static conformance
14841484
// to _BridgedToObjectiveC can be proven.
14851485
fn = conditional
1486-
? tc.Context.getKnownConditionallyBridgeFromObjectiveC(&tc)
1487-
: tc.Context.getKnownForceBridgeFromObjectiveC(&tc);
1486+
? tc.Context.getConditionallyBridgeFromObjectiveCBridgeable(&tc)
1487+
: tc.Context.getForceBridgeFromObjectiveCBridgeable(&tc);
14881488
} else {
14891489
// Retrieve the bridging operation to be used if a static conformance
14901490
// to _BridgedToObjectiveC cannot be proven.

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ public func _forceBridgeFromObjectiveC<T>(x: AnyObject, _: T.Type) -> T {
145145

146146
/// Convert `x` from its Objective-C representation to its Swift
147147
/// representation.
148-
@asmname("_knownForceBridgeFromObjectiveC")
149-
public func _knownForceBridgeFromObjectiveC<T:_ObjectiveCBridgeable>(x: T._ObjectiveCType, _: T.Type) -> T {
148+
@asmname("_forceBridgeFromObjectiveC_bridgeable")
149+
public func _forceBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable>(x: T._ObjectiveCType, _: T.Type) -> T {
150150
var result: T?
151151
T._forceBridgeFromObjectiveC(x, result: &result)
152152
return result!
@@ -181,8 +181,8 @@ public func _conditionallyBridgeFromObjectiveC<T>(
181181

182182
/// Attempt to convert `x` from its Objective-C representation to its Swift
183183
/// representation.
184-
@asmname("_knownConditionallyBridgeFromObjectiveC")
185-
public func _knownConditionallyBridgeFromObjectiveC<T:_ObjectiveCBridgeable>(
184+
@asmname("_conditionallyBridgeFromObjectiveC_bridgeable")
185+
public func _conditionallyBridgeFromObjectiveC_bridgeable<T:_ObjectiveCBridgeable>(
186186
x: T._ObjectiveCType,
187187
_: T.Type
188188
) -> T? {

0 commit comments

Comments
 (0)