These functions are kind of a hack for the future. They wrap LLVM 7 rust shim functions and turn them into the API that the llvm 12 shim has. This way, if nvidia ever updates their dinosaur llvm version, switching for us should be extremely easy. `Name` is assumed to be a utf8 string
(
M: &'a Module,
Name: *const c_char,
NameLen: usize,
FunctionTy: &'a Type,
)
| 564 | // dinosaur llvm version, switching for us should be extremely easy. `Name` is assumed to be |
| 565 | // a utf8 string |
| 566 | pub(crate) unsafe fn LLVMRustGetOrInsertFunction<'a>( |
| 567 | M: &'a Module, |
| 568 | Name: *const c_char, |
| 569 | NameLen: usize, |
| 570 | FunctionTy: &'a Type, |
| 571 | ) -> &'a Value { |
| 572 | let str = std::str::from_utf8_unchecked(std::slice::from_raw_parts(Name.cast(), NameLen)); |
| 573 | let cstring = CString::new(str).expect("str with nul"); |
| 574 | __LLVMRustGetOrInsertFunction(M, cstring.as_ptr(), FunctionTy) |
| 575 | } |
| 576 | |
| 577 | pub(crate) unsafe fn LLVMRustBuildCall<'a>( |
| 578 | B: &Builder<'a>, |
no test coverage detected