LLVM  8.0.1
Classes | Macros | Typedefs | Functions
Collaboration diagram for OptRemarks:

Classes

struct  LLVMOptRemarkStringRef
 String containing a buffer and a length. More...
 
struct  LLVMOptRemarkDebugLoc
 DebugLoc containing File, Line and Column. More...
 
struct  LLVMOptRemarkArg
 Element of the "Args" list. More...
 
struct  LLVMOptRemarkEntry
 One remark entry. More...
 

Macros

#define OPT_REMARKS_API_VERSION   0
 

Typedefs

typedef struct LLVMOptRemarkOpaqueParser * LLVMOptRemarkParserRef
 

Functions

LLVMOptRemarkParserRef LLVMOptRemarkParserCreate (const void *Buf, uint64_t Size)
 Creates a remark parser that can be used to read and parse the buffer located in Buf of size Size. More...
 
LLVMOptRemarkEntryLLVMOptRemarkParserGetNext (LLVMOptRemarkParserRef Parser)
 Returns the next remark in the file. More...
 
LLVMBool LLVMOptRemarkParserHasError (LLVMOptRemarkParserRef Parser)
 Returns 1 if the parser encountered an error while parsing the buffer. More...
 
const charLLVMOptRemarkParserGetErrorMessage (LLVMOptRemarkParserRef Parser)
 Returns a null-terminated string containing an error message. More...
 
void LLVMOptRemarkParserDispose (LLVMOptRemarkParserRef Parser)
 Releases all the resources used by Parser. More...
 
uint32_t LLVMOptRemarkVersion (void)
 Returns the version of the opt-remarks dylib. More...
 

Detailed Description

Macro Definition Documentation

◆ OPT_REMARKS_API_VERSION

#define OPT_REMARKS_API_VERSION   0

Definition at line 34 of file OptRemarks.h.

Typedef Documentation

◆ LLVMOptRemarkParserRef

typedef struct LLVMOptRemarkOpaqueParser* LLVMOptRemarkParserRef

Definition at line 102 of file OptRemarks.h.

Function Documentation

◆ LLVMOptRemarkParserCreate()

LLVMOptRemarkParserRef LLVMOptRemarkParserCreate ( const void *  Buf,
uint64_t  Size 
)

Creates a remark parser that can be used to read and parse the buffer located in Buf of size Size.

Buf cannot be NULL.

This function should be paired with LLVMOptRemarkParserDispose() to avoid leaking resources.

Since
OPT_REMARKS_API_VERSION=0

Definition at line 325 of file OptRemarksParser.cpp.

References llvm::wrap().

◆ LLVMOptRemarkParserDispose()

void LLVMOptRemarkParserDispose ( LLVMOptRemarkParserRef  Parser)

Releases all the resources used by Parser.

Since
OPT_REMARKS_API_VERSION=0

Definition at line 366 of file OptRemarksParser.cpp.

References llvm::unwrap().

◆ LLVMOptRemarkParserGetErrorMessage()

const char* LLVMOptRemarkParserGetErrorMessage ( LLVMOptRemarkParserRef  Parser)

Returns a null-terminated string containing an error message.

In case of no error, the result is NULL.

The memory of the string is bound to the lifetime of Parser. If LLVMOptRemarkParserDispose() is called, the memory of the string will be released.

Since
OPT_REMARKS_API_VERSION=0

Definition at line 362 of file OptRemarksParser.cpp.

References llvm::unwrap().

◆ LLVMOptRemarkParserGetNext()

LLVMOptRemarkEntry* LLVMOptRemarkParserGetNext ( LLVMOptRemarkParserRef  Parser)

Returns the next remark in the file.

The value pointed to by the return value is invalidated by the next call to LLVMOptRemarkParserGetNext().

If the parser reaches the end of the buffer, the return value will be NULL.

In the case of an error, the return value will be NULL, and:

1) LLVMOptRemarkParserHasError() will return 1.

2) LLVMOptRemarkParserGetErrorMessage() will return a descriptive error message.

An error may occur if:

1) An argument is invalid.

2) There is a YAML parsing error. This type of error aborts parsing immediately and returns 1. It can occur on malformed YAML.

3) Remark parsing error. If this type of error occurs, the parser won't call the handler and will continue to the next one. It can occur on malformed remarks, like missing or extra fields in the file.

Here is a quick example of the usage:

while ((Remark == LLVMOptRemarkParserGetNext(Parser))) {
// use Remark
}
bool HasError = LLVMOptRemarkParserHasError(Parser);
Since
OPT_REMARKS_API_VERSION=0

Definition at line 332 of file OptRemarksParser.cpp.

References E, llvm::handleAllErrors(), and llvm::unwrap().

◆ LLVMOptRemarkParserHasError()

LLVMBool LLVMOptRemarkParserHasError ( LLVMOptRemarkParserRef  Parser)

Returns 1 if the parser encountered an error while parsing the buffer.

Since
OPT_REMARKS_API_VERSION=0

Definition at line 357 of file OptRemarksParser.cpp.

References llvm::unwrap().

◆ LLVMOptRemarkVersion()

uint32_t LLVMOptRemarkVersion ( void  )

Returns the version of the opt-remarks dylib.

Since
OPT_REMARKS_API_VERSION=0