2 ; RUN: split-file %s %t
3 ; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json
4 ; RUN: yaml2obj %t/swift-objc-class.yaml -o %t/libswift-objc.dylib
6 // Try out dylib that only has 1 symbol for a ObjCClass, with no declarations in header.
7 ; RUN: clang-installapi -target arm64-apple-macos14 -dynamiclib \
8 ; RUN: -install_name tmp.dylib --verify-against=%t/libswift-objc.dylib \
9 ; RUN: -I%t/usr/include %t/inputs.json -o %t/missing.tbd \
10 ; RUN: --verify-mode=ErrorsAndWarnings 2>&1 | FileCheck --check-prefix MISSING_DECL %s
11 ; RUN: llvm-readtapi --compare %t/missing.tbd %t/missing-expected.tbd
13 // Try out a dylib that only has 1 symbol for a ObjCClass,
14 // but a complete ObjCClass decl in header.
15 ; RUN: clang-installapi -target arm64-apple-macos14 -dynamiclib \
16 ; RUN: -install_name tmp.dylib --verify-against=%t/libswift-objc.dylib \
17 ; RUN: -I%t/usr/include %t/inputs.json -o %t/mismatching.tbd \
18 ; RUN: --verify-mode=Pedantic -DFULL_DECL 2>&1 | FileCheck --check-prefix MISMATCH_DECL %s
19 ; RUN: llvm-readtapi -compare %t/mismatching.tbd %t/mismatching-expected.tbd
21 // Try out a dylib that only has 1 symbol for a ObjCClass, but is represented in header.
22 ; RUN: clang-installapi -target arm64-apple-macos14 -dynamiclib \
23 ; RUN: -install_name tmp.dylib --verify-against=%t/libswift-objc.dylib \
24 ; RUN: -I%t/usr/include %t/inputs.json -o %t/matching.tbd \
25 ; RUN: --verify-mode=Pedantic \
26 ; RUN: -DHAS_META_DECL 2>&1 | FileCheck --allow-empty %s
28 ; MISSING_DECL: violations found for arm64
29 ; MISSING_DECL-NEXT: warning: no declaration was found for exported symbol 'Metaclass of Suggestion' in dynamic library
31 ; MISMATCH_DECL: violations found for arm64-apple-macos14
32 ; MISMATCH_DECL: warning: declaration has external linkage, but dynamic library doesn't have symbol 'Class of Suggestion'
38 ;--- usr/include/mismatch.h
40 int metaclass __asm("_OBJC_METACLASS_$_Suggestion");
51 "path" : "DSTROOT/usr/include/mismatch.h",
58 ;--- missing-expected.tbd
61 targets: [ arm64-macos ]
62 flags: [ not_app_extension_safe ]
63 install-name: tmp.dylib
65 compatibility-version: 0
68 ;--- mismatching-expected.tbd
71 targets: [ arm64-macos ]
72 flags: [ not_app_extension_safe ]
73 install-name: tmp.dylib
75 compatibility-version: 0
77 - targets: [ arm64-macos ]
78 objc-classes: [ Suggestion ]
81 ;--- swift-objc-class.yaml
142 - cmd: LC_DYLD_INFO_ONLY
186 compatibility_version: 0
191 uuid: 4C4C4443-5555-3144-A142-97179769CBE0
192 - cmd: LC_BUILD_VERSION
206 current_version: 197656576
207 compatibility_version: 19660800
208 Content: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'
215 current_version: 88473600
216 compatibility_version: 65536
217 Content: '/usr/lib/libSystem.B.dylib'
219 - cmd: LC_FUNCTION_STARTS
223 - cmd: LC_DATA_IN_CODE
227 - cmd: LC_CODE_SIGNATURE
243 Name: '_OBJC_METACLASS_$_Suggestion'
261 - '_OBJC_METACLASS_$_Suggestion'
263 FunctionStarts: [ 0x330 ]
266 // xcrun -sdk macosx clang tmp.c -dynamiclib -install_name tmp.dylib
268 // __attribute__((visibility("default")))
269 // const char Meta __asm("_OBJC_METACLASS_$_Suggestion") = 'a';