mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix _bridgeToObjectiveC lookup code in optimizeBridgedSwiftToObjCCast
Previously it assumed that if we succeed in looking up the method in the current module we must be able to request a definition (vs a declaration). This is not true. It could be that we had declared the type in a different module. Always ask for a declaration. rdar://27547957
This commit is contained in:
@@ -316,8 +316,10 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
|
||||
|
||||
if (auto fn = lookUpFunction(name)) {
|
||||
assert(fn->getLoweredFunctionType() == constantType);
|
||||
assert(fn->getLinkage() == constant.getLinkage(ForDefinition)
|
||||
|| fn->getLinkage() == constant.getLinkage(NotForDefinition));
|
||||
assert(fn->getLinkage() == linkage ||
|
||||
(forDefinition == ForDefinition_t::NotForDefinition &&
|
||||
fn->getLinkage() ==
|
||||
constant.getLinkage(ForDefinition_t::ForDefinition)));
|
||||
if (forDefinition) {
|
||||
// In all the cases where getConstantLinkage returns something
|
||||
// different for ForDefinition, it returns an available-externally
|
||||
|
||||
Reference in New Issue
Block a user