27 auto Client =
addEntry(AllowableClients, InstallName);
33 auto Lib =
addEntry(ReexportedLibraries, InstallName);
39 [](
const std::pair<Target, std::string> &
LHS,
42 if ((Iter != ParentUmbrellas.end()) && !(Target_ < Iter->first)) {
43 Iter->second = std::string(Parent);
47 ParentUmbrellas.emplace(Iter, Target_, std::string(Parent));
51 using RPathEntryT =
const std::pair<Target, std::string>;
52 RPathEntryT Entry(InputTarget, RPath);
55 [](RPathEntryT &
LHS, RPathEntryT &
RHS) {
return LHS <
RHS; });
57 if ((Iter != RPaths.end()) && (*Iter == Entry))
60 RPaths.emplace(Iter, Entry);
70 return Archs.
has(Target_.Arch);
77 [](
const std::shared_ptr<InterfaceFile> &
LHS,
78 const std::shared_ptr<InterfaceFile> &
RHS) {
79 return LHS->InstallName <
RHS->InstallName;
81 Document->Parent =
this;
82 Documents.insert(Pos, Document);
87 auto AddFwk = [&](std::shared_ptr<InterfaceFile> &&Reexport) {
89 Documents, Reexport->getInstallName(),
90 [](std::shared_ptr<InterfaceFile> &Lhs,
const StringRef Rhs) {
91 return Lhs->getInstallName() < Rhs;
94 if (Overwrite && It != Documents.end() &&
95 Reexport->getInstallName() == (*It)->getInstallName()) {
96 std::replace(Documents.begin(), Documents.end(), *It,
101 if ((It != Documents.end()) &&
102 !(Reexport->getInstallName() < (*It)->getInstallName()))
105 Documents.emplace(It, std::move(Reexport));
107 for (
auto Doc : Library->documents())
108 AddFwk(std::move(Doc));
110 Library->Documents.clear();
111 AddFwk(std::move(Library));
118 return make_error<StringError>(
"install names do not match",
123 return make_error<StringError>(
"current versions do not match",
128 return make_error<StringError>(
"compatibility versions do not match",
134 return make_error<StringError>(
"swift ABI versions do not match",
139 return make_error<StringError>(
"two level namespace flags do not match",
144 return make_error<StringError>(
145 "application extension safe flags do not match",
150 IF->setFileType(std::max(
getFileType(), O->getFileType()));
157 IF->setSwiftABIVersion(O->getSwiftABIVersion());
165 if (!It.second.empty())
166 IF->addParentUmbrella(It.first, It.second);
168 for (
const auto &It : O->umbrellas()) {
169 if (!It.second.empty())
170 IF->addParentUmbrella(It.first, It.second);
173 IF->addTargets(O->targets());
177 IF->addAllowableClient(
Lib.getInstallName(),
Target);
179 for (
const auto &
Lib : O->allowableClients())
181 IF->addAllowableClient(
Lib.getInstallName(),
Target);
185 IF->addReexportedLibrary(
Lib.getInstallName(),
Target);
187 for (
const auto &
Lib : O->reexportedLibraries())
189 IF->addReexportedLibrary(
Lib.getInstallName(),
Target);
192 IF->addRPath(
Target, Path);
193 for (
const auto &[
Target, Path] : O->rpaths())
194 IF->addRPath(
Target, Path);
201 for (
const auto *
Sym : O->symbols()) {
206 return std::move(IF);
212 return make_error<StringError>(
"cannot remove last architecture slice '" +
218 for (
auto &Doc : Documents) {
219 if (Doc->getArchitectures().has(Arch)) {
240 if (It.first.Arch != Arch)
241 IF->addParentUmbrella(It.first, It.second);
246 IF->addAllowableClient(
Lib.getInstallName(),
Target);
252 IF->addReexportedLibrary(
Lib.getInstallName(),
Target);
265 for (
auto &Doc : Documents) {
268 if (Doc->getArchitectures() == Arch)
273 if (!Doc->getArchitectures().has(Arch)) {
275 IF->addDocument(std::move(NewDoc));
279 auto Result = Doc->remove(Arch);
283 IF->addDocument(std::move(Result.get()));
286 return std::move(IF);
292 return make_error<StringError>(
"file doesn't have architecture '" +
308 if (It.first.Arch == Arch)
309 IF->addParentUmbrella(It.first, It.second);
311 for (
const auto &It :
rpaths())
312 if (It.first.Arch == Arch)
313 IF->addRPath(It.first, It.second);
318 IF->addAllowableClient(
Lib.getInstallName(),
Target);
323 IF->addReexportedLibrary(
Lib.getInstallName(),
Target);
331 for (
auto &Doc : Documents) {
333 if (!Doc->getArchitectures().has(Arch))
336 auto Result = Doc->extract(Arch);
340 IF->addDocument(std::move(Result.get()));
343 return std::move(IF);
351 if (Targets != O.Targets)
353 if (InstallName != O.InstallName)
355 if ((CurrentVersion != O.CurrentVersion) ||
356 (CompatibilityVersion != O.CompatibilityVersion))
358 if (SwiftABIVersion != O.SwiftABIVersion)
360 if (IsTwoLevelNamespace != O.IsTwoLevelNamespace)
362 if (IsAppExtensionSafe != O.IsAppExtensionSafe)
364 if (HasSimSupport != O.HasSimSupport)
366 if (ParentUmbrellas != O.ParentUmbrellas)
368 if (AllowableClients != O.AllowableClients)
370 if (ReexportedLibraries != O.ReexportedLibraries)
372 if (*SymbolsSet != *O.SymbolsSet)
377 if (RPaths != O.RPaths)
383 if (!std::equal(Documents.begin(), Documents.end(), O.Documents.begin(),
385 [](
const std::shared_ptr<InterfaceFile>
LHS,
386 const std::shared_ptr<InterfaceFile>
RHS) {
static void clear(coro::Shape &Shape)
static bool isYAMLTextStub(const FileType &Kind)
Define TAPI specific error codes.
Tagged union holding either a T or a Error.
static ArchitectureSet All()
ArchitectureSet clear(Architecture Arch)
bool has(Architecture Arch) const
void addTarget(const Target &Target)
Defines the interface file.
void addDocument(std::shared_ptr< InterfaceFile > &&Document)
Add a library for inlining to top level library.
StringRef getPath() const
Get the path from which this file was generated (if applicable).
void addReexportedLibrary(StringRef InstallName, const Target &Target)
Add a re-exported library.
void addParentUmbrella(const Target &Target_, StringRef Parent)
Set the parent umbrella frameworks.
const_target_range targets() const
llvm::Expected< std::unique_ptr< InterfaceFile > > remove(Architecture Arch) const
Remove architecture slice from Interface.
bool isTwoLevelNamespace() const
Check if the library uses two-level namespace.
bool operator==(const InterfaceFile &O) const
The equality is determined by attributes that impact linking compatibilities.
PackedVersion getCompatibilityVersion() const
Get the compatibility version of the library.
void addTarget(const Target &Target)
Set and add target.
bool isApplicationExtensionSafe() const
Check if the library is application extension safe.
const std::vector< std::pair< Target, std::string > > & rpaths() const
Get the list of runpath search paths.
const std::vector< InterfaceFileRef > & allowableClients() const
Get the list of allowable clients.
const std::vector< std::pair< Target, std::string > > & umbrellas() const
Get the list of Parent Umbrella frameworks.
const std::vector< InterfaceFileRef > & reexportedLibraries() const
Get the list of re-exported libraries.
const_symbol_range symbols() const
uint8_t getSwiftABIVersion() const
Get the Swift ABI version of the library.
PackedVersion getCurrentVersion() const
Get the current version of the library.
ArchitectureSet getArchitectures() const
Get the architectures.
StringRef getInstallName() const
Get the install name of the library.
llvm::Expected< std::unique_ptr< InterfaceFile > > merge(const InterfaceFile *O) const
Merge Interfaces for the same library.
FileType getFileType() const
Get the file type.
void addAllowableClient(StringRef InstallName, const Target &Target)
Add an allowable client.
void inlineLibrary(std::shared_ptr< InterfaceFile > Library, bool Overwrite=false)
Inline reexported library into Interface.
void addRPath(const Target &InputTarget, StringRef RPath)
Set the runpath search paths.
llvm::Expected< std::unique_ptr< InterfaceFile > > extract(Architecture Arch) const
Extract architecture slice from Interface.
SymbolFlags getFlags() const
bool hasArchitecture(Architecture Arch) const
const_target_range targets() const
SymbolKind getKind() const
ArchitectureSet getArchitectures() const
StringRef getName() const
StringRef - Represent a constant reference to a string, i.e.
A range adaptor for a pair of iterators.
FileType
Defines the file type this file represents.
@ TBD_V1
Text-based stub file (.tbd) version 1.0.
@ TBD_V5
Text-based stub file (.tbd) version 5.0.
StringRef getArchitectureName(Architecture Arch)
Convert an architecture slice to a string.
C::iterator addEntry(C &Container, StringRef InstallName)
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
PlatformVersionSet mapToPlatformVersionSet(ArrayRef< Target > Targets)
This is an optimization pass for GlobalISel generic memory operations.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...