14#ifndef LLVM_TEXTAPI_INTERFACEFILE_H
15#define LLVM_TEXTAPI_INTERFACEFILE_H
96 : InstallName(InstallName), Targets(
std::
move(Targets)) {}
101 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
102 for (
const auto &
Target : Targets)
121 return std::tie(InstallName, Targets) == std::tie(O.InstallName, O.Targets);
125 return std::tie(InstallName, Targets) != std::tie(O.InstallName, O.Targets);
129 return std::tie(InstallName, Targets) < std::tie(O.InstallName, O.Targets);
133 std::string InstallName;
145 : SymbolsSet(
std::
move(InputSymbols)) {}
200 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
201 for (
const auto &Target_ : Targets)
218 InstallName = std::string(InstallName_);
232 CompatibilityVersion = Version;
252 IsOSLibNotForSharedCache = V;
272 ObjcConstraint = Constraint;
287 const std::vector<std::pair<Target, std::string>> &
umbrellas()
const {
288 return ParentUmbrellas;
307 return AllowableClients;
320 return ReexportedLibraries;
326 void addDocument(std::shared_ptr<InterfaceFile> &&Document);
334 const std::vector<std::shared_ptr<InterfaceFile>> &
documents()
const {
346 const std::vector<std::pair<Target, std::string>> &
rpaths()
const {
356 if (
auto *
Sym = SymbolsSet->findSymbol(Kind,
Name))
362 template <
typename RangeT,
typename ElT = std::remove_reference_t<
363 decltype(*std::begin(std::declval<RangeT>()))>>
366 SymbolsSet->addGlobal(Kind,
Name, Flags, Targets);
377 SymbolsSet->addGlobal(Kind,
Name, Flags, Targets);
388 SymbolsSet->addGlobal(Kind,
Name, Flags,
Target);
401 return SymbolsSet->reexports();
404 return SymbolsSet->undefineds();
436 bool Overwrite =
false);
460 std::string InstallName;
461 PackedVersion CurrentVersion;
462 PackedVersion CompatibilityVersion;
463 uint8_t SwiftABIVersion{0};
464 bool IsTwoLevelNamespace{
false};
465 bool IsOSLibNotForSharedCache{
false};
466 bool IsAppExtensionSafe{
false};
467 bool HasSimSupport{
false};
469 std::vector<std::pair<Target, std::string>> ParentUmbrellas;
470 std::vector<InterfaceFileRef> AllowableClients;
471 std::vector<InterfaceFileRef> ReexportedLibraries;
472 std::vector<std::shared_ptr<InterfaceFile>> Documents;
473 std::vector<std::pair<Target, std::string>> RPaths;
474 std::unique_ptr<SymbolSet> SymbolsSet;
482 return O.getInstallName() < InstallName;
484 if (
I != Container.end() &&
I->getInstallName() == InstallName)
487 return Container.emplace(
I, InstallName);
This file defines the BumpPtrAllocator interface.
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
void setOSLibNotForSharedCache(bool V=true)
Specify if the library is an OS library but not shared cache eligible.
bool isOSLibNotForSharedCache() const
Check if the library is an OS library that is not shared cache eligible.
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.