14#ifndef LLVM_TEXTAPI_INTERFACEFILE_H
15#define LLVM_TEXTAPI_INTERFACEFILE_H
97 : InstallName(InstallName), Targets(
std::
move(Targets)) {}
102 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
103 for (
const auto &
Target : Targets)
122 return std::tie(InstallName, Targets) == std::tie(O.InstallName, O.Targets);
126 return std::tie(InstallName, Targets) != std::tie(O.InstallName, O.Targets);
130 return std::tie(InstallName, Targets) < std::tie(O.InstallName, O.Targets);
134 std::string InstallName;
146 : SymbolsSet(
std::
move(InputSymbols)) {}
201 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
202 for (
const auto &Target_ : Targets)
219 InstallName = std::string(InstallName_);
233 CompatibilityVersion = Version;
265 ObjcConstraint = Constraint;
280 const std::vector<std::pair<Target, std::string>> &
umbrellas()
const {
281 return ParentUmbrellas;
300 return AllowableClients;
313 return ReexportedLibraries;
319 void addDocument(std::shared_ptr<InterfaceFile> &&Document);
327 const std::vector<std::shared_ptr<InterfaceFile>> &
documents()
const {
339 const std::vector<std::pair<Target, std::string>> &
rpaths()
const {
349 if (
auto *
Sym = SymbolsSet->findSymbol(Kind,
Name))
355 template <
typename RangeT,
356 typename ElT =
typename std::remove_reference<
357 decltype(*std::begin(std::declval<RangeT>()))>::type>
360 SymbolsSet->addGlobal(Kind,
Name, Flags, Targets);
371 SymbolsSet->addGlobal(Kind,
Name, Flags, Targets);
382 SymbolsSet->addGlobal(Kind,
Name, Flags,
Target);
395 return SymbolsSet->reexports();
398 return SymbolsSet->undefineds();
430 bool Overwrite =
false);
454 std::string InstallName;
455 PackedVersion CurrentVersion;
456 PackedVersion CompatibilityVersion;
457 uint8_t SwiftABIVersion{0};
458 bool IsTwoLevelNamespace{
false};
459 bool IsAppExtensionSafe{
false};
460 bool HasSimSupport{
false};
462 std::vector<std::pair<Target, std::string>> ParentUmbrellas;
463 std::vector<InterfaceFileRef> AllowableClients;
464 std::vector<InterfaceFileRef> ReexportedLibraries;
465 std::vector<std::shared_ptr<InterfaceFile>> Documents;
466 std::vector<std::pair<Target, std::string>> RPaths;
467 std::unique_ptr<SymbolSet> SymbolsSet;
475 return O.getInstallName() < InstallName;
477 if (
I != Container.end() &&
I->getInstallName() == InstallName)
480 return Container.emplace(
I, InstallName);
This file defines the BumpPtrAllocator interface.
This file defines the DenseMap class.
Allocate memory in an ever growing pool, as if by bump-pointer.
Tagged union holding either a T or a Error.
Reference to an interface file.
InterfaceFileRef(StringRef InstallName, const TargetList Targets)
bool hasTarget(Target &Targ) const
bool operator!=(const InterfaceFileRef &O) const
void addTargets(RangeT &&Targets)
PlatformSet getPlatforms() const
void addTarget(const Target &Target)
const_target_range targets() const
StringRef getInstallName() const
bool operator==(const InterfaceFileRef &O) const
ArchitectureSet getArchitectures() const
InterfaceFileRef(StringRef InstallName)
InterfaceFileRef()=default
bool operator<(const InterfaceFileRef &O) const
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 setPath(StringRef Path_)
Set the path from which this file was generated (if applicable).
void addParentUmbrella(const Target &Target_, StringRef Parent)
Set the parent umbrella frameworks.
const_target_range targets() const
const_filtered_symbol_range reexports() const
llvm::Expected< std::unique_ptr< InterfaceFile > > remove(Architecture Arch) const
Remove architecture slice from Interface.
void setObjCConstraint(ObjCConstraintType Constraint)
Set the Objective-C constraint.
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.
size_t symbolsCount() const
Get size of symbol set.
bool operator!=(const InterfaceFile &O) const
void addSymbol(SymbolKind Kind, StringRef Name, RangeT &&Targets, SymbolFlags Flags=SymbolFlags::None)
Add a symbol to the symbols list or extend an existing one.
std::optional< const Symbol * > getSymbol(SymbolKind Kind, StringRef Name) const
Get symbol if exists in file.
void addTarget(const Target &Target)
Set and add target.
const_filtered_symbol_range exports() const
bool isApplicationExtensionSafe() const
Check if the library is application extension safe.
void setSimulatorSupport(bool V=true)
Specify if the library has simulator support.
PlatformSet getPlatforms() const
Get the platforms.
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.
void setInstallName(StringRef InstallName_)
Set the install name of the library.
void addTargets(RangeT &&Targets)
Set and add targets.
const std::vector< std::shared_ptr< InterfaceFile > > & documents() const
Get the list of inlined libraries.
const std::vector< std::pair< Target, std::string > > & umbrellas() const
Get the list of Parent Umbrella frameworks.
InterfaceFile(std::unique_ptr< SymbolSet > &&InputSymbols)
const std::vector< InterfaceFileRef > & reexportedLibraries() const
Get the list of re-exported libraries.
InterfaceFile * getParent() const
Returns the pointer to parent document if exists or nullptr otherwise.
void addSymbol(SymbolKind Kind, StringRef Name, Target &Target, SymbolFlags Flags=SymbolFlags::None)
Add Symbol with single target.
const_symbol_range symbols() const
void setFileType(FileType Kind)
Set the file type.
uint8_t getSwiftABIVersion() const
Get the Swift ABI version of the library.
PackedVersion getCurrentVersion() const
Get the current version of the library.
const_filtered_symbol_range undefineds() const
void setCompatibilityVersion(PackedVersion Version)
Set the compatibility version of the library.
ArchitectureSet getArchitectures() const
Get the architectures.
StringRef getInstallName() const
Get the install name of the library.
void addSymbol(SymbolKind Kind, StringRef Name, TargetList &&Targets, SymbolFlags Flags=SymbolFlags::None)
Add Symbol with multiple targets.
llvm::Expected< std::unique_ptr< InterfaceFile > > merge(const InterfaceFile *O) const
Merge Interfaces for the same library.
ObjCConstraintType getObjCConstraint() const
Get the Objective-C constraint.
FileType getFileType() const
Get the file type.
void setApplicationExtensionSafe(bool V=true)
Specify if the library is application extension safe (or not).
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.
bool hasTarget(const Target &Targ) const
Determine if target triple slice exists in file.
void setSwiftABIVersion(uint8_t Version)
Set the Swift ABI version of the library.
void addRPath(const Target &InputTarget, StringRef RPath)
Set the runpath search paths.
void setCurrentVersion(PackedVersion Version)
Set the current version of the library.
TargetList::const_iterator const_target_iterator
void setTwoLevelNamespace(bool V=true)
Specify if the library uses two-level namespace (or flat namespace).
bool hasSimulatorSupport() const
Check if the library has simulator support.
iterator_range< const_symbol_iterator > const_symbol_range
iterator_range< const_filtered_symbol_iterator > const_filtered_symbol_range
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
StringRef - Represent a constant reference to a string, i.e.
Specialization of filter_iterator_base for forward iteration only.
A range adaptor for a pair of iterators.
@ C
The default llvm calling convention, compatible with C.
FileType
Defines the file type this file represents.
@ Invalid
Invalid file type.
@ MachO_DynamicLibrary_Stub
MachO Dynamic Library Stub file.
@ TBD_V1
Text-based stub file (.tbd) version 1.0.
@ MachO_DynamicLibrary
MachO Dynamic Library file.
@ LLVM_MARK_AS_BITMASK_ENUM
@ MachO_Bundle
MachO Bundle file.
@ TBD_V3
Text-based stub file (.tbd) version 3.0.
@ TBD_V5
Text-based stub file (.tbd) version 5.0.
@ TBD_V4
Text-based stub file (.tbd) version 4.0.
@ TBD_V2
Text-based stub file (.tbd) version 2.0.
C::iterator addEntry(C &Container, StringRef InstallName)
PlatformSet mapToPlatformSet(ArrayRef< Triple > Targets)
ObjCConstraintType
Defines a list of Objective-C constraints.
@ Retain_Release_For_Simulator
Retain/Release for Simulator.
@ Retain_Release_Or_GC
Retain/Release or Garbage Collection.
@ Retain_Release
Retain/Release.
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
SmallVector< Target, 5 > TargetList
ArchitectureSet mapToArchitectureSet(ArrayRef< Target > Targets)
This is an optimization pass for GlobalISel generic memory operations.
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Implement std::hash so that hash_code can be used in STL containers.