13#ifndef LLVM_OBJECT_ARCHIVE_H
14#define LLVM_OBJECT_ARCHIVE_H
45 virtual std::unique_ptr<AbstractArchiveMemberHeader>
clone()
const = 0;
107 std::unique_ptr<AbstractArchiveMemberHeader>
clone()
const override {
108 return std::make_unique<ArchiveMemberHeader>(*
this);
142 std::unique_ptr<AbstractArchiveMemberHeader>
clone()
const override {
143 return std::make_unique<BigArchiveMemberHeader>(*
this);
157 virtual void anchor();
165 std::unique_ptr<AbstractArchiveMemberHeader> Header;
178 : Parent(
C.Parent), Data(
C.Data), StartOfFile(
C.StartOfFile) {
180 Header =
C.Header->clone();
184 Parent = std::move(
C.Parent);
185 Header = std::move(
C.Header);
187 StartOfFile =
C.StartOfFile;
194 Parent = std::move(
C.Parent);
195 Header = std::move(
C.Header);
197 StartOfFile =
C.StartOfFile;
208 Header =
C.Header->clone();
210 StartOfFile =
C.StartOfFile;
216 assert(!Parent || !other.Parent || Parent == other.Parent);
217 return Data.begin() == other.Data.
begin();
228 return Header->getLastModified();
232 return Header->getRawLastModified();
239 return Header->getAccessMode();
275 return !(*
this == other);
279 auto NextChild = C.getNext();
281 return NextChild.takeError();
282 C = std::move(*NextChild);
296 : Parent(p), SymbolIndex(symi), StringIndex(stri) {}
299 return (Parent == other.Parent) && (SymbolIndex == other.SymbolIndex);
318 return symbol == other.symbol;
322 return !(*
this == other);
347 bool SkipInternal =
true)
const {
373 return std::move(ThinBuffers);
376 std::unique_ptr<AbstractArchiveMemberHeader>
390 uint16_t FirstRegularStartOfFile = -1;
394 mutable std::vector<std::unique_ptr<MemoryBuffer>> ThinBuffers;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
This is an important class for using LLVM in a threaded context.
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
A wrapper class for fallible iterators.
A range adaptor for a pair of iterators.
const Child * operator->() const
bool operator==(const ChildFallibleIterator &other) const
const Child & operator*() const
bool operator!=(const ChildFallibleIterator &other) const
ChildFallibleIterator(const Child &C)
Expected< StringRef > getBuffer() const
StringRef getRawLastModified() const
Expected< Child > getNext() const
bool operator==(const Child &other) const
Expected< std::string > getFullName() const
uint64_t getChildOffset() const
Expected< uint64_t > getRawSize() const
Expected< StringRef > getName() const
Expected< uint64_t > getSize() const
Child & operator=(const Child &C)
Expected< unsigned > getGID() const
uint64_t getDataOffset() const
Expected< StringRef > getRawName() const
Expected< std::unique_ptr< Binary > > getAsBinary(LLVMContext *Context=nullptr) const
Expected< MemoryBufferRef > getMemoryBufferRef() const
Expected< unsigned > getUID() const
Child & operator=(Child &&C) noexcept
Expected< sys::fs::perms > getAccessMode() const
Expected< sys::TimePoint< std::chrono::seconds > > getLastModified() const
const Archive * getParent() const
Symbol(const Archive *p, uint32_t symi, uint32_t stri)
Expected< Child > getMember() const
bool operator==(const Symbol &other) const
StringRef getName() const
symbol_iterator & operator++()
const Symbol & operator*() const
bool operator!=(const symbol_iterator &other) const
const Symbol * operator->() const
symbol_iterator(const Symbol &s)
bool operator==(const symbol_iterator &other) const
std::unique_ptr< AbstractArchiveMemberHeader > createArchiveMemberHeader(const char *RawHeaderPtr, uint64_t Size, Error *Err) const
symbol_iterator symbol_begin() const
iterator_range< symbol_iterator > symbols() const
virtual uint64_t getFirstChildOffset() const
StringRef getStringTable() const
uint32_t getNumberOfSymbols() const
fallible_iterator< ChildFallibleIterator > child_iterator
uint32_t getNumberOfECSymbols() const
void setFirstRegular(const Child &C)
uint64_t getArchiveMagicLen() const
StringRef getSymbolTable() const
symbol_iterator symbol_end() const
static object::Archive::Kind getDefaultKind()
iterator_range< child_iterator > children(Error &Err, bool SkipInternal=true) const
virtual bool isEmpty() const
child_iterator child_end() const
bool hasSymbolTable() const
static bool classof(Binary const *v)
static object::Archive::Kind getDefaultKindForTriple(const Triple &T)
Expected< iterator_range< symbol_iterator > > ec_symbols() const
Expected< std::optional< Child > > findSym(StringRef name) const
child_iterator child_begin(Error &Err, bool SkipInternal=true) const
static const uint64_t MaxMemberSize
Size field is 10 decimal digits long.
std::vector< std::unique_ptr< MemoryBuffer > > takeThinBuffers()
static Expected< std::unique_ptr< Archive > > create(MemoryBufferRef Source)
bool isEmpty() const override
bool Has32BitGlobalSymtab
uint64_t getLastChildOffset() const
std::string MergedGlobalSymtabBuf
bool Has64BitGlobalSymtab
const FixLenHdr * ArFixLenHdr
uint64_t FirstChildOffset
bool has32BitGlobalSymtab()
uint64_t getFirstChildOffset() const override
bool has64BitGlobalSymtab()
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ C
The default llvm calling convention, compatible with C.
const char ArchiveMagic[]
const char ThinArchiveMagic[]
const char BigArchiveMagic[]
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
char Magic[sizeof(BigArchiveMagic) - 1]
Big archive magic string.
char FirstChildOffset[20]
Offset to first archive member.
char LastChildOffset[20]
Offset to last archive member.
char FreeOffset[20]
Offset to first mem on free list.
char GlobSym64Offset[20]
Offset global symbol table for 64-bit objects.
char MemOffset[20]
Offset to member table.
char GlobSymOffset[20]
Offset to global symbol table.
char Size[10]
Size of data, not including header or padding.