mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[TBDGen] The non-deallocating destructor applies to some @objc classes.
The non-deallocating destructor doesn't exists when dealloc can be overriden, which means any class that inherits from a class defined in Objective-C. This isn't necessarily all @objc classes, because of the -disable-objc-attr-requires-foundation-module flag. Fixes rdar://problem/40542246.
This commit is contained in:
37
test/TBD/class_objc.swift.gyb
Normal file
37
test/TBD/class_objc.swift.gyb
Normal file
@@ -0,0 +1,37 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %gyb %s > %t/main.swift
|
||||
|
||||
// RUN: %target-swift-frontend -emit-ir -o- -parse-as-library -module-name test -import-objc-header %S/Inputs/objc_class_header.h -validate-tbd-against-ir=all %t/main.swift -disable-objc-attr-requires-foundation-module
|
||||
|
||||
// RUN: %target-swift-frontend -enable-resilience -emit-ir -o- -parse-as-library -module-name test -import-objc-header %S/Inputs/objc_class_header.h -validate-tbd-against-ir=all %t/main.swift -disable-objc-attr-requires-foundation-module
|
||||
|
||||
// REQUIRES: objc_interop
|
||||
|
||||
import Foundation
|
||||
|
||||
% names = ["Public", "Internal", "Private"]
|
||||
|
||||
% for i, name in enumerate(names):
|
||||
% access = name.lower()
|
||||
|
||||
// a class by itself
|
||||
${access} class ${name}Empty: NSObject {}
|
||||
|
||||
// subclasses of that
|
||||
% for subname in names[i:]:
|
||||
% subaccess = subname.lower()
|
||||
${subaccess} class ${subname}Sub${name}Empty: ${name}Empty {}
|
||||
%end
|
||||
|
||||
${access} class ${name}InheritObjCProtocol: NSObject, ObjCProtocol {}
|
||||
|
||||
// some bugs were revealed when there's @objc without inheriting from
|
||||
// NSObject.
|
||||
@objc ${access} class ${name}ObjCOnly {}
|
||||
|
||||
%end
|
||||
|
||||
@usableFromInline
|
||||
@objc
|
||||
internal class InternalObjCOnlyUsableFromInline {}
|
||||
|
||||
Reference in New Issue
Block a user