Class LLVMOptRemarks


  • public class LLVMOptRemarks
    extends java.lang.Object
    • Field Detail

      • OPT_REMARKS_API_VERSION

        public static final int OPT_REMARKS_API_VERSION
        See Also:
        Constant Field Values
    • Method Detail

      • nLLVMOptRemarkParserCreate

        public static long nLLVMOptRemarkParserCreate​(long Buf,
                                                      long Size)
        Unsafe version of: OptRemarkParserCreate
      • LLVMOptRemarkParserCreate

        public static long LLVMOptRemarkParserCreate​(java.nio.ByteBuffer Buf)
        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 OptRemarkParserDispose to avoid leaking resources.

      • nLLVMOptRemarkParserGetNext

        public static long nLLVMOptRemarkParserGetNext​(long Parser)
        Unsafe version of: OptRemarkParserGetNext
      • LLVMOptRemarkParserGetNext

        @Nullable
        public static LLVMOptRemarkEntry LLVMOptRemarkParserGetNext​(long Parser)
        Returns the next remark in the file.

        The value pointed to by the return value is invalidated by the next call to OptRemarkParserGetNext.

        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. OptRemarkParserHasError will return 1.
        2. OptRemarkParserGetErrorMessage 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:

        
         LLVMOptRemarkParserRef Parser = LLVMOptRemarkParserCreate(Buf, Size);
         LLVMOptRemarkEntry *Remark = NULL;
         while ((Remark == LLVMOptRemarkParserGetNext(Parser))) {
           // use Remark
         }
         bool HasError = LLVMOptRemarkParserHasError(Parser);
         LLVMOptRemarkParserDispose(Parser);
      • LLVMOptRemarkParserHasError

        public static boolean LLVMOptRemarkParserHasError​(long Parser)
        Returns 1 if the parser encountered an error while parsing the buffer.
      • nLLVMOptRemarkParserGetErrorMessage

        public static long nLLVMOptRemarkParserGetErrorMessage​(long Parser)
      • LLVMOptRemarkParserGetErrorMessage

        @Nullable
        public static java.lang.String LLVMOptRemarkParserGetErrorMessage​(long 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 OptRemarkParserDispose is called, the memory of the string will be released.

      • LLVMOptRemarkParserDispose

        public static void LLVMOptRemarkParserDispose​(long Parser)
        Releases all the resources used by Parser.
      • LLVMOptRemarkVersion

        public static int LLVMOptRemarkVersion()
        Returns the version of the opt-remarks dylib.
        Since:
        8.0