Debian Codegraph @

clang/test/InstallAPI/project-header-only-args.test

raw
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: mkdir -p %t/modules.cache
5
6 ; RUN: clang-installapi \
7 ; RUN: -target arm64-apple-macos12 -install_name @rpath/libfoo.dylib \
8 ; RUN: -current_version 1 -compatibility_version 1 \
9 ; RUN: -Xproject -fmodules -I%t/usr/include \
10 ; RUN: -Xproject -fmodules-cache-path=%t/modules.cache \
11 ; RUN: -F %S/Inputs/Foundation/ \
12 ; RUN: -exclude-public-header %t/usr/include/public.h \
13 ; RUN: -extra-project-header %t/project.h -I%t -dynamiclib \
14 ; RUN: %t/inputs.json \
15 ; RUN: -o %t/output.tbd 2>&1 | FileCheck %s --allow-empty
16 ; RUN: llvm-readtapi --compare %t/output.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty
17
18 ; RUN: not clang-installapi \
19 ; RUN: -target arm64-apple-macos12 -install_name @rpath/libfoo.dylib \
20 ; RUN: -current_version 1 -compatibility_version 1 \
21 ; RUN: -Xproject -fmodules -I%t/usr/include \
22 ; RUN: -Xproject -fmodules-cache-path=%t/modules.cache \
23 ; RUN: -extra-project-header %t/project.h \
24 ; RUN: -F %S/Inputs/Foundation/ \
25 ; RUN: %t/inputs.json \
26 ; RUN: -I%t -dynamiclib -o %t/output.tbd 2>&1 | FileCheck %s --check-prefix=PUBLIC
27
28 ; CHECK-NOT: error
29 ; CHECK-NOT: warning
30
31 ; PUBLIC: public.h:1:1: error: use of '@import' when modules are disabled
32 ; PUBLIC-NEXT: @import Foundation;
33
34 //--- usr/include/public.h
35 @import Foundation;
36 extern int foo();
37
38 //--- project.h
39 @import Foundation;
40 extern int bar();
41
42 //--- expected.tbd
43 {
44 "main_library": {
45 "exported_symbols": [
46 {
47 "text": {
48 "global": [
49 "_bar"
50 ]
51 }
52 }
53 ],
54 "flags": [
55 {
56 "attributes": [
57 "not_app_extension_safe"
58 ]
59 }
60 ],
61 "install_names": [
62 {
63 "name": "@rpath/libfoo.dylib"
64 }
65 ],
66 "target_info": [
67 {
68 "min_deployment": "12",
69 "target": "arm64-macos"
70 }
71 ]
72 },
73 "tapi_tbd_version": 5
74 }
75
76 ;--- inputs.json.in
77 {
78 "headers": [ {
79 "path" : "DSTROOT/usr/include/public.h",
80 "type" : "public"
81 }
82 ],
83 "version": "3"
84 }