mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-02 22:30:41 +00:00
LLVM unit tests: use MaybeUninit
This commit is contained in:
parent
5a15204910
commit
8a9faa6644
1 changed files with 4 additions and 3 deletions
|
@ -27,7 +27,7 @@
|
||||||
use std::array::TryFromSliceError;
|
use std::array::TryFromSliceError;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::ffi::{CStr, NulError};
|
use std::ffi::{CStr, NulError};
|
||||||
use std::mem;
|
use std::mem::MaybeUninit;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::{i8, ptr};
|
use std::{i8, ptr};
|
||||||
|
|
||||||
|
@ -153,9 +153,10 @@ pub struct MemoryBuffer(LLVMMemoryBufferRef);
|
||||||
impl MemoryBuffer {
|
impl MemoryBuffer {
|
||||||
pub fn print_as_asm(&self) -> &str {
|
pub fn print_as_asm(&self) -> &str {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut module: LLVMModuleRef = mem::zeroed();
|
|
||||||
let context = Context::new();
|
let context = Context::new();
|
||||||
LLVMParseBitcodeInContext2(context.0, self.0, &mut module);
|
let mut module = MaybeUninit::uninit();
|
||||||
|
LLVMParseBitcodeInContext2(context.0, self.0, module.as_mut_ptr());
|
||||||
|
let module = module.assume_init();
|
||||||
let asm = LLVMPrintModuleToString(module);
|
let asm = LLVMPrintModuleToString(module);
|
||||||
LLVMDisposeModule(module);
|
LLVMDisposeModule(module);
|
||||||
let asm = CStr::from_ptr(asm);
|
let asm = CStr::from_ptr(asm);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue