Add OwnedTargetMachine to manage llvm:TargetMachine. Uses pointers

instead of &'static mut and provides safe interface to create/dispose
it.
This commit is contained in:
Florian Schmiderer 2023-09-17 14:40:22 +02:00
parent fc61fabc24
commit 3409ca65d8
7 changed files with 148 additions and 40 deletions

View file

@ -79,3 +79,9 @@ impl<'a> FromIterator<&'a str> for SmallCStr {
Self { data }
}
}
impl From<&ffi::CStr> for SmallCStr {
fn from(s: &ffi::CStr) -> Self {
Self { data: SmallVec::from_slice(s.to_bytes()) }
}
}