xref: /llvm-project/clang/test/InstallAPI/exclusive-passes-platform.test (revision 062f6fe324e98b0994e49bc14eb45b20aa0807c4)
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; RUN: yaml2obj %t/Xplatform.yaml -o=%t/Xplatform
5
6// Check that in zippered mode, a successful pass runs in both macos & maccatalyst.
7; RUN: clang-installapi %t/inputs.json \
8; RUN: --target=x86_64-apple-macos10.15 -darwin-target-variant x86_64-apple-ios13.1-macabi \
9; RUN: -Xplatform_ios-macabi -iframework %t/System/iOSSupport/System/Library/Frameworks \
10; RUN: -install_name /System/Library/Frameworks/Xplatform.framework/Versions/A/Xplatform \
11; RUN: -fdefine-target-os-macros --verify-against=%t/Xplatform --verify-mode=Pedantic \
12; RUN: -o Xplatform.tbd  -F%t/Frameworks \
13: RUN: -current_version 1 -compatibility_version 1 2>&1 | FileCheck --allow-empty %s\
14; RUN: --implicit-check-not warning: --implicit-check-not error:
15
16// A missing header error should be invoked in macos pass because it wasn't given the needed search path.
17; RUN: mv %t/Xplatform-macosx.h %t/Frameworks/Xplatform.framework/Headers/Xplatform.h
18
19; RUN: not clang-installapi %t/inputs.json \
20; RUN: --target=x86_64-apple-macos10.15 -darwin-target-variant x86_64-apple-ios13.1-macabi \
21; RUN: -Xplatform_ios-macabi -iframework %t/System/iOSSupport/System/Library/Frameworks \
22; RUN: -install_name /System/Library/Frameworks/Xplatform.framework/Versions/A/Xplatform \
23; RUN: -fdefine-target-os-macros --verify-against=%t/Xplatform --verify-mode=Pedantic \
24; RUN: -o Xplatform.tbd  -F%t/Frameworks \
25: RUN: -current_version 1 -compatibility_version 1 2>&1 | FileCheck -check-prefix=MACOSFAIL %s
26
27; MACOSFAIL: fatal error: 'IOSMac/IOSMac.h' file not found
28
29;--- Frameworks/Xplatform.framework/Headers/Xplatform.h
30#if TARGET_OS_MACCATALYST
31#include <IOSMac/IOSMac.h>
32#endif
33
34inline int foo() {
35  int x = 1;
36#if TARGET_OS_MACCATALYST
37  x += iOSAPI();
38#endif
39  return x;
40}
41
42extern int bar();
43
44;--- Xplatform-macosx.h
45#include <IOSMac/IOSMac.h>
46inline int foo() {
47  int x = 1;
48  return x;
49}
50
51extern int bar();
52
53;--- System/iOSSupport/System/Library/Frameworks/IOSMac.framework/Headers/IOSMac.h
54extern int iOSAPI();
55
56;--- Xplatform.yaml
57--- !mach-o
58FileHeader:
59  magic:           0xFEEDFACF
60  cputype:         0x1000007
61  cpusubtype:      0x3
62  filetype:        0x6
63  ncmds:           16
64  sizeofcmds:      968
65  flags:           0x100085
66  reserved:        0x0
67LoadCommands:
68  - cmd:             LC_SEGMENT_64
69    cmdsize:         232
70    segname:         __TEXT
71    vmaddr:          0
72    vmsize:          32768
73    fileoff:         0
74    filesize:        32768
75    maxprot:         5
76    initprot:        5
77    nsects:          2
78    flags:           0
79    Sections:
80      - sectname:        __text
81        segname:         __TEXT
82        addr:            0x4FAD
83        size:            11
84        offset:          0x4FAD
85        align:           0
86        reloff:          0x0
87        nreloc:          0
88        flags:           0x80000400
89        reserved1:       0x0
90        reserved2:       0x0
91        reserved3:       0x0
92        content:         554889E5B8010000005DC3
93      - sectname:        __unwind_info
94        segname:         __TEXT
95        addr:            0x4FB8
96        size:            72
97        offset:          0x4FB8
98        align:           2
99        reloff:          0x0
100        nreloc:          0
101        flags:           0x0
102        reserved1:       0x0
103        reserved2:       0x0
104        reserved3:       0x0
105        content:         010000001C000000000000001C000000000000001C00000002000000AD4F00003400000034000000B94F00000000000034000000030000000C000100100001000000000000000001
106  - cmd:             LC_SEGMENT_64
107    cmdsize:         152
108    segname:         __DATA
109    vmaddr:          32768
110    vmsize:          16384
111    fileoff:         32768
112    filesize:        16384
113    maxprot:         3
114    initprot:        3
115    nsects:          1
116    flags:           0
117    Sections:
118      - sectname:        __objc_imageinfo
119        segname:         __DATA
120        addr:            0x8000
121        size:            8
122        offset:          0x8000
123        align:           2
124        reloff:          0x0
125        nreloc:          0
126        flags:           0x0
127        reserved1:       0x0
128        reserved2:       0x0
129        reserved3:       0x0
130        content:         '0000000040000000'
131  - cmd:             LC_SEGMENT_64
132    cmdsize:         72
133    segname:         __LINKEDIT
134    vmaddr:          49152
135    vmsize:          16384
136    fileoff:         49152
137    filesize:        88
138    maxprot:         1
139    initprot:        1
140    nsects:          0
141    flags:           0
142  - cmd:             LC_ID_DYLIB
143    cmdsize:         96
144    dylib:
145      name:            24
146      timestamp:       1
147      current_version: 65536
148      compatibility_version: 65536
149    Content:   '/System/Library/Frameworks/Xplatform.framework/Versions/A/Xplatform'
150    ZeroPadBytes:    5
151  - cmd:             LC_DYLD_INFO_ONLY
152    cmdsize:         48
153    rebase_off:      0
154    rebase_size:     0
155    bind_off:        0
156    bind_size:       0
157    weak_bind_off:   0
158    weak_bind_size:  0
159    lazy_bind_off:   0
160    lazy_bind_size:  0
161    export_off:      49152
162    export_size:     16
163  - cmd:             LC_SYMTAB
164    cmdsize:         24
165    symoff:          49184
166    nsyms:           2
167    stroff:          49216
168    strsize:         24
169  - cmd:             LC_DYSYMTAB
170    cmdsize:         80
171    ilocalsym:       0
172    nlocalsym:       0
173    iextdefsym:      0
174    nextdefsym:      1
175    iundefsym:       1
176    nundefsym:       1
177    tocoff:          0
178    ntoc:            0
179    modtaboff:       0
180    nmodtab:         0
181    extrefsymoff:    0
182    nextrefsyms:     0
183    indirectsymoff:  0
184    nindirectsyms:   0
185    extreloff:       0
186    nextrel:         0
187    locreloff:       0
188    nlocrel:         0
189  - cmd:             LC_UUID
190    cmdsize:         24
191    uuid:            4AA4F126-BD02-359C-B3EF-E53AD399B590
192  - cmd:             LC_BUILD_VERSION
193    cmdsize:         32
194    platform:        1
195    minos:           659200
196    sdk:             721152
197    ntools:          1
198    Tools:
199      - tool:            3
200        version:         46008832
201  - cmd:             LC_BUILD_VERSION
202    cmdsize:         32
203    platform:        6
204    minos:           0x00d0100
205    sdk:             851968
206    ntools:          1
207    Tools:
208      - tool:            3
209        version:         46008832
210  - cmd:             LC_SOURCE_VERSION
211    cmdsize:         16
212    version:         0
213  - cmd:             LC_SEGMENT_SPLIT_INFO
214    cmdsize:         16
215    dataoff:         49168
216    datasize:        8
217  - cmd:             LC_LOAD_DYLIB
218    cmdsize:         56
219    dylib:
220      name:            24
221      timestamp:       2
222      current_version: 14942208
223      compatibility_version: 65536
224    Content:   '/usr/lib/libobjc.A.dylib'
225    ZeroPadBytes:    8
226  - cmd:             LC_LOAD_DYLIB
227    cmdsize:         56
228    dylib:
229      name:            24
230      timestamp:       2
231      current_version: 84687873
232      compatibility_version: 65536
233    Content:   '/usr/lib/libSystem.B.dylib'
234    ZeroPadBytes:    6
235  - cmd:             LC_FUNCTION_STARTS
236    cmdsize:         16
237    dataoff:         49176
238    datasize:        8
239  - cmd:             LC_DATA_IN_CODE
240    cmdsize:         16
241    dataoff:         49184
242    datasize:        0
243LinkEditData:
244  ExportTrie:
245    TerminalSize:    0
246    NodeOffset:      0
247    Name:            ''
248    Flags:           0x0
249    Address:         0x0
250    Other:           0x0
251    ImportName:      ''
252    Children:
253      - TerminalSize:    4
254        NodeOffset:      8
255        Name:            _bar
256        Flags:           0x0
257        Address:         0x4FAD
258        Other:           0x0
259        ImportName:      ''
260  NameList:
261    - n_strx:          2
262      n_type:          0xF
263      n_sect:          1
264      n_desc:          0
265      n_value:         20397
266    - n_strx:          7
267      n_type:          0x1
268      n_sect:          0
269      n_desc:          512
270      n_value:         0
271  StringTable:
272    - ' '
273    - _bar
274    - dyld_stub_binder
275...
276
277;--- inputs.json.in
278{
279  "headers": [
280  {
281    "path" : "DSTROOT/Frameworks/Xplatform.framework/Headers/Xplatform.h",
282    "type" : "public"
283  }
284  ],
285  "version": "3"
286}
287