14#ifndef LLVM_TEXTAPI_INTERFACEFILE_H
15#define LLVM_TEXTAPI_INTERFACEFILE_H
60 : InstallName(InstallName), Targets(
std::
move(Targets)) {}
65 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
66 for (
const auto &
Target : Targets)
85 return std::tie(InstallName, Targets) == std::tie(O.InstallName, O.Targets);
89 return std::tie(InstallName, Targets) != std::tie(O.InstallName, O.Targets);
93 return std::tie(InstallName, Targets) < std::tie(O.InstallName, O.Targets);
97 std::string InstallName;
109 : SymbolsSet(
std::
move(InputSymbols)) {}
164 template <
typename RangeT>
void addTargets(RangeT &&Targets) {
165 for (
const auto &Target_ : Targets)
182 InstallName = std::string(InstallName_);
196 CompatibilityVersion =
Version;
216 IsOSLibNotForSharedCache = V;
236 ObjcConstraint = Constraint;
251 const std::vector<std::pair<Target, std::string>> &
umbrellas()
const {
252 return ParentUmbrellas;
271 return AllowableClients;
285 return ReexportedLibraries;
299 const std::vector<std::shared_ptr<InterfaceFile>> &
documents()
const {
311 const std::vector<std::pair<Target, std::string>> &
rpaths()
const {
320 std::optional<const Symbol *>
323 if (
auto *Sym = SymbolsSet->findSymbol(Kind, Name, ObjCIF))
329 template <
typename RangeT,
typename ElT = std::remove_reference_t<
330 decltype(*std::begin(std::declval<RangeT>()))>>
333 SymbolsSet->addGlobal(Kind, Name, Flags, Targets);
344 SymbolsSet->addGlobal(Kind, Name, Flags, Targets);
355 SymbolsSet->addGlobal(Kind, Name, Flags,
Target);
368 return SymbolsSet->reexports();
371 return SymbolsSet->undefineds();
403 bool Overwrite =
false);
435 std::string InstallName;
436 PackedVersion CurrentVersion;
437 PackedVersion CompatibilityVersion;
438 uint8_t SwiftABIVersion{0};
439 bool IsTwoLevelNamespace{
false};
440 bool IsOSLibNotForSharedCache{
false};
441 bool IsAppExtensionSafe{
false};
442 bool HasSimSupport{
false};
444 std::vector<std::pair<Target, std::string>> ParentUmbrellas;
445 std::vector<InterfaceFileRef> AllowableClients;
446 std::vector<InterfaceFileRef> ReexportedLibraries;
447 std::vector<std::shared_ptr<InterfaceFile>> Documents;
448 std::vector<std::pair<Target, std::string>> RPaths;
449 std::unique_ptr<SymbolSet> SymbolsSet;
457 return O.getInstallName() < InstallName;
459 if (
I != Container.end() &&
I->getInstallName() == InstallName)
462 return Container.emplace(
I, InstallName);
This file defines the BumpPtrAllocator interface.
Implements the TAPI Record Collection Type.
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
LLVM_ABI void addTarget(const Target &Target)
const_target_range targets() const
StringRef getInstallName() const
TargetList::const_iterator const_target_iterator
bool operator==(const InterfaceFileRef &O) const
ArchitectureSet getArchitectures() const
InterfaceFileRef(StringRef InstallName)
InterfaceFileRef()=default
llvm::iterator_range< const_target_iterator > const_target_range
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.
LLVM_ABI void addDocument(std::shared_ptr< InterfaceFile > &&Document)
Add a library for inlining to top level library.
SymbolSet::const_filtered_symbol_range const_filtered_symbol_range
StringRef getPath() const
Get the path from which this file was generated (if applicable).
LLVM_ABI 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).
LLVM_ABI void setFromBinaryAttrs(const RecordsSlice::BinaryAttrs &BA, const Target &Targ)
Set InterfaceFile properties from pre-gathered binary attributes, if they are not set already.
LLVM_ABI 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.
llvm::iterator_range< const_filtered_target_iterator > const_filtered_target_range
bool isOSLibNotForSharedCache() const
Check if the library is an OS library that is not shared cache eligible.
const_filtered_symbol_range reexports() const
LLVM_ABI 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.
LLVM_ABI 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.
SymbolSet::const_symbol_range const_symbol_range
size_t symbolsCount() const
Get size of symbol set.
bool operator!=(const InterfaceFile &O) const
llvm::iterator_range< const_target_iterator > const_target_range
LLVM_ABI 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.
llvm::filter_iterator< const_target_iterator, std::function< bool(const Target &)> > const_filtered_target_iterator
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.
LLVM_ABI 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_ABI 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).
LLVM_ABI void addAllowableClient(StringRef InstallName, const Target &Target)
Add an allowable client.
LLVM_ABI 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_filtered_symbol_iterator > const_filtered_symbol_range
iterator_range< const_symbol_iterator > const_symbol_range
StringRef - Represent a constant reference to a string, i.e.
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)
LLVM_ABI PlatformSet mapToPlatformSet(ArrayRef< Triple > Targets)
SmallSet< PlatformType, 3 > PlatformSet
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.
ObjCIFSymbolKind
ObjC Interface symbol mappings.
EncodeKind
Mapping of entry types in TextStubs.
SmallVector< Target, 5 > TargetList
LLVM_ABI 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.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
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.
filter_iterator_impl< WrappedIteratorT, PredicateT, detail::fwd_or_bidi_tag< WrappedIteratorT > > filter_iterator
Defines filter_iterator to a suitable specialization of filter_iterator_impl, based on the underlying...
Implement std::hash so that hash_code can be used in STL containers.