xref: /llvm-project/clang/test/InstallAPI/functions.test (revision feed66f3eae5006bb05e6cb34801930fd940daa8)
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: -I%t/usr/include -I%t/usr/local/include -dynamiclib \
7// RUN: -install_name @rpath/lib/libfunctions.dylib --filetype=tbd-v4 \
8// RUN: %t/inputs.json -o %t/outputs.tbd 2>&1 | FileCheck %s --allow-empty
9// RUN: llvm-readtapi -compare %t/outputs.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty
10
11// CHECK-NOT: error:
12// CHECK-NOT: warning:
13
14//--- usr/include/functions.h
15inline int inlined_func(void) { return 1;}
16int public(int a);
17
18//--- usr/local/include/private_functions.h
19__attribute__((visibility("hidden")))
20void hidden(void);
21
22//--- inputs.json.in
23{
24  "headers": [ {
25    "path" : "DSTROOT/usr/include/functions.h",
26    "type" : "public"
27  },
28  {
29    "path" : "DSTROOT/usr/local/include/private_functions.h",
30    "type" : "private"
31  }
32  ],
33  "version": "3"
34}
35
36//--- expected.tbd
37{
38  "main_library": {
39    "compatibility_versions": [
40      {
41        "version": "0"
42      }
43    ],
44    "current_versions": [
45      {
46        "version": "0"
47      }
48    ],
49    "exported_symbols": [
50      {
51        "text": {
52          "global": [
53            "_public"
54          ]
55        }
56      }
57    ],
58    "flags": [
59      {
60        "attributes": [
61          "not_app_extension_safe"
62        ]
63      }
64    ],
65    "install_names": [
66      {
67        "name": "@rpath/lib/libfunctions.dylib"
68      }
69    ],
70    "target_info": [
71      {
72        "min_deployment": "13.1",
73        "target": "arm64-macos"
74      }
75    ]
76  },
77  "tapi_tbd_version": 5
78}
79