1//! Remark diagnostics library.
2use prelude::LLVMBool;
34#[repr(C)]
5pub enum LLVMRemarkType {
6 LLVMRemarkTypeUnknown,
7 LLVMRemarkTypePassed,
8 LLVMRemarkTypeMissed,
9 LLVMRemarkTypeAnalysis,
10 LLVMRemarkTypeAnalysisFPCommute,
11 LLVMRemarkTypeAnalysisAliasing,
12 LLVMRemarkTypeFailure,
13}
1415pub enum LLVMRemarkOpaqueString {}
1617/// String containing a buffer and a length. The buffer is not guaranteed to be zero-terminated.
18pub type LLVMRemarkStringRef = *mut LLVMRemarkOpaqueString;
1920extern "C" {
21/// Returns the buffer holding the string.
22pub fn LLVMRemarkStringGetData(String: LLVMRemarkStringRef) -> *const ::libc::c_char;
2324/// Returns the size of the string.
25pub fn LLVMRemarkStringGetLen(String: LLVMRemarkStringRef) -> u32;
26}
2728pub enum LLVMRemarkOpaqueDebugLoc {}
2930/// DebugLoc containing File, Line and Column.
31pub type LLVMRemarkDebugLocRef = *mut LLVMRemarkOpaqueDebugLoc;
3233extern "C" {
34/// Return the path to the source file for a debug location.
35pub fn LLVMRemarkDebugLocGetSourceFilePath(DL: LLVMRemarkDebugLocRef) -> LLVMRemarkStringRef;
3637/// Return the line in the source file for a debug location.
38pub fn LLVMRemarkDebugLocGetSourceLine(DL: LLVMRemarkDebugLocRef) -> u32;
3940/// Return the column in the source file for a debug location.
41pub fn LLVMRemarkDebugLocGetSourceColumn(DL: LLVMRemarkDebugLocRef) -> u32;
42}
4344pub enum LLVMRemarkOpaqueArg {}
4546/// Element of the "Args" list. The key might give more information about what
47/// the semantics of the value are, e.g. "Callee" will tell you that the value
48/// is a symbol that names a function.
49pub type LLVMRemarkArgRef = *mut LLVMRemarkOpaqueArg;
5051extern "C" {
52/// Returns the key of an argument. The key defines what the value is, and the
53 /// same key can appear multiple times in the list of arguments.
54pub fn LLVMRemarkArgGetKey(Arg: LLVMRemarkArgRef) -> LLVMRemarkStringRef;
5556/// Returns the value of an argument. This is a string that can contain newlines.
57pub fn LLVMRemarkArgGetValue(Arg: LLVMRemarkArgRef) -> LLVMRemarkStringRef;
5859/// Returns the debug location that is attached to the value of this argument.
60pub fn LLVMRemarkArgGetDebugLoc(Arg: LLVMRemarkArgRef) -> LLVMRemarkDebugLocRef;
61}
6263pub enum LLVMRemarkOpaqueEntry {}
64/// A remark emitted by the compiler.
65pub type LLVMRemarkEntryRef = *mut LLVMRemarkOpaqueEntry;
6667extern "C" {
68/// Free the resources used by the remark entry.
69pub fn LLVMRemarkEntryDispose(Remark: LLVMRemarkEntryRef);
7071/// The type of the remark. For example, it can allow users to only keep the
72 /// missed optimizations from the compiler.
73pub fn LLVMRemarkEntryGetType(Remark: LLVMRemarkEntryRef) -> LLVMRemarkType;
7475/// Get the name of the pass that emitted this remark.
76pub fn LLVMRemarkEntryGetPassName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
7778/// Get an identifier of the remark.
79pub fn LLVMRemarkEntryGetRemarkName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
8081/// Get the name of the function being processed when the remark was emitted.
82pub fn LLVMRemarkEntryGetFunctionName(Remark: LLVMRemarkEntryRef) -> LLVMRemarkStringRef;
8384/// Returns the debug location that is attached to this remark.
85pub fn LLVMRemarkEntryGetDebugLoc(Remark: LLVMRemarkEntryRef) -> LLVMRemarkDebugLocRef;
8687/// Return the hotness of the remark.
88pub fn LLVMRemarkEntryGetHotness(Remark: LLVMRemarkEntryRef) -> u64;
8990/// The number of arguments the remark holds.
91pub fn LLVMRemarkEntryGetNumArgs(Remark: LLVMRemarkEntryRef) -> u32;
9293/// Get a new iterator to iterate over a remark's argument.
94pub fn LLVMRemarkEntryGetFirstArg(Remark: LLVMRemarkEntryRef) -> LLVMRemarkArgRef;
9596/// Get the next argument in Remark from the position of It.
97pub fn LLVMRemarkEntryGetNextArg(
98 It: LLVMRemarkArgRef,
99 Remark: LLVMRemarkEntryRef,
100 ) -> LLVMRemarkArgRef;
101}
102103pub enum LLVMRemarkOpaqueParser {}
104pub type LLVMRemarkParserRef = *mut LLVMRemarkOpaqueParser;
105106extern "C" {
107/// Creates a remark parser that can be used to parse the buffer located in
108 /// Buf of size Size bytes.
109pub fn LLVMRemarkParserCreateYAML(Buf: *const ::libc::c_void, Size: u64)
110 -> LLVMRemarkParserRef;
111112pub fn LLVMRemarkParserCreateBitstream(
113 Buf: *const ::libc::c_void,
114 Size: u64,
115 ) -> LLVMRemarkParserRef;
116117/// Returns the next remark in the file.
118pub fn LLVMRemarkParserGetNext(Parser: LLVMRemarkParserRef) -> LLVMRemarkEntryRef;
119120/// Returns `1` if the parser encountered an error while parsing the buffer.
121pub fn LLVMRemarkParserHasError(Parser: LLVMRemarkParserRef) -> LLVMBool;
122123/// Returns a null-terminated string containing an error message.
124pub fn LLVMRemarkParserGetErrorMessage(Parser: LLVMRemarkParserRef) -> *const ::libc::c_char;
125126pub fn LLVMRemarkParserDispose(Parser: LLVMRemarkParserRef);
127}
128129pub const REMARKS_API_VERSION: u32 = 1;
130131extern "C" {
132/// Returns the version of the remarks library.
133pub fn LLVMRemarkVersion() -> u32;
134}