mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sil-cast-optimizer] Fix casting between Swift and CF types
If a Swift type T needs to be casted to a CF type, then we first cast T to its bridged NS type and then ref_cast the result to a corresponding CF type. For example, if we need to cast String to CFString, we first cast String to NSString and then ref_cast the NSString to CFString. Fixes rdar://problem/29745498
This commit is contained in:
@@ -262,7 +262,7 @@ classifyClassHierarchyCast(CanType source, CanType target) {
|
||||
return DynamicCastFeasibility::WillFail;
|
||||
}
|
||||
|
||||
static CanType getNSBridgedClassOfCFClass(Module *M, CanType type) {
|
||||
CanType swift::getNSBridgedClassOfCFClass(Module *M, CanType type) {
|
||||
if (auto classDecl = type->getClassOrBoundGenericClass()) {
|
||||
if (classDecl->getForeignClassKind() == ClassDecl::ForeignKind::CFType) {
|
||||
if (auto bridgedAttr =
|
||||
|
||||
Reference in New Issue
Block a user