Skip to content

Commit b058b7e

Browse files
authored
[InstallAPI] capture compatibility versions (#85261)
1 parent 4f87373 commit b058b7e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

clang/test/InstallAPI/basic.test

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// RUN: split-file %s %t
33
/// Check basic arguments are captured.
44
// RUN: clang-installapi -x objective-c -target arm64-apple-ios13.0.0 \
5-
// RUN: -fapplication-extension -current_version 1 -install_name /usr/lib/basic.dylib \
5+
// RUN: -fapplication-extension -current_version 1 -compatibility_version 1 \
6+
// RUN: -install_name /usr/lib/basic.dylib \
67
// RUN: %t/basic_inputs.json -o %t/basic.tbd 2>&1 | FileCheck %s --allow-empty
78
// RUN: llvm-readtapi -compare %t/basic.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty
89

@@ -25,11 +26,6 @@
2526
//--- expected.tbd
2627
{
2728
"main_library": {
28-
"compatibility_versions": [
29-
{
30-
"version": "0"
31-
}
32-
],
3329
"install_names": [
3430
{
3531
"name": "/usr/lib/basic.dylib"

clang/tools/clang-installapi/Options.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ bool Options::processLinkerOptions(InputArgList &Args) {
8585
if (auto *Arg = Args.getLastArg(OPT_current__version))
8686
LinkerOpts.CurrentVersion.parse64(Arg->getValue());
8787

88+
if (auto *Arg = Args.getLastArg(OPT_compatibility__version))
89+
LinkerOpts.CompatVersion.parse64(Arg->getValue());
90+
8891
LinkerOpts.IsDylib = Args.hasArg(OPT_dynamiclib);
8992

9093
LinkerOpts.AppExtensionSafe =
@@ -159,6 +162,7 @@ InstallAPIContext Options::createContext() {
159162

160163
Ctx.BA.InstallName = LinkerOpts.InstallName;
161164
Ctx.BA.CurrentVersion = LinkerOpts.CurrentVersion;
165+
Ctx.BA.CompatVersion = LinkerOpts.CompatVersion;
162166
Ctx.BA.AppExtensionSafe = LinkerOpts.AppExtensionSafe;
163167
Ctx.FT = DriverOpts.OutFT;
164168
Ctx.OutputLoc = DriverOpts.OutputPath;

clang/tools/clang-installapi/Options.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ struct LinkerOptions {
4949
/// \brief The current version to use for the dynamic library.
5050
PackedVersion CurrentVersion;
5151

52+
/// \brief The compatibility version to use for the dynamic library.
53+
PackedVersion CompatVersion;
54+
5255
/// \brief Is application extension safe.
5356
bool AppExtensionSafe = false;
5457

0 commit comments

Comments
 (0)