aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-07-27 23:34:35 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-10-23 18:26:01 +0000
commit0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch)
tree6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp
parent6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff)
parentac9a064cb179f3425b310fa2847f8764ac970a4d (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp b/contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp
index d712ed386825..79694c90370f 100644
--- a/contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp
+++ b/contrib/llvm-project/llvm/lib/TextAPI/InterfaceFile.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/TextAPI/InterfaceFile.h"
+#include "llvm/TextAPI/RecordsSlice.h"
#include "llvm/TextAPI/TextAPIError.h"
#include <iomanip>
#include <sstream>
@@ -53,7 +54,7 @@ void InterfaceFile::addParentUmbrella(const Target &Target_, StringRef Parent) {
ParentUmbrellas.emplace(Iter, Target_, std::string(Parent));
}
-void InterfaceFile::addRPath(const Target &InputTarget, StringRef RPath) {
+void InterfaceFile::addRPath(StringRef RPath, const Target &InputTarget) {
if (RPath.empty())
return;
using RPathEntryT = const std::pair<Target, std::string>;
@@ -197,9 +198,9 @@ InterfaceFile::merge(const InterfaceFile *O) const {
IF->addReexportedLibrary(Lib.getInstallName(), Target);
for (const auto &[Target, Path] : rpaths())
- IF->addRPath(Target, Path);
+ IF->addRPath(Path, Target);
for (const auto &[Target, Path] : O->rpaths())
- IF->addRPath(Target, Path);
+ IF->addRPath(Path, Target);
for (const auto *Sym : symbols()) {
IF->addSymbol(Sym->getKind(), Sym->getName(), Sym->targets(),
@@ -318,7 +319,7 @@ InterfaceFile::extract(Architecture Arch) const {
for (const auto &It : rpaths())
if (It.first.Arch == Arch)
- IF->addRPath(It.first, It.second);
+ IF->addRPath(It.second, It.first);
for (const auto &Lib : allowableClients())
for (const auto &Target : Lib.targets())
@@ -351,6 +352,34 @@ InterfaceFile::extract(Architecture Arch) const {
return std::move(IF);
}
+void InterfaceFile::setFromBinaryAttrs(const RecordsSlice::BinaryAttrs &BA,
+ const Target &Targ) {
+ if (getFileType() != BA.File)
+ setFileType(BA.File);
+ if (getInstallName().empty())
+ setInstallName(BA.InstallName);
+ if (BA.AppExtensionSafe && !isApplicationExtensionSafe())
+ setApplicationExtensionSafe();
+ if (BA.TwoLevelNamespace && !isTwoLevelNamespace())
+ setTwoLevelNamespace();
+ if (BA.OSLibNotForSharedCache && !isOSLibNotForSharedCache())
+ setOSLibNotForSharedCache();
+ if (getCurrentVersion().empty())
+ setCurrentVersion(BA.CurrentVersion);
+ if (getCompatibilityVersion().empty())
+ setCompatibilityVersion(BA.CompatVersion);
+ if (getSwiftABIVersion() == 0)
+ setSwiftABIVersion(BA.SwiftABI);
+ if (getPath().empty())
+ setPath(BA.Path);
+ if (!BA.ParentUmbrella.empty())
+ addParentUmbrella(Targ, BA.ParentUmbrella);
+ for (const auto &Client : BA.AllowableClients)
+ addAllowableClient(Client, Targ);
+ for (const auto &Lib : BA.RexportedLibraries)
+ addReexportedLibrary(Lib, Targ);
+}
+
static bool isYAMLTextStub(const FileType &Kind) {
return (Kind >= FileType::TBD_V1) && (Kind < FileType::TBD_V5);
}