| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json |
| 4 |
|
| 5 |
// RUN: clang-installapi -target arm64-apple-macos13.1 \ |
| 6 |
// RUN: -F%t -install_name /System/Library/Frameworks/Foo.framework/Foo \ |
| 7 |
// RUN: %t/inputs.json -o %t/outputs.tbd -v 2>&1 | FileCheck %s --check-prefix=VERBOSE |
| 8 |
// RUN: llvm-readtapi -compare %t/outputs.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty |
| 9 |
|
| 10 |
// VERBOSE: Public Headers: |
| 11 |
// VERBOSE-NEXT: #import <Foo/Foo.h> |
| 12 |
// CHECK-NOT: error: |
| 13 |
// CHECK-NOT: warning: |
| 14 |
|
| 15 |
//--- Foo.framework/Headers/Foo.h |
| 16 |
// Ignore forward declaration. |
| 17 |
@class NSObject; |
| 18 |
|
| 19 |
@interface Visible |
| 20 |
@end |
| 21 |
|
| 22 |
__attribute__((visibility("hidden"))) |
| 23 |
@interface Hidden |
| 24 |
@end |
| 25 |
|
| 26 |
__attribute__((visibility("hidden"))) |
| 27 |
@interface HiddenWithIvars { |
| 28 |
@public |
| 29 |
char _ivar; |
| 30 |
} |
| 31 |
@end |
| 32 |
|
| 33 |
__attribute__((objc_exception)) |
| 34 |
@interface Exception |
| 35 |
@end |
| 36 |
|
| 37 |
@interface PublicClass : Visible { |
| 38 |
@package |
| 39 |
int _internal; |
| 40 |
@protected |
| 41 |
int _external; |
| 42 |
@private |
| 43 |
int private; |
| 44 |
@public |
| 45 |
char _public; |
| 46 |
} |
| 47 |
@end |
| 48 |
|
| 49 |
|
| 50 |
//--- Foo.framework/PrivateHeaders/Foo_Private.h |
| 51 |
#import <Foo/Foo.h> |
| 52 |
|
| 53 |
@interface ClassWithIvars : Visible { |
| 54 |
char _ivar1; |
| 55 |
char _ivar2; |
| 56 |
@private |
| 57 |
int _privateIVar; |
| 58 |
@protected |
| 59 |
int _externalIVar; |
| 60 |
@package |
| 61 |
int _internalIVar; |
| 62 |
} |
| 63 |
@end |
| 64 |
|
| 65 |
@interface Exception () { |
| 66 |
@public |
| 67 |
char _ivarFromExtension; |
| 68 |
@private |
| 69 |
int _privateIvarFromExtension; |
| 70 |
} |
| 71 |
@end |
| 72 |
|
| 73 |
|
| 74 |
//--- inputs.json.in |
| 75 |
{ |
| 76 |
"headers": [ { |
| 77 |
"path" : "DSTROOT/Foo.framework/Headers/Foo.h", |
| 78 |
"type" : "public" |
| 79 |
}, |
| 80 |
{ |
| 81 |
"path" : "DSTROOT/Foo.framework/PrivateHeaders/Foo_Private.h", |
| 82 |
"type" : "private" |
| 83 |
} |
| 84 |
], |
| 85 |
"version": "3" |
| 86 |
} |
| 87 |
|
| 88 |
//--- expected.tbd |
| 89 |
{ |
| 90 |
"main_library": { |
| 91 |
"compatibility_versions": [ |
| 92 |
{ |
| 93 |
"version": "0" |
| 94 |
} |
| 95 |
], |
| 96 |
"current_versions": [ |
| 97 |
{ |
| 98 |
"version": "0" |
| 99 |
} |
| 100 |
], |
| 101 |
"exported_symbols": [ |
| 102 |
{ |
| 103 |
"data": { |
| 104 |
"objc_class": [ |
| 105 |
"PublicClass", |
| 106 |
"Exception", |
| 107 |
"Visible", |
| 108 |
"ClassWithIvars" |
| 109 |
], |
| 110 |
"objc_eh_type": [ |
| 111 |
"Exception" |
| 112 |
], |
| 113 |
"objc_ivar": [ |
| 114 |
"Exception._ivarFromExtension", |
| 115 |
"ClassWithIvars._ivar2", |
| 116 |
"PublicClass._external", |
| 117 |
"ClassWithIvars._ivar1", |
| 118 |
"ClassWithIvars._externalIVar", |
| 119 |
"PublicClass._public" |
| 120 |
] |
| 121 |
} |
| 122 |
} |
| 123 |
], |
| 124 |
"flags": [ |
| 125 |
{ |
| 126 |
"attributes": [ |
| 127 |
"not_app_extension_safe" |
| 128 |
] |
| 129 |
} |
| 130 |
], |
| 131 |
"install_names": [ |
| 132 |
{ |
| 133 |
"name": "/System/Library/Frameworks/Foo.framework/Foo" |
| 134 |
} |
| 135 |
], |
| 136 |
"target_info": [ |
| 137 |
{ |
| 138 |
"min_deployment": "13.1", |
| 139 |
"target": "arm64-macos" |
| 140 |
} |
| 141 |
] |
| 142 |
}, |
| 143 |
"tapi_tbd_version": 5 |
| 144 |
} |