llvm::SkipBitcodeWrapperHeader

SkipBitcodeWrapperHeader - Some systems wrap bc files with a special header for padding or other reasons. The format of this header is:

Synopsis

Declared in <llvm/Bitcode/BitcodeReader.h>

bool
SkipBitcodeWrapperHeader(
    unsigned char const*& BufPtr,
    unsigned char const*& BufEnd,
    bool VerifyBufferSize);

Description

struct bc_header { uint32_t Magic; // 0x0B17C0DE uint32_t Version; // Version, currently always 0. uint32_t BitcodeOffset; // Offset to traditional bitcode file. uint32_t BitcodeSize; // Size of traditional bitcode file. ... potentially other gunk ... };

This function is called when we find a file with a matching magic number. In this case, skip down to the subsection of the file that is actually a BC file. If 'VerifyBufferSize' is true, check that the buffer is large enough to contain the whole bitcode file.

Return Value

True if the wrapper is invalid or the buffer is too small; false on success after advancing BufPtr and BufEnd.

Parameters

NameDescription
BufPtrOn entry, start of the wrapper; on success, advanced to the bitcode payload.
BufEndOn entry, end of the buffer; on success, set to the end of the bitcode payload.
VerifyBufferSizeIf true, check that the buffer is large enough to contain the whole bitcode file.