[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / InstallAPI / hiddens.test
blobb3196ef945cd129979fc0665ff85fa986c480349
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
5 // RUN: yaml2obj %t/Hidden.yaml -o %t/System/Library/Frameworks/Hidden.framework/Hidden
7 // RUN: clang-installapi --target=x86_64-apple-macos13 -x objective-c \
8 // RUN: -F %t/System/Library/Frameworks \
9 // RUN: -install_name /System/Library/Frameworks/Hidden.framework/Versions/A/Hidden\
10 // RUN: -current_version 1 -compatibility_version 1 %t/inputs.json \
11 // RUN: --verify-against=%t/System/Library/Frameworks/Hidden.framework/Hidden \
12 // RUN: --verify-mode=Pedantic -o %t/output.tbd 2>&1 | FileCheck %s 
14 // CHECK-NOT: error
15 // CHECK:  warning: use of __private_extern__ 
17 // RUN: llvm-readtapi --compare %t/output.tbd %t/expected.tbd 
19 //--- inputs.json.in
21   "headers": [ {
22     "path" : "DSTROOT/System/Library/Frameworks/Hidden.framework/Headers/Hidden.h",
23     "type" : "public"
24   }
25   ],
26   "version": "3"
29 //--- System/Library/Frameworks/Hidden.framework/Headers/Hidden.h
30 __private_extern__ int foo(); // Clang doesn't warn on this, but should.
31 __private_extern__ int baz;
32 __attribute__((visibility("hidden"))) int bar();
34 /// Created from: 
35 /// #import "Hidden.h" int foo(void) { return 1; } int bar(void) { return 1; }
36 //--- Hidden.yaml
37 --- !mach-o
38 FileHeader:
39   magic:           0xFEEDFACF
40   cputype:         0x1000007
41   cpusubtype:      0x3
42   filetype:        0x6
43   ncmds:           12
44   sizeofcmds:      920
45   flags:           0x100085
46   reserved:        0x0
47 LoadCommands:
48   - cmd:             LC_SEGMENT_64
49     cmdsize:         312
50     segname:         __TEXT
51     vmaddr:          0
52     vmsize:          8192
53     fileoff:         0
54     filesize:        8192
55     maxprot:         5
56     initprot:        5
57     nsects:          3
58     flags:           0
59     Sections:
60       - sectname:        __text
61         segname:         __TEXT
62         addr:            0xBB8
63         size:            22
64         offset:          0xBB8
65         align:           0
66         reloff:          0x0
67         nreloc:          0
68         flags:           0x80000400
69         reserved1:       0x0
70         reserved2:       0x0
71         reserved3:       0x0
72         content:         554889E5B8010000005DC3554889E5B8010000005DC3
73       - sectname:        __unwind_info
74         segname:         __TEXT
75         addr:            0xBD0
76         size:            4152
77         offset:          0xBD0
78         align:           2
79         reloff:          0x0
80         nreloc:          0
81         flags:           0x0
82         reserved1:       0x0
83         reserved2:       0x0
84         reserved3:       0x0
85         content:         010000001C000000010000002000000000000000200000000200000000000001B80B00003800000038000000CE0B00000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
86       - sectname:        __eh_frame
87         segname:         __TEXT
88         addr:            0x1C08
89         size:            24
90         offset:          0x1C08
91         align:           3
92         reloff:          0x0
93         nreloc:          0
94         flags:           0x6000000B
95         reserved1:       0x0
96         reserved2:       0x0
97         reserved3:       0x0
98         content:         1400000000000000017A520001781001100C070890010000
99   - cmd:             LC_SEGMENT_64
100     cmdsize:         152
101     segname:         __DATA_CONST
102     vmaddr:          8192
103     vmsize:          4096
104     fileoff:         8192
105     filesize:        4096
106     maxprot:         3
107     initprot:        3
108     nsects:          1
109     flags:           16
110     Sections:
111       - sectname:        __objc_imageinfo
112         segname:         __DATA_CONST
113         addr:            0x2000
114         size:            8
115         offset:          0x2000
116         align:           0
117         reloff:          0x0
118         nreloc:          0
119         flags:           0x0
120         reserved1:       0x0
121         reserved2:       0x0
122         reserved3:       0x0
123         content:         '0000000040000000'
124   - cmd:             LC_SEGMENT_64
125     cmdsize:         72
126     segname:         __LINKEDIT
127     vmaddr:          12288
128     vmsize:          104
129     fileoff:         12288
130     filesize:        104
131     maxprot:         1
132     initprot:        1
133     nsects:          0
134     flags:           0
135   - cmd:             LC_DYLD_INFO_ONLY
136     cmdsize:         48
137     rebase_off:      0
138     rebase_size:     0
139     bind_off:        0
140     bind_size:       0
141     weak_bind_off:   0
142     weak_bind_size:  0
143     lazy_bind_off:   0
144     lazy_bind_size:  0
145     export_off:      12288
146     export_size:     16
147   - cmd:             LC_SYMTAB
148     cmdsize:         24
149     symoff:          12312
150     nsyms:           3
151     stroff:          12360
152     strsize:         32
153   - cmd:             LC_DYSYMTAB
154     cmdsize:         80
155     ilocalsym:       0
156     nlocalsym:       1
157     iextdefsym:      1
158     nextdefsym:      1
159     iundefsym:       2
160     nundefsym:       1
161     tocoff:          0
162     ntoc:            0
163     modtaboff:       0
164     nmodtab:         0
165     extrefsymoff:    0
166     nextrefsyms:     0
167     indirectsymoff:  0
168     nindirectsyms:   0
169     extreloff:       0
170     nextrel:         0
171     locreloff:       0
172     nlocrel:         0
173   - cmd:             LC_ID_DYLIB
174     cmdsize:         88
175     dylib:
176       name:            24
177       timestamp:       0
178       current_version: 65536
179       compatibility_version: 65536
180     Content:         '/System/Library/Frameworks/Hidden.framework/Versions/A/Hidden'
181     ZeroPadBytes:    3
182   - cmd:             LC_UUID
183     cmdsize:         24
184     uuid:            4C4C44E7-5555-3144-A133-0271E799C487
185   - cmd:             LC_BUILD_VERSION
186     cmdsize:         32
187     platform:        1
188     minos:           851968
189     sdk:             983040
190     ntools:          1
191     Tools:
192       - tool:            4
193         version:         1245184
194   - cmd:             LC_LOAD_DYLIB
195     cmdsize:         56
196     dylib:
197       name:            24
198       timestamp:       0
199       current_version: 88473600
200       compatibility_version: 65536
201     Content:         '/usr/lib/libSystem.B.dylib'
202     ZeroPadBytes:    6
203   - cmd:             LC_FUNCTION_STARTS
204     cmdsize:         16
205     dataoff:         12304
206     datasize:        8
207   - cmd:             LC_DATA_IN_CODE
208     cmdsize:         16
209     dataoff:         12312
210     datasize:        0
211 LinkEditData:
212   ExportTrie:
213     TerminalSize:    0
214     NodeOffset:      0
215     Name:            ''
216     Flags:           0x0
217     Address:         0x0
218     Other:           0x0
219     ImportName:      ''
220     Children:
221       - TerminalSize:    3
222         NodeOffset:      8
223         Name:            _foo
224         Flags:           0x0
225         Address:         0xBB8
226         Other:           0x0
227         ImportName:      ''
228   NameList:
229     - n_strx:          7
230       n_type:          0x1E
231       n_sect:          1
232       n_desc:          0
233       n_value:         3011
234     - n_strx:          2
235       n_type:          0xF
236       n_sect:          1
237       n_desc:          0
238       n_value:         3000
239     - n_strx:          12
240       n_type:          0x1
241       n_sect:          0
242       n_desc:          256
243       n_value:         0
244   StringTable:
245     - ' '
246     - _foo
247     - _bar
248     - dyld_stub_binder
249     - ''
250     - ''
251     - ''
252   FunctionStarts:  [ 0xBB8, 0xBC3 ]
255 //--- expected.tbd
256 --- !tapi-tbd
257 tbd-version:     4
258 targets:         [ x86_64-macos ]
259 flags:           [ not_app_extension_safe ]
260 install-name:    '/System/Library/Frameworks/Hidden.framework/Versions/A/Hidden'