|
1 | 1 | // REQUIRES: VENDOR=apple |
2 | 2 | // RUN: %empty-directory(%t) |
| 3 | +// RUN: split-file %s %t |
3 | 4 |
|
4 | | -// RUN: echo "import Foundation" > %t/main.swift |
5 | | -// RUN: echo "@objc(CApi) public class Api {}" >> %t/main.swift |
6 | 5 | // RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -import-objc-header %S/Inputs/objc_class_header.h -validate-tbd-against-ir=missing %t/main.swift -disable-objc-attr-requires-foundation-module -emit-tbd -emit-tbd-path %t/main.tbd -tbd-install_name objc_classes |
7 | 6 |
|
8 | | -// RUN: %validate-json %t/main.tbd | %FileCheck %s |
| 7 | +// RUN: %validate-json %t/main.tbd | %FileCheck %s --check-prefix FORMAT |
| 8 | +// RUN: %llvm-nm %t/main.tbd | %FileCheck %s --check-prefix SYMS |
9 | 9 |
|
10 | | -// CHECK-NOT: '_OBJC_CLASS_$_CApi' |
11 | | -// CHECK-NOT: '_OBJC_METACLASS_$_CApi' |
| 10 | +// FORMAT-NOT: '_OBJC_CLASS' |
| 11 | +// FORMAT: "objc_class" |
12 | 12 |
|
13 | | -// CHECK: "objc_class": [ |
14 | | -// CHECK-NEXT: "CApi" |
15 | | -// CHECK-NEXT: ] |
16 | 13 |
|
| 14 | +// SYMS: D _OBJC_CLASS_$_CApi |
| 15 | +// SYMS: D _OBJC_CLASS_$__TtC4test11AnotherCAPI |
| 16 | +// SYMS: D _OBJC_METACLASS_$_CApi |
| 17 | +// SYMS: D _OBJC_METACLASS_$__TtC4test11AnotherCAPI |
| 18 | + |
| 19 | +/// Expect stand-alone metaclass for NotCAPIBase. |
| 20 | +// SYMS: D _OBJC_METACLASS_$__TtC4test11NotCAPIBase |
| 21 | + |
| 22 | +// SYMS-NOT: _OBJC |
| 23 | + |
| 24 | + |
| 25 | +//--- main.swift |
| 26 | +import Foundation |
| 27 | + |
| 28 | +// These declarations imply direct obj-c availability. |
| 29 | +@objc(CApi) public class Api {} |
| 30 | +public class AnotherCAPI : NSObject {} |
| 31 | + |
| 32 | +public struct Empty {} |
| 33 | +// A generic one does not, however the obj-c metaclass should still be exported. |
| 34 | +public class NotCAPI<T> : AnotherCAPI {} |
| 35 | +public class NotCAPIBase : NotCAPI<Empty> {} |
0 commit comments