Learn R Programming

Rllvm (version 0.7-0)

parseIRError: Raise an error from parseIR

Description

This is an R-level function for raising an error specifically from parsing an IR file. This is implemented in R and called from C++ code because the messages were calling problems and also because it is easier to raise richer errors, i.e. with classes and extra information.

Usage

parseIRError(line, col, msg)

Arguments

line

the line number in the file where the error occurred

col

the column number in the line where the error occurred

msg

the message describing the error as provided by LLVM

Value

An error object of class ParseIRError and LLVMError.

See Also

parseIR

Examples

Run this code
# NOT RUN {
  ir = c("<!-- %CXCursor = type { i32, i32, [3 x i8*]}", -->
         "declare i8* @foo(<!-- %CXCursor.3* byval align 8) #1 ") -->
    tryCatch(parseIR(paste(ir, collapse = "\n")),
             error = function(e) {
                       print(e$message)
                       print(e$lineNum)
                       print(e$colNum)
                       print(class(e))
                     })
# }

Run the code above in your browser using DataLab