LLVM 22.0.0git
llvm::object::Archive Class Reference

#include "llvm/Object/Archive.h"

Inheritance diagram for llvm::object::Archive:
[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)
 Archive (Archive const &)=delete
Archiveoperator= (Archive const &)=delete
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< iterator_range< symbol_iterator > > ec_symbols () 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
uint32_t getNumberOfECSymbols () 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 isGOFF () const
bool isMinidump () const
bool isTapiFile () const
bool isLittleEndian () const
bool isWinRes () const
bool isDXContainer () const
Triple::ObjectFormatType getTripleObjectFormat () const

Static Public Member Functions

static Expected< std::unique_ptr< Archive > > create (MemoryBufferRef Source)
static object::Archive::Kind getDefaultKind ()
static object::Archive::Kind getDefaultKindForTriple (const Triple &T)
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 ECSymbolTable
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_GOFF , ID_Wasm , ID_DXContainer ,
  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 159 of file Archive.h.

Member Typedef Documentation

◆ child_iterator

Member Enumeration Documentation

◆ Kind

Enumerator
K_GNU 
K_GNU64 
K_BSD 
K_DARWIN 
K_DARWIN64 
K_COFF 
K_AIXBIG 

Definition at line 344 of file Archive.h.

Constructor & Destructor Documentation

◆ Archive() [1/2]

◆ Archive() [2/2]

llvm::object::Archive::Archive ( Archive const & )
delete

References Archive().

Member Function Documentation

◆ child_begin()

◆ child_end()

◆ children()

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

Definition at line 353 of file Archive.h.

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

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

◆ classof()

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

Definition at line 366 of file Archive.h.

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

◆ create()

◆ createArchiveMemberHeader()

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

Definition at line 682 of file Archive.cpp.

References K_AIXBIG, kind(), and Size.

◆ ec_symbols()

◆ findSym()

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

◆ getArchiveMagicLen()

uint64_t Archive::getArchiveMagicLen ( ) const
protected

◆ getDefaultKind()

object::Archive::Kind Archive::getDefaultKind ( )
static

◆ getDefaultKindForTriple()

object::Archive::Kind Archive::getDefaultKindForTriple ( const Triple & T)
static

Definition at line 969 of file Archive.cpp.

References K_AIXBIG, K_COFF, K_DARWIN, K_GNU, and T.

Referenced by llvm::NewArchiveMember::detectKindFromObject(), and getDefaultKind().

◆ getFirstChildOffset()

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

Reimplemented in llvm::object::BigArchive.

Definition at line 377 of file Archive.h.

References getArchiveMagicLen().

Referenced by child_begin().

◆ getNumberOfECSymbols()

uint32_t Archive::getNumberOfECSymbols ( ) const

Definition at line 1255 of file Archive.cpp.

References ECSymbolTable, and llvm::support::endian::read32le().

◆ getNumberOfSymbols()

◆ getStringTable()

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

Definition at line 374 of file Archive.h.

References StringTable.

Referenced by symbol_begin().

◆ getSymbolTable()

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

Definition at line 373 of file Archive.h.

References SymbolTable.

Referenced by getNumberOfSymbols(), and symbol_begin().

◆ hasSymbolTable()

bool Archive::hasSymbolTable ( ) const

Definition at line 1282 of file Archive.cpp.

References SymbolTable.

Referenced by llvm::objcopy::executeObjcopyOnArchive(), getNumberOfSymbols(), and symbol_begin().

◆ isEmpty()

bool Archive::isEmpty ( ) const
virtual

Reimplemented in llvm::object::BigArchive.

Definition at line 1278 of file Archive.cpp.

References llvm::object::Binary::Data, and getArchiveMagicLen().

Referenced by child_begin().

◆ isThin()

◆ kind()

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

◆ operator=()

Archive & llvm::object::Archive::operator= ( Archive const & )
delete

References Archive().

◆ setFirstRegular()

void Archive::setFirstRegular ( const Child & C)
protected

Definition at line 701 of file Archive.cpp.

References llvm::CallingConv::C.

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

◆ symbol_begin()

◆ symbol_end()

Archive::symbol_iterator Archive::symbol_end ( ) const

Definition at line 1188 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 360 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 379 of file Archive.h.

Member Data Documentation

◆ ECSymbolTable

StringRef llvm::object::Archive::ECSymbolTable
protected

Definition at line 392 of file Archive.h.

Referenced by Archive(), ec_symbols(), and getNumberOfECSymbols().

◆ MaxMemberSize

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

Size field is 10 decimal digits long.

Definition at line 342 of file Archive.h.

Referenced by computeMemberData().

◆ StringTable

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

Definition at line 393 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: