LLVM 17.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
llvm::object::Archive Class Reference

#include "llvm/Object/Archive.h"

Inheritance diagram for llvm::object::Archive:
Inheritance graph
[legend]
Collaboration diagram for llvm::object::Archive:
Collaboration graph
[legend]

Classes

class  Child
 
class  ChildFallibleIterator
 
class  Symbol
 
class  symbol_iterator
 

Public Types

enum  Kind {
  K_GNU , K_GNU64 , K_BSD , K_DARWIN ,
  K_DARWIN64 , K_COFF , K_AIXBIG
}
 
using child_iterator = fallible_iterator< ChildFallibleIterator >
 

Public Member Functions

 Archive (MemoryBufferRef Source, Error &Err)
 
Kind kind () const
 
bool isThin () const
 
child_iterator child_begin (Error &Err, bool SkipInternal=true) const
 
child_iterator child_end () const
 
iterator_range< child_iteratorchildren (Error &Err, bool SkipInternal=true) const
 
symbol_iterator symbol_begin () const
 
symbol_iterator symbol_end () const
 
iterator_range< symbol_iteratorsymbols () const
 
Expected< std::optional< Child > > findSym (StringRef name) const
 
virtual bool isEmpty () const
 
bool hasSymbolTable () const
 
StringRef getSymbolTable () const
 
StringRef getStringTable () const
 
uint32_t getNumberOfSymbols () const
 
virtual uint64_t getFirstChildOffset () const
 
std::vector< std::unique_ptr< MemoryBuffer > > takeThinBuffers ()
 
std::unique_ptr< AbstractArchiveMemberHeadercreateArchiveMemberHeader (const char *RawHeaderPtr, uint64_t Size, Error *Err) const
 
- Public Member Functions inherited from llvm::object::Binary
 Binary ()=delete
 
 Binary (const Binary &other)=delete
 
virtual ~Binary ()
 
virtual Error initContent ()
 
StringRef getData () const
 
StringRef getFileName () const
 
MemoryBufferRef getMemoryBufferRef () const
 
unsigned int getType () const
 
bool isObject () const
 
bool isSymbolic () const
 
bool isArchive () const
 
bool isMachOUniversalBinary () const
 
bool isTapiUniversal () const
 
bool isELF () const
 
bool isMachO () const
 
bool isCOFF () const
 
bool isXCOFF () const
 
bool isWasm () const
 
bool isOffloadFile () const
 
bool isCOFFImportFile () const
 
bool isIR () const
 
bool isMinidump () const
 
bool isTapiFile () const
 
bool isLittleEndian () const
 
bool isWinRes () const
 
Triple::ObjectFormatType getTripleObjectFormat () const
 

Static Public Member Functions

static Expected< std::unique_ptr< Archive > > create (MemoryBufferRef Source)
 
static object::Archive::Kind getDefaultKindForHost ()
 
static bool classof (Binary const *v)
 
- Static Public Member Functions inherited from llvm::object::Binary
static Error checkOffset (MemoryBufferRef M, uintptr_t Addr, const uint64_t Size)
 

Static Public Attributes

static const uint64_t MaxMemberSize = 9999999999
 Size field is 10 decimal digits long.
 

Protected Member Functions

uint64_t getArchiveMagicLen () const
 
void setFirstRegular (const Child &C)
 
- Protected Member Functions inherited from llvm::object::Binary
 Binary (unsigned int Type, MemoryBufferRef Source)
 

Protected Attributes

StringRef SymbolTable
 
StringRef StringTable
 
- Protected Attributes inherited from llvm::object::Binary
MemoryBufferRef Data
 

Additional Inherited Members

- Protected Types inherited from llvm::object::Binary
enum  {
  ID_Archive , ID_MachOUniversalBinary , ID_COFFImportFile , ID_IR ,
  ID_TapiUniversal , ID_TapiFile , ID_Minidump , ID_WinRes ,
  ID_Offload , ID_StartObjects , ID_COFF , ID_XCOFF32 ,
  ID_XCOFF64 , ID_ELF32L , ID_ELF32B , ID_ELF64L ,
  ID_ELF64B , ID_MachO32L , ID_MachO32B , ID_MachO64L ,
  ID_MachO64B , ID_Wasm , ID_EndObjects
}
 
- Static Protected Member Functions inherited from llvm::object::Binary
static unsigned int getELFType (bool isLE, bool is64Bits)
 
static unsigned int getMachOType (bool isLE, bool is64Bits)
 

Detailed Description

Definition at line 156 of file Archive.h.

Member Typedef Documentation

◆ child_iterator

Definition at line 287 of file Archive.h.

Member Enumeration Documentation

◆ Kind

Enumerator
K_GNU 
K_GNU64 
K_BSD 
K_DARWIN 
K_DARWIN64 
K_COFF 
K_AIXBIG 

Definition at line 336 of file Archive.h.

Constructor & Destructor Documentation

◆ Archive()

Archive::Archive ( MemoryBufferRef  Source,
Error Err 
)

Member Function Documentation

◆ child_begin()

Archive::child_iterator Archive::child_begin ( Error Err,
bool  SkipInternal = true 
) const

◆ child_end()

Archive::child_iterator Archive::child_end ( ) const

◆ children()

iterator_range< child_iterator > llvm::object::Archive::children ( Error Err,
bool  SkipInternal = true 
) const
inline

Definition at line 344 of file Archive.h.

References child_begin(), child_end(), and llvm::make_range().

Referenced by appendFile(), llvm::objcopy::createNewArchiveMembers(), and doList().

◆ classof()

static bool llvm::object::Archive::classof ( Binary const v)
inlinestatic

Definition at line 355 of file Archive.h.

References llvm::object::Binary::isArchive().

◆ create()

Expected< std::unique_ptr< Archive > > Archive::create ( MemoryBufferRef  Source)
static

◆ createArchiveMemberHeader()

std::unique_ptr< AbstractArchiveMemberHeader > Archive::createArchiveMemberHeader ( const char RawHeaderPtr,
uint64_t  Size,
Error Err 
) const

Definition at line 676 of file Archive.cpp.

References K_AIXBIG, kind(), and Size.

Referenced by llvm::object::Archive::Child::Child().

◆ findSym()

Expected< std::optional< Archive::Child > > Archive::findSym ( StringRef  name) const

◆ getArchiveMagicLen()

uint64_t Archive::getArchiveMagicLen ( ) const
protected

◆ getDefaultKindForHost()

object::Archive::Kind Archive::getDefaultKindForHost ( )
static

◆ getFirstChildOffset()

virtual uint64_t llvm::object::Archive::getFirstChildOffset ( ) const
inlinevirtual

Reimplemented in llvm::object::BigArchive.

Definition at line 365 of file Archive.h.

References getArchiveMagicLen().

Referenced by child_begin().

◆ getNumberOfSymbols()

uint32_t Archive::getNumberOfSymbols ( ) const

◆ getStringTable()

StringRef llvm::object::Archive::getStringTable ( ) const
inline

Definition at line 363 of file Archive.h.

References StringTable.

Referenced by llvm::object::ArchiveMemberHeader::getName(), and symbol_begin().

◆ getSymbolTable()

StringRef llvm::object::Archive::getSymbolTable ( ) const
inline

Definition at line 362 of file Archive.h.

References SymbolTable.

Referenced by llvm::object::Archive::Symbol::getName(), getNumberOfSymbols(), and symbol_begin().

◆ hasSymbolTable()

bool Archive::hasSymbolTable ( ) const

◆ isEmpty()

bool Archive::isEmpty ( ) const
virtual

◆ isThin()

bool llvm::object::Archive::isThin ( ) const
inline

◆ kind()

Kind llvm::object::Archive::kind ( ) const
inline

◆ setFirstRegular()

void Archive::setFirstRegular ( const Child C)
protected

Definition at line 695 of file Archive.cpp.

References llvm::CallingConv::C.

Referenced by Archive(), and llvm::object::BigArchive::BigArchive().

◆ symbol_begin()

Archive::symbol_iterator Archive::symbol_begin ( ) const

◆ symbol_end()

Archive::symbol_iterator Archive::symbol_end ( ) const

Definition at line 1125 of file Archive.cpp.

References getNumberOfSymbols().

Referenced by findSym(), and symbols().

◆ symbols()

iterator_range< symbol_iterator > llvm::object::Archive::symbols ( ) const
inline

Definition at line 351 of file Archive.h.

References llvm::make_range(), symbol_begin(), and symbol_end().

◆ takeThinBuffers()

std::vector< std::unique_ptr< MemoryBuffer > > llvm::object::Archive::takeThinBuffers ( )
inline

Definition at line 367 of file Archive.h.

Member Data Documentation

◆ MaxMemberSize

const uint64_t llvm::object::Archive::MaxMemberSize = 9999999999
static

Size field is 10 decimal digits long.

Definition at line 334 of file Archive.h.

Referenced by computeMemberData().

◆ StringTable

StringRef llvm::object::Archive::StringTable
protected

Definition at line 380 of file Archive.h.

Referenced by Archive(), llvm::object::BigArchive::BigArchive(), and getStringTable().

◆ SymbolTable

StringRef llvm::object::Archive::SymbolTable
protected

The documentation for this class was generated from the following files: