Skip to content

Commit c4256e7

Browse files
committed
Outliner: Add comment explaining that getBridgeTo/FromObjectiveC returns an invalid SILDeclRef to signal that the type does not conform to the bridgeable protocol
1 parent a6168a9 commit c4256e7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/SILOptimizer/Transforms/Outliner.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ static bool matchSwitch(SwitchInfo &SI, SILInstruction *Inst,
491491
auto NativeType = Apply->getType().getASTType();
492492
auto *BridgeFun = FunRef->getInitiallyReferencedFunction();
493493
auto *SwiftModule = BridgeFun->getModule().getSwiftModule();
494+
// Not every type conforms to the ObjectiveCBridgeable protocol in such a case
495+
// getBridgeFromObjectiveC returns SILDeclRef().
494496
auto bridgeWitness = getBridgeFromObjectiveC(NativeType, SwiftModule);
495497
if (bridgeWitness == SILDeclRef() ||
496498
BridgeFun->getName() != bridgeWitness.mangle())
@@ -809,6 +811,8 @@ BridgedArgument BridgedArgument::match(unsigned ArgIdx, SILValue Arg,
809811
auto NativeType = BridgedValue->getType().getASTType();
810812
auto *BridgeFun = FunRef->getInitiallyReferencedFunction();
811813
auto *SwiftModule = BridgeFun->getModule().getSwiftModule();
814+
// Not every type conforms to the ObjectiveCBridgeable protocol in such a case
815+
// getBridgeToObjectiveC returns SILDeclRef().
812816
auto bridgeWitness = getBridgeToObjectiveC(NativeType, SwiftModule);
813817
if (bridgeWitness == SILDeclRef() ||
814818
BridgeFun->getName() != bridgeWitness.mangle())

0 commit comments

Comments
 (0)