mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-04-19 16:04:44 +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::convert::TryInto;
|
||||
use std::ffi::{CStr, NulError};
|
||||
use std::mem;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::ops::Deref;
|
||||
use std::{i8, ptr};
|
||||
|
||||
|
@ -153,9 +153,10 @@ pub struct MemoryBuffer(LLVMMemoryBufferRef);
|
|||
impl MemoryBuffer {
|
||||
pub fn print_as_asm(&self) -> &str {
|
||||
unsafe {
|
||||
let mut module: LLVMModuleRef = mem::zeroed();
|
||||
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);
|
||||
LLVMDisposeModule(module);
|
||||
let asm = CStr::from_ptr(asm);
|
||||
|
|
Loading…
Add table
Reference in a new issue