mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[cxx-interop] Fix a crash when exposing @objc Swift classes
rdar://154252454
This commit is contained in:
@@ -596,7 +596,8 @@ public:
|
||||
else if (isa<StructDecl>(TD) && NTD->hasClangNode())
|
||||
emitReferencedClangTypeMetadata(NTD);
|
||||
else if (const auto *cd = dyn_cast<ClassDecl>(TD))
|
||||
if (cd->isObjC() || cd->isForeignReferenceType())
|
||||
if ((cd->isObjC() && cd->getClangDecl()) ||
|
||||
cd->isForeignReferenceType())
|
||||
emitReferencedClangTypeMetadata(NTD);
|
||||
} else if (auto TAD = dyn_cast<TypeAliasDecl>(TD)) {
|
||||
if (TAD->hasClangNode())
|
||||
|
||||
@@ -88,10 +88,17 @@ public func retObjCClassArray() -> [ObjCKlass] {
|
||||
return []
|
||||
}
|
||||
|
||||
public class KVOCookieMonster {
|
||||
public static func += (lhs: KVOCookieMonster, rhs: NSKeyValueObservation) {
|
||||
lhs.cookies.append(rhs)
|
||||
}
|
||||
|
||||
private var cookies = Array<NSKeyValueObservation>()
|
||||
}
|
||||
|
||||
// CHECK: @interface HasBlockField : NSObject
|
||||
// CHECK: @property (nonatomic, copy) void (^ _Nullable foo)(ObjCKlassState);
|
||||
// CHECK: @end
|
||||
|
||||
// CHECK: SWIFT_EXTERN id <ObjCProtocol> _Nonnull $s9UseObjCTy03retB9CProtocolSo0bE0_pyF(void) SWIFT_NOEXCEPT SWIFT_CALL; // retObjCProtocol()
|
||||
// CHECK-NEXT: #endif
|
||||
// CHECK-NEXT: #if defined(__OBJC__)
|
||||
|
||||
Reference in New Issue
Block a user