LLVM 22.0.0git
llvm::remarks::BitstreamRemarkParser Struct Reference

Parses and holds the state of the latest parsed remark. More...

#include "Remarks/BitstreamRemarkParser.h"

Inheritance diagram for llvm::remarks::BitstreamRemarkParser:
[legend]

Public Member Functions

 BitstreamRemarkParser (StringRef Buf)
 Create a parser that expects to find a string table embedded in the stream.
Expected< std::unique_ptr< Remark > > next () override
 If no error occurs, this returns a valid Remark object.
Error parseMeta ()
 Parse and process the metadata of the buffer.
Public Member Functions inherited from llvm::remarks::RemarkParser
 RemarkParser (Format ParserFormat)
virtual ~RemarkParser ()=default

Static Public Member Functions

static bool classof (const RemarkParser *P)

Public Attributes

std::optional< BitstreamParserHelperParserHelper
 The buffer to parse.
std::optional< ParsedStringTableStrTab
 The string table used for parsing strings.
std::unique_ptr< MemoryBufferTmpRemarkBuffer
 Temporary remark buffer used when the remarks are stored separately.
bool IsMetaReady = false
 Whether the metadata has already been parsed, so we can continue parsing remarks.
uint64_t ContainerVersion = 0
 The common metadata used to decide how to parse the buffer.
uint64_t RemarkVersion = 0
BitstreamRemarkContainerType ContainerType
Public Attributes inherited from llvm::remarks::RemarkParser
Format ParserFormat
 The format of the parser.
std::string ExternalFilePrependPath
 Path to prepend when opening an external remark file.

Detailed Description

Parses and holds the state of the latest parsed remark.

Definition at line 217 of file BitstreamRemarkParser.h.

Constructor & Destructor Documentation

◆ BitstreamRemarkParser()

BitstreamRemarkParser::BitstreamRemarkParser ( StringRef Buf)
explicit

Create a parser that expects to find a string table embedded in the stream.

Definition at line 304 of file BitstreamRemarkParser.cpp.

References llvm::remarks::Bitstream, ParserHelper, and llvm::remarks::RemarkParser::RemarkParser().

Member Function Documentation

◆ classof()

bool llvm::remarks::BitstreamRemarkParser::classof ( const RemarkParser * P)
inlinestatic

◆ next()

Expected< std::unique_ptr< Remark > > BitstreamRemarkParser::next ( )
overridevirtual

If no error occurs, this returns a valid Remark object.

If an error of type EndOfFileError occurs, it is safe to recover from it by stopping the parsing. If any other error occurs, it should be propagated to the user. The pointer should never be null.

Implements llvm::remarks::RemarkParser.

Definition at line 307 of file BitstreamRemarkParser.cpp.

References error, IsMetaReady, llvm::make_error(), parseMeta(), and ParserHelper.

◆ parseMeta()

Error BitstreamRemarkParser::parseMeta ( )

Parse and process the metadata of the buffer.

Definition at line 333 of file BitstreamRemarkParser.cpp.

References ContainerType, llvm_unreachable, ParserHelper, llvm::remarks::RemarksFile, and llvm::remarks::RemarksFileExternal.

Referenced by next().

Member Data Documentation

◆ ContainerType

BitstreamRemarkContainerType llvm::remarks::BitstreamRemarkParser::ContainerType
Initial value:
=
@ RemarksFile
Emit metadata and remarks into a file RemarksFile: | Meta: | | Container info | | Remark version | Re...

Definition at line 231 of file BitstreamRemarkParser.h.

Referenced by parseMeta().

◆ ContainerVersion

uint64_t llvm::remarks::BitstreamRemarkParser::ContainerVersion = 0

The common metadata used to decide how to parse the buffer.

This is filled when parsing the metadata block.

Definition at line 229 of file BitstreamRemarkParser.h.

◆ IsMetaReady

bool llvm::remarks::BitstreamRemarkParser::IsMetaReady = false

Whether the metadata has already been parsed, so we can continue parsing remarks.

Definition at line 226 of file BitstreamRemarkParser.h.

Referenced by next().

◆ ParserHelper

std::optional<BitstreamParserHelper> llvm::remarks::BitstreamRemarkParser::ParserHelper

The buffer to parse.

Definition at line 219 of file BitstreamRemarkParser.h.

Referenced by BitstreamRemarkParser(), next(), and parseMeta().

◆ RemarkVersion

uint64_t llvm::remarks::BitstreamRemarkParser::RemarkVersion = 0

Definition at line 230 of file BitstreamRemarkParser.h.

◆ StrTab

std::optional<ParsedStringTable> llvm::remarks::BitstreamRemarkParser::StrTab

The string table used for parsing strings.

Definition at line 221 of file BitstreamRemarkParser.h.

◆ TmpRemarkBuffer

std::unique_ptr<MemoryBuffer> llvm::remarks::BitstreamRemarkParser::TmpRemarkBuffer

Temporary remark buffer used when the remarks are stored separately.

Definition at line 223 of file BitstreamRemarkParser.h.


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