This introduces a basic outline of installapi as a clang driver option. It captures relevant information as cc1 args, which are common arguments already passed to the linker to encode into TBD file outputs. This is effectively an upstream for what already exists as `tapi installapi` in Xcode toolchains, but directly in Clang. This patch does not handle any AST traversing on input yet. InstallAPI is broadly an operation that takes a series of header files that represent a single dynamic library and generates a TBD file out of it which represents all the linkable symbols and necessary attributes for statically linking in clients. It is the linkable object in all Apple SDKs and when building dylibs in Xcode. `clang -installapi` also will support verification where it compares all the information recorded for the TBD files against the already built binary, to catch possible mismatches like when a declaration is missing a definition for an exported symbol.
35 lines
801 B
Plaintext
35 lines
801 B
Plaintext
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
// RUN: %clang_cc1 -x objective-c -triple arm64-apple-ios13.0.0 -installapi \
|
|
// RUN: -fapplication-extension -current_version 1 -install_name /usr/lib/basic.dylib \
|
|
// RUN: %t/basic_inputs.json -o %t/basic.tbd 2>&1 | FileCheck %s --allow-empty
|
|
// RUN: llvm-readtapi -compare %t/basic.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty
|
|
|
|
// CHECK-NOT: error:
|
|
// CHECK-NOT: warning:
|
|
|
|
//--- basic_inputs.json
|
|
|
|
//--- expected.tbd
|
|
{
|
|
"main_library": {
|
|
"compatibility_versions": [
|
|
{
|
|
"version": "0"
|
|
}
|
|
],
|
|
"install_names": [
|
|
{
|
|
"name": "/usr/lib/basic.dylib"
|
|
}
|
|
],
|
|
"target_info": [
|
|
{
|
|
"min_deployment": "13.0.0",
|
|
"target": "arm64-ios"
|
|
}
|
|
]
|
|
},
|
|
"tapi_tbd_version": 5
|
|
}
|