class BitstreamCursor

Declaration

class BitstreamCursor : private SimpleBitstreamCursor { /* full declaration omitted */ };

Description

This represents a position within a bitcode file, implemented on top of a SimpleBitstreamCursor. Unlike iterators, BitstreamCursors are heavy-weight objects that should not be passed by value.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:358

Inherits from: SimpleBitstreamCursor

Member Variables

private unsigned int CurCodeSize = 2
private std::vector<std::shared_ptr<BitCodeAbbrev>> CurAbbrevs
Abbrevs installed at in this block.
private SmallVector<llvm::BitstreamCursor::Block, 8> BlockScope
This tracks the codesize of parent blocks.
private llvm::BitstreamBlockInfo* BlockInfo = nullptr
public static const size_t MaxChunkSize = 32

Method Overview

Methods

BitstreamCursor(ArrayRef<uint8_t> BitcodeBytes)

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:382

Parameters

ArrayRef<uint8_t> BitcodeBytes

BitstreamCursor(llvm::StringRef BitcodeBytes)

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:384

Parameters

llvm::StringRef BitcodeBytes

BitstreamCursor(
    llvm::MemoryBufferRef BitcodeBytes)

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:386

Parameters

llvm::MemoryBufferRef BitcodeBytes

BitstreamCursor()

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:381

llvm::Error EnterSubBlock(
    unsigned int BlockID,
    unsigned int* NumWordsP = nullptr)

Description

Having read the ENTER_SUBBLOCK abbrevid, and enter the block.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:516

Parameters

unsigned int BlockID
unsigned int* NumWordsP = nullptr

llvm::Error ReadAbbrevRecord()

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:561

bool ReadBlockEnd()

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:518

Expected<Optional<llvm::BitstreamBlockInfo>>
ReadBlockInfoBlock(
    bool ReadBlockInfoNames = false)

Description

Read and return a block info block from the bitstream. If an error was encountered, return None.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:569

Parameters

bool ReadBlockInfoNames = false
Whether to read block/record name information in the BlockInfo block. Only llvm-bcanalyzer uses this.

Expected<unsigned int> ReadCode()

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:474

Expected<unsigned int> ReadSubBlockID()

Description

Having read the ENTER_SUBBLOCK code, read the BlockID for the block.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:480

llvm::Error SkipBlock()

Description

Having read the ENTER_SUBBLOCK abbrevid and a BlockID, skip over the body of this block.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:484

Expected<llvm::BitstreamEntry> advance(
    unsigned int Flags = 0)

Description

Advance the current bitstream, returning the next entry in the stream.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:418

Parameters

unsigned int Flags = 0

Expected<llvm::BitstreamEntry>
advanceSkippingSubblocks(unsigned int Flags = 0)

Description

This is a convenience function for clients that don't expect any subblocks. This just skips over them automatically.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:457

Parameters

unsigned int Flags = 0

Expected<const llvm::BitCodeAbbrev*> getAbbrev(
    unsigned int AbbrevID)

Description

Return the abbreviation for the specified AbbrevId.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:543

Parameters

unsigned int AbbrevID

unsigned int getAbbrevIDWidth() const

Description

Return the number of bits used to encode an abbrev #.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:404

void popBlockScope()

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:530

Expected<unsigned int> readRecord(
    unsigned int AbbrevID,
    SmallVectorImpl<uint64_t>& Vals,
    llvm::StringRef* Blob = nullptr)

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:554

Parameters

unsigned int AbbrevID
SmallVectorImpl<uint64_t>& Vals
llvm::StringRef* Blob = nullptr

void setBlockInfo(llvm::BitstreamBlockInfo* BI)

Description

Set the block info to be used by this BitstreamCursor to interpret abbreviated records.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:573

Parameters

llvm::BitstreamBlockInfo* BI

Expected<unsigned int> skipRecord(
    unsigned int AbbrevID)

Description

Read the current record and discard it, returning the code for the record.

Declared at: llvm/include/llvm/Bitstream/BitstreamReader.h:552

Parameters

unsigned int AbbrevID