14#ifndef LLVM_TEXTAPI_INTERFACEFILE_H
15#define LLVM_TEXTAPI_INTERFACEFILE_H
59 : InstallName(InstallName), Targets(
std::
move(Targets)) {}
64 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
65 for (
const auto &
Target : Targets)
84 return std::tie(InstallName, Targets) == std::tie(O.InstallName, O.Targets);
88 return std::tie(InstallName, Targets) != std::tie(O.InstallName, O.Targets);
92 return std::tie(InstallName, Targets) < std::tie(O.InstallName, O.Targets);
96 std::string InstallName;
108 : SymbolsSet(
std::
move(InputSymbols)) {}
163 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
164 for (
const auto &Target_ : Targets)
181 InstallName = std::string(InstallName_);
195 CompatibilityVersion =
Version;
215 IsOSLibNotForSharedCache = V;
235 ObjcConstraint = Constraint;
250 const std::vector<std::pair<Target, std::string>> &
umbrellas()
const {
251 return ParentUmbrellas;
270 return AllowableClients;
283 return ReexportedLibraries;
289 void addDocument(std::shared_ptr<InterfaceFile> &&Document);
297 const std::vector<std::shared_ptr<InterfaceFile>> &
documents()
const {
309 const std::vector<std::pair<Target, std::string>> &
rpaths()
const {
318 std::optional<const Symbol *>
321 if (
auto *
Sym = SymbolsSet->findSymbol(Kind,
Name, ObjCIF))
327 template <
typename RangeT,
typename ElT = std::remove_reference_t<
328 decltype(*std::begin(std::declval<RangeT>()))>>
331 SymbolsSet->addGlobal(Kind,
Name, Flags, Targets);
342 SymbolsSet->addGlobal(Kind,
Name, Flags, Targets);
353 SymbolsSet->addGlobal(Kind,
Name, Flags,
Target);
366 return SymbolsSet->reexports();
369 return SymbolsSet->undefineds();
401 bool Overwrite =
false);
433 std::string InstallName;
434 PackedVersion CurrentVersion;
435 PackedVersion CompatibilityVersion;
436 uint8_t SwiftABIVersion{0};
437 bool IsTwoLevelNamespace{
false};
438 bool IsOSLibNotForSharedCache{
false};
439 bool IsAppExtensionSafe{
false};
440 bool HasSimSupport{
false};
442 std::vector<std::pair<Target, std::string>> ParentUmbrellas;
443 std::vector<InterfaceFileRef> AllowableClients;
444 std::vector<InterfaceFileRef> ReexportedLibraries;
445 std::vector<std::shared_ptr<InterfaceFile>> Documents;
446 std::vector<std::pair<Target, std::string>> RPaths;
447 std::unique_ptr<SymbolSet> SymbolsSet;
455 return O.getInstallName() < InstallName;
457 if (
I != Container.end() &&
I->getInstallName() == InstallName)
460 return Container.emplace(
I, InstallName);
This file defines the BumpPtrAllocator interface.
Implements the TAPI Record Collection Type.
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.
std::optional< const Symbol * > getSymbol(EncodeKind Kind, StringRef Name, ObjCIFSymbolKind ObjCIF=ObjCIFSymbolKind::None) const
Get symbol if exists in 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 setFromBinaryAttrs(const RecordsSlice::BinaryAttrs &BA, const Target &Targ)
Set InterfaceFile properties from pre-gathered binary attributes, if they are not set already.
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.
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 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 addSymbol(EncodeKind Kind, StringRef Name, TargetList &&Targets, SymbolFlags Flags=SymbolFlags::None)
Add Symbol with multiple targets.
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 addSymbol(EncodeKind Kind, StringRef Name, RangeT &&Targets, SymbolFlags Flags=SymbolFlags::None)
Add a symbol to the symbols list or extend an existing one.
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.
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.
void addSymbol(EncodeKind Kind, StringRef Name, Target &Target, SymbolFlags Flags=SymbolFlags::None)
Add Symbol with single target.
void addRPath(StringRef RPath, const Target &InputTarget)
Set the runpath search paths.
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.
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 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 TextAPI files can represent.
@ Invalid
Invalid file type.
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
ObjCIFSymbolKind
ObjC Interface symbol mappings.
EncodeKind
Mapping of entry types in TextStubs.
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.