Author: Cyndy Ishida Date: 2024-03-14T11:24:16-07:00 New Revision: b058b7e6280a732f6fcbc582f8b6511a36fb96e8
URL: https://github.com/llvm/llvm-project/commit/b058b7e6280a732f6fcbc582f8b6511a36fb96e8 DIFF: https://github.com/llvm/llvm-project/commit/b058b7e6280a732f6fcbc582f8b6511a36fb96e8.diff LOG: [InstallAPI] capture compatibility versions (#85261) Added: Modified: clang/test/InstallAPI/basic.test clang/tools/clang-installapi/Options.cpp clang/tools/clang-installapi/Options.h Removed: ################################################################################ diff --git a/clang/test/InstallAPI/basic.test b/clang/test/InstallAPI/basic.test index 5b41ccd517b0af..096911039d114e 100644 --- a/clang/test/InstallAPI/basic.test +++ b/clang/test/InstallAPI/basic.test @@ -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 @@ -25,11 +26,6 @@ //--- expected.tbd { "main_library": { - "compatibility_versions": [ - { - "version": "0" - } - ], "install_names": [ { "name": "/usr/lib/basic.dylib" diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp index 701ab81c57c3d0..70cb80f0fdb36f 100644 --- a/clang/tools/clang-installapi/Options.cpp +++ b/clang/tools/clang-installapi/Options.cpp @@ -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 = @@ -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; diff --git a/clang/tools/clang-installapi/Options.h b/clang/tools/clang-installapi/Options.h index 06f79b62c531ec..e218d57b30518e 100644 --- a/clang/tools/clang-installapi/Options.h +++ b/clang/tools/clang-installapi/Options.h @@ -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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits