Skip to content

Commit

Permalink
[InstallAPI] capture compatibility versions (#85261)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyndyishida committed Mar 14, 2024
1 parent 4f87373 commit b058b7e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 2 additions & 6 deletions clang/test/InstallAPI/basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// RUN: split-file %s %t
/// Check basic arguments are captured.
// RUN: clang-installapi -x objective-c -target arm64-apple-ios13.0.0 \
// RUN: -fapplication-extension -current_version 1 -install_name /usr/lib/basic.dylib \
// RUN: -fapplication-extension -current_version 1 -compatibility_version 1 \
// RUN: -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

Expand All @@ -25,11 +26,6 @@
//--- expected.tbd
{
"main_library": {
"compatibility_versions": [
{
"version": "0"
}
],
"install_names": [
{
"name": "/usr/lib/basic.dylib"
Expand Down
4 changes: 4 additions & 0 deletions clang/tools/clang-installapi/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ bool Options::processLinkerOptions(InputArgList &Args) {
if (auto *Arg = Args.getLastArg(OPT_current__version))
LinkerOpts.CurrentVersion.parse64(Arg->getValue());

if (auto *Arg = Args.getLastArg(OPT_compatibility__version))
LinkerOpts.CompatVersion.parse64(Arg->getValue());

LinkerOpts.IsDylib = Args.hasArg(OPT_dynamiclib);

LinkerOpts.AppExtensionSafe =
Expand Down Expand Up @@ -159,6 +162,7 @@ InstallAPIContext Options::createContext() {

Ctx.BA.InstallName = LinkerOpts.InstallName;
Ctx.BA.CurrentVersion = LinkerOpts.CurrentVersion;
Ctx.BA.CompatVersion = LinkerOpts.CompatVersion;
Ctx.BA.AppExtensionSafe = LinkerOpts.AppExtensionSafe;
Ctx.FT = DriverOpts.OutFT;
Ctx.OutputLoc = DriverOpts.OutputPath;
Expand Down
3 changes: 3 additions & 0 deletions clang/tools/clang-installapi/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ struct LinkerOptions {
/// \brief The current version to use for the dynamic library.
PackedVersion CurrentVersion;

/// \brief The compatibility version to use for the dynamic library.
PackedVersion CompatVersion;

/// \brief Is application extension safe.
bool AppExtensionSafe = false;

Expand Down

0 comments on commit b058b7e

Please sign in to comment.