Go to the documentation of this file.
13 #ifndef LLVM_OBJECT_ARCHIVE_H
14 #define LLVM_OBJECT_ARCHIVE_H
32 template <
typename T>
class Optional;
48 virtual std::unique_ptr<AbstractArchiveMemberHeader>
clone()
const = 0;
110 std::unique_ptr<AbstractArchiveMemberHeader>
clone()
const override {
111 return std::make_unique<ArchiveMemberHeader>(*
this);
145 std::unique_ptr<AbstractArchiveMemberHeader>
clone()
const override {
146 return std::make_unique<BigArchiveMemberHeader>(*
this);
160 virtual void anchor();
168 std::unique_ptr<AbstractArchiveMemberHeader> Header;
181 : Parent(
C.Parent),
Data(
C.
Data), StartOfFile(
C.StartOfFile) {
183 Header =
C.Header->clone();
190 StartOfFile =
C.StartOfFile;
200 StartOfFile =
C.StartOfFile;
211 Header =
C.Header->clone();
213 StartOfFile =
C.StartOfFile;
219 assert(!Parent || !other.Parent || Parent == other.Parent);
220 return Data.begin() == other.Data.
begin();
231 return Header->getLastModified();
235 return Header->getRawLastModified();
242 return Header->getAccessMode();
278 return !(*
this == other);
282 auto NextChild =
C.getNext();
284 return NextChild.takeError();
299 : Parent(
p), SymbolIndex(symi), StringIndex(stri) {}
302 return (Parent == other.Parent) && (SymbolIndex == other.SymbolIndex);
320 return symbol == other.symbol;
324 return !(*
this == other);
348 bool SkipInternal =
true)
const {
374 std::unique_ptr<AbstractArchiveMemberHeader>
387 uint16_t FirstRegularStartOfFile = -1;
391 mutable std::vector<std::unique_ptr<MemoryBuffer>> ThinBuffers;
424 #endif // LLVM_OBJECT_ARCHIVE_H
uint64_t getFirstChildOffset() const override
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.
Expected< std::unique_ptr< Binary > > getAsBinary(LLVMContext *Context=nullptr) const
Expected< Child > getNext() const
bool operator==(const Child &other) const
Child & operator=(Child &&C) noexcept
child_iterator child_end() const
Archive(MemoryBufferRef Source, Error &Err)
char GlobSym64Offset[20]
Offset global symbol table for 64-bit objects.
iterator_range< child_iterator > children(Error &Err, bool SkipInternal=true) const
Child(const Archive *Parent, const char *Start, Error *Err)
bool isEmpty() const override
Child & operator=(const Child &C)
void setFirstRegular(const Child &C)
Expected< std::string > getFullName() const
static ErrorSuccess success()
Create a success value.
bool operator==(const symbol_iterator &other) const
StringRef getStringTable() const
const Symbol & operator*() const
symbol_iterator(const Symbol &s)
uint32_t getNumberOfSymbols() const
symbol_iterator symbol_begin() const
size_t getBufferSize() const
Expected< unsigned > getGID() const
Tagged union holding either a T or a Error.
the resulting code requires compare and branches when and if * p
const Child * operator->() const
StringRef getName() const
Symbol(const Archive *p, uint32_t symi, uint32_t stri)
const char ArchiveMagic[]
const char ThinArchiveMagic[]
char FirstChildOffset[20]
Offset to first archive member.
uint64_t getArchiveMagicLen() const
const char BigArchiveMagic[]
virtual bool isEmpty() const
(vector float) vec_cmpeq(*A, *B) C
std::vector< std::unique_ptr< MemoryBuffer > > takeThinBuffers()
static const uint64_t MaxMemberSize
Size field is 10 decimal digits long.
virtual uint64_t getFirstChildOffset() const
bool operator!=(const symbol_iterator &other) const
StringRef getSymbolTable() const
char MemOffset[20]
Offset to member table.
Expected< StringRef > getBuffer() const
Expected< sys::TimePoint< std::chrono::seconds > > getLastModified() const
uint64_t getDataOffset() const
uint64_t getLastChildOffset() const
Expected< StringRef > getRawName() const
Expected< unsigned > getUID() const
static bool classof(Binary const *v)
bar al al movzbl eax ret Missed when stored in a memory object
ChildFallibleIterator(const Child &C)
symbol_iterator symbol_end() const
multiplies can be turned into SHL s
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
This is an important class for using LLVM in a threaded context.
Expected< sys::fs::perms > getAccessMode() const
char FreeOffset[20]
Offset to first mem on free list.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasSymbolTable() const
bool operator==(const ChildFallibleIterator &other) const
child_iterator child_begin(Error &Err, bool SkipInternal=true) const
A wrapper class for fallible iterators.
char Size[10]
Size of data, not including header or padding.
Expected< uint64_t > getRawSize() const
Expected< Child > getMember() const
Expected< Optional< Child > > findSym(StringRef name) const
StringRef getRawLastModified() const
symbol_iterator & operator++()
BigArchive(MemoryBufferRef Source, Error &Err)
StringRef - Represent a constant reference to a string, i.e.
char Magic[sizeof(BigArchiveMagic) - 1]
Big archive magic string.
char LastChildOffset[20]
Offset to last archive member.
Expected< StringRef > getName() const
const Child & operator*() const
uint64_t FirstChildOffset
bool operator==(const Symbol &other) const
const FixLenHdr * ArFixLenHdr
char GlobSymOffset[20]
Offset to global symbol table.
uint64_t getChildOffset() const
std::unique_ptr< AbstractArchiveMemberHeader > createArchiveMemberHeader(const char *RawHeaderPtr, uint64_t Size, Error *Err) const
const Symbol * operator->() const
Lightweight error class with error context and mandatory checking.
Expected< uint64_t > getSize() const
static object::Archive::Kind getDefaultKindForHost()
A range adaptor for a pair of iterators.
fallible_iterator< ChildFallibleIterator > child_iterator
Expected< MemoryBufferRef > getMemoryBufferRef() const
const Archive * getParent() const
iterator_range< symbol_iterator > symbols() const
static Expected< std::unique_ptr< Archive > > create(MemoryBufferRef Source)
bool operator!=(const ChildFallibleIterator &other) const