LLVM  8.0.1
Public Member Functions | Static Public Member Functions | List of all members
llvm::object::Decompressor Class Reference

Decompressor helps to handle decompression of compressed sections. More...

#include "llvm/Object/Decompressor.h"

Public Member Functions

template<class T >
Error resizeAndDecompress (T &Out)
 Resize the buffer and uncompress section data into it. More...
 
Error decompress (MutableArrayRef< char > Buffer)
 Uncompress section data to raw buffer provided. More...
 
uint64_t getDecompressedSize ()
 Return memory buffer size required for decompression. More...
 

Static Public Member Functions

static Expected< Decompressorcreate (StringRef Name, StringRef Data, bool IsLE, bool Is64Bit)
 Create decompressor object. More...
 
static bool isCompressed (const object::SectionRef &Section)
 Return true if section is compressed, including gnu-styled case. More...
 
static bool isCompressedELFSection (uint64_t Flags, StringRef Name)
 Return true if section is a ELF compressed one. More...
 
static bool isGnuStyle (StringRef Name)
 Return true if section name matches gnu style compressed one. More...
 

Detailed Description

Decompressor helps to handle decompression of compressed sections.

Definition at line 21 of file Decompressor.h.

Member Function Documentation

◆ create()

Expected< Decompressor > Decompressor::create ( StringRef  Name,
StringRef  Data,
bool  IsLE,
bool  Is64Bit 
)
static

Create decompressor object.

Parameters
NameSection name.
DataSection content.
IsLEFlag determines if Data is in little endian form.
Is64BitFlag determines if object is 64 bit.

Definition at line 21 of file Decompressor.cpp.

References llvm::object::createError(), D, and llvm::zlib::isAvailable().

◆ decompress()

Error Decompressor::decompress ( MutableArrayRef< char Buffer)

Uncompress section data to raw buffer provided.

Parameters
BufferDestination buffer.

Definition at line 91 of file Decompressor.cpp.

References llvm::MutableArrayRef< T >::data(), Size, llvm::ArrayRef< T >::size(), and llvm::zlib::uncompress().

Referenced by resizeAndDecompress().

◆ getDecompressedSize()

uint64_t llvm::object::Decompressor::getDecompressedSize ( )
inline

Return memory buffer size required for decompression.

Definition at line 43 of file Decompressor.h.

References isCompressed(), isCompressedELFSection(), isGnuStyle(), and llvm::ARMBuildAttrs::Section.

◆ isCompressed()

bool Decompressor::isCompressed ( const object::SectionRef Section)
static

Return true if section is compressed, including gnu-styled case.

Definition at line 80 of file Decompressor.cpp.

References llvm::object::SectionRef::getName(), llvm::object::SectionRef::isCompressed(), and Name.

Referenced by getDecompressedSize().

◆ isCompressedELFSection()

bool Decompressor::isCompressedELFSection ( uint64_t  Flags,
StringRef  Name 
)
static

Return true if section is a ELF compressed one.

Definition at line 87 of file Decompressor.cpp.

References llvm::ELF::SHF_COMPRESSED.

Referenced by getDecompressedSize().

◆ isGnuStyle()

bool Decompressor::isGnuStyle ( StringRef  Name)
static

Return true if section name matches gnu style compressed one.

Definition at line 76 of file Decompressor.cpp.

References llvm::StringRef::startswith().

Referenced by getDecompressedSize().

◆ resizeAndDecompress()

template<class T >
Error llvm::object::Decompressor::resizeAndDecompress ( T Out)
inline

Resize the buffer and uncompress section data into it.

Parameters
OutDestination buffer.

Definition at line 33 of file Decompressor.h.

References decompress().


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