LLVM API Documentation

llvm::ArchiveMember Class Reference

This class represents a single archive member. More...

#include <Archive.h>

Collaboration diagram for llvm::ArchiveMember:

Collaboration graph
[legend]
List of all members.

Constructors

class llvm::Archive
 ArchiveMember ()

Public Types

Types
enum  Flags {
  CompressedFlag = 1, SVR4SymbolTableFlag = 2, BSD4SymbolTableFlag = 4, LLVMSymbolTableFlag = 8,
  BytecodeFlag = 16, CompressedBytecodeFlag = 32, HasPathFlag = 64, HasLongFilenameFlag = 128,
  StringTableFlag = 256
}

Public Member Functions

Accessors
ArchivegetArchive () const
 Get the archive associated with this member.
const sys::PathgetPath () const
 Get the path to the archive member.
unsigned getUser () const
 Get the user associated with this archive member.
unsigned getGroup () const
 Get the group associated with this archive member.
unsigned getMode () const
 Get the permission mode associated with this archive member.
sys::TimeValue getModTime () const
 Get the time of last modification of the archive member.
unsigned getSize () const
 Get the size of the archive member.
unsigned getMemberSize () const
 Get total on-disk member size.
const void * getData () const
 Get the data content of the archive member.
bool isCompressed () const
 Determine if the member is a compressed regular file.
bool isSVR4SymbolTable () const
 Determine if this member is a SVR4 symbol table.
bool isBSD4SymbolTable () const
 Determine if this member is a BSD4.4 symbol table.
bool isLLVMSymbolTable () const
 Determine if this member is the LLVM symbol table.
bool isStringTable () const
 Determine if this member is the ar(1) string table.
bool isBytecode () const
 Determine if this member is a bytecode file.
bool isCompressedBytecode () const
 Determine if the member is a compressed bytecode file.
bool hasPath () const
 Determine if the member has a path.
bool hasLongFilename () const
 Determin if the member has a long file name.
const sys::Path::StatusInfogetStatusInfo () const
 Obtain the status info for the archive member.
void replaceWith (const sys::Path &aFile)
 Replace contents of archive member with a new file.
ilist methods - do not use
const ArchiveMembergetNext () const
const ArchiveMembergetPrev () const
ArchiveMembergetNext ()
ArchiveMembergetPrev ()
void setPrev (ArchiveMember *p)
void setNext (ArchiveMember *n)

Detailed Description

This class represents a single archive member.

This class is the main class manipulated by users of the Archive class. It holds information about one member of the Archive. It is also the element stored by the Archive's ilist, the Archive's main abstraction. Because of the special requirements of archive files, users are not permitted to construct ArchiveMember instances. You should obtain them from the methods of the Archive class instead.

Definition at line 42 of file Archive.h.


Member Enumeration Documentation

enum llvm::ArchiveMember::Flags

These flags are used internally by the archive member to specify various characteristics of the member. The various "is" methods below provide access to the flags. The flags are not user settable.

Enumerator:
CompressedFlag  Member is a normal compressed file.
SVR4SymbolTableFlag  Member is a SVR4 symbol table.
BSD4SymbolTableFlag  Member is a BSD4 symbol table.
LLVMSymbolTableFlag  Member is an LLVM symbol table.
BytecodeFlag  Member is uncompressed bytecode.
CompressedBytecodeFlag  Member is compressed bytecode.
HasPathFlag  Member has a full or partial path.
HasLongFilenameFlag  Member uses the long filename syntax.
StringTableFlag  Member is an ar(1) format string table.

Definition at line 50 of file Archive.h.


Constructor & Destructor Documentation

ArchiveMember::ArchiveMember (  ) 

The default constructor is only used by the Archive's iplist when it constructs the list's sentry node.

Definition at line 41 of file Archive.cpp.

References llvm::sys::Path::StatusInfo::fileSize, llvm::sys::Process::GetCurrentGroupId(), llvm::sys::Process::GetCurrentUserId(), llvm::sys::Path::StatusInfo::group, llvm::sys::Path::StatusInfo::mode, llvm::sys::Path::StatusInfo::modTime, llvm::sys::TimeValue::now(), and llvm::sys::Path::StatusInfo::user.


Member Function Documentation

Archive* llvm::ArchiveMember::getArchive (  )  const [inline]

Get the archive associated with this member.

Returns:
the parent Archive instance

Definition at line 68 of file Archive.h.

const sys::Path& llvm::ArchiveMember::getPath (  )  const [inline]

Get the path to the archive member.

Returns:
the path to the Archive's file

Definition at line 72 of file Archive.h.

Referenced by llvm::Archive::fillHeader(), llvm::Archive::findModulesDefiningSymbols(), and llvm::Archive::writeMember().

unsigned llvm::ArchiveMember::getUser (  )  const [inline]

Get the user associated with this archive member.

The "user" is the owner of the file per Unix security. This may not have any applicability on non-Unix systems but is a required component of the "ar" file format.

Definition at line 78 of file Archive.h.

References llvm::sys::Path::StatusInfo::user.

Referenced by llvm::Archive::fillHeader().

unsigned llvm::ArchiveMember::getGroup (  )  const [inline]

Get the group associated with this archive member.

The "group" is the owning group of the file per Unix security. This may not have any applicability on non-Unix systems but is a required component of the "ar" file format.

Definition at line 84 of file Archive.h.

References llvm::sys::Path::StatusInfo::group.

Referenced by llvm::Archive::fillHeader().

unsigned llvm::ArchiveMember::getMode (  )  const [inline]

Get the permission mode associated with this archive member.

The "mode" specifies the access permissions for the file per Unix security. This may not have any applicabiity on non-Unix systems but is a required component of the "ar" file format.

Definition at line 90 of file Archive.h.

References llvm::sys::Path::StatusInfo::mode.

Referenced by llvm::Archive::fillHeader().

sys::TimeValue llvm::ArchiveMember::getModTime (  )  const [inline]

Get the time of last modification of the archive member.

This method returns the time at which the archive member was last modified when it was not in the archive.

Definition at line 95 of file Archive.h.

References llvm::sys::Path::StatusInfo::modTime.

Referenced by llvm::Archive::fillHeader().

unsigned llvm::ArchiveMember::getSize (  )  const [inline]

Get the size of the archive member.

Returns:
the size of the archive member in bytes.

Definition at line 99 of file Archive.h.

References llvm::sys::Path::StatusInfo::fileSize.

Referenced by llvm::Archive::findModulesDefiningSymbols(), llvm::Archive::loadArchive(), llvm::Archive::loadSymbolTable(), and llvm::Archive::writeMember().

unsigned ArchiveMember::getMemberSize (  )  const

Get total on-disk member size.

This method returns the total size of the archive member as it appears on disk. This includes the file content, the header, the long file name if any, and the padding.

Definition at line 24 of file Archive.cpp.

References llvm::sys::Path::StatusInfo::fileSize, hasLongFilename(), and llvm::sys::Path::toString().

const void* llvm::ArchiveMember::getData (  )  const [inline]

Get the data content of the archive member.

This method will return a pointer to the in-memory content of the archive member, if it is available. If the data has not been loaded into memory, the return value will be null.

Returns:
a pointer to the member's data.

Definition at line 112 of file Archive.h.

Referenced by llvm::Archive::loadArchive(), llvm::Archive::loadSymbolTable(), and llvm::Archive::writeMember().

bool llvm::ArchiveMember::isCompressed (  )  const [inline]

Determine if the member is a compressed regular file.

This method determines if the member is a regular compressed file. Note that compressed bytecode files will yield "false" for this method.

See also:
isCompressedBytecode()
Returns:
true iff the archive member is a compressed regular file.

Definition at line 119 of file Archive.h.

References CompressedFlag.

Referenced by llvm::Archive::writeMember().

bool llvm::ArchiveMember::isSVR4SymbolTable (  )  const [inline]

Determine if this member is a SVR4 symbol table.

Returns:
true iff the member is a SVR4 (non-LLVM) symbol table

Definition at line 123 of file Archive.h.

References SVR4SymbolTableFlag.

Referenced by llvm::Archive::fillHeader(), llvm::Archive::loadArchive(), llvm::Archive::loadSymbolTable(), and llvm::Archive::writeMember().

bool llvm::ArchiveMember::isBSD4SymbolTable (  )  const [inline]

Determine if this member is a BSD4.4 symbol table.

Returns:
true iff the member is a BSD4.4 (non-LLVM) symbol table

Definition at line 127 of file Archive.h.

References BSD4SymbolTableFlag.

Referenced by llvm::Archive::fillHeader(), llvm::Archive::loadArchive(), llvm::Archive::loadSymbolTable(), and llvm::Archive::writeMember().

bool llvm::ArchiveMember::isLLVMSymbolTable (  )  const [inline]

Determine if this member is the LLVM symbol table.

Returns:
true iff the archive member is the LLVM symbol table

Definition at line 131 of file Archive.h.

References LLVMSymbolTableFlag.

Referenced by llvm::Archive::fillHeader(), llvm::Archive::loadArchive(), llvm::Archive::loadSymbolTable(), and llvm::Archive::writeMember().

bool llvm::ArchiveMember::isStringTable (  )  const [inline]

Determine if this member is the ar(1) string table.

Returns:
true iff the archive member is the ar(1) string table

Definition at line 135 of file Archive.h.

References StringTableFlag.

Referenced by llvm::Archive::fillHeader(), llvm::Archive::loadArchive(), and llvm::Archive::loadSymbolTable().

bool llvm::ArchiveMember::isBytecode (  )  const [inline]

Determine if this member is a bytecode file.

Returns:
true iff the archive member is an uncompressed bytecode file.

Definition at line 139 of file Archive.h.

References BytecodeFlag.

Referenced by llvm::Archive::findModulesDefiningSymbols(), and llvm::Archive::writeMember().

bool llvm::ArchiveMember::isCompressedBytecode (  )  const [inline]

Determine if the member is a compressed bytecode file.

Returns:
true iff the archive member is a compressed bytecode file.

Definition at line 143 of file Archive.h.

References CompressedBytecodeFlag.

Referenced by llvm::Archive::findModulesDefiningSymbols(), and llvm::Archive::writeMember().

bool llvm::ArchiveMember::hasPath (  )  const [inline]

Determine if the member has a path.

Returns:
true iff the file name contains a path (directory) component.

Definition at line 147 of file Archive.h.

References HasPathFlag.

bool llvm::ArchiveMember::hasLongFilename (  )  const [inline]

Determin if the member has a long file name.

Long filenames are an artifact of the ar(1) file format which allows up to sixteen characters in its header and doesn't allow a path separator character (/). To avoid this, a "long format" member name is allowed that doesn't have this restriction. This method determines if that "long format" is used for this member.

Returns:
true iff the file name uses the long form

Definition at line 156 of file Archive.h.

References HasLongFilenameFlag.

Referenced by getMemberSize().

const sys::Path::StatusInfo& llvm::ArchiveMember::getStatusInfo (  )  const [inline]

Obtain the status info for the archive member.

This method returns the status info (like Unix stat(2)) for the archive member. The status info provides the file's size, permissions, and modification time. The contents of the Path::StatusInfo structure, other than the size and modification time, may not have utility on non-Unix systems.

Returns:
the status info for the archive member

Definition at line 165 of file Archive.h.

void ArchiveMember::replaceWith ( const sys::Path aFile  ) 

Replace contents of archive member with a new file.

This method causes the archive member to be replaced with the contents of the file specified by File. The contents of this will be updated to reflect the new data from File. The File must exist and be readable on entry to this method.

Definition at line 64 of file Archive.cpp.

References ARFILE_BSD4_SYMTAB_NAME, ARFILE_LLVM_SYMTAB_NAME, ARFILE_STRTAB_NAME, ARFILE_SVR4_SYMTAB_NAME, BSD4SymbolTableFlag, llvm::sys::BytecodeFileType, BytecodeFlag, llvm::sys::CompressedBytecodeFileType, CompressedBytecodeFlag, CompressedFlag, llvm::sys::Path::exists(), llvm::sys::Path::getMagicNumber(), llvm::sys::Path::getStatusInfo(), HasLongFilenameFlag, HasPathFlag, llvm::sys::IdentifyFileType(), LLVMSymbolTableFlag, StringTableFlag, SVR4SymbolTableFlag, and llvm::sys::Path::toString().

const ArchiveMember* llvm::ArchiveMember::getNext (  )  const [inline]

Definition at line 178 of file Archive.h.

const ArchiveMember* llvm::ArchiveMember::getPrev (  )  const [inline]

Definition at line 179 of file Archive.h.

ArchiveMember* llvm::ArchiveMember::getNext (  )  [inline]

Definition at line 180 of file Archive.h.

ArchiveMember* llvm::ArchiveMember::getPrev (  )  [inline]

Definition at line 181 of file Archive.h.

void llvm::ArchiveMember::setPrev ( ArchiveMember p  )  [inline]

Definition at line 182 of file Archive.h.

void llvm::ArchiveMember::setNext ( ArchiveMember n  )  [inline]

Definition at line 183 of file Archive.h.


Friends And Related Function Documentation

friend class llvm::Archive [friend]

Definition at line 211 of file Archive.h.


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