diff options
| author | Florian Schmiderer <florian.schmiderer@posteo.net> | 2023-09-17 14:40:22 +0200 |
|---|---|---|
| committer | Florian Schmiderer <florian.schmiderer@posteo.net> | 2023-09-24 21:11:37 +0200 |
| commit | 3409ca65d835b858d9cefbe8949552f0f5ad0788 (patch) | |
| tree | 4c29f7080246e3db1671791ee5befdbac89fc9b4 /compiler/rustc_codegen_llvm/src/llvm_util.rs | |
| parent | fc61fabc24b94755bb33517a81e81d9981c992ab (diff) | |
| download | rust-3409ca65d835b858d9cefbe8949552f0f5ad0788.tar.gz rust-3409ca65d835b858d9cefbe8949552f0f5ad0788.zip | |
Add OwnedTargetMachine to manage llvm:TargetMachine. Uses pointers
instead of &'static mut and provides safe interface to create/dispose it.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index a76c9c9b735..7c8ef67ffd1 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -303,7 +303,7 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> { // check that all features in a given smallvec are enabled for llvm_feature in to_llvm_features(sess, feature) { let cstr = SmallCStr::new(llvm_feature); - if !unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } { + if !unsafe { llvm::LLVMRustHasFeature(&target_machine, cstr.as_ptr()) } { return false; } } @@ -422,14 +422,14 @@ pub(crate) fn print(req: &PrintRequest, mut out: &mut dyn PrintBackendInfo, sess } unsafe { llvm::LLVMRustPrintTargetCPUs( - tm, + &tm, cpu_cstring.as_ptr(), callback, &mut out as *mut &mut dyn PrintBackendInfo as *mut c_void, ); } } - PrintKind::TargetFeatures => print_target_features(out, sess, tm), + PrintKind::TargetFeatures => print_target_features(out, sess, &tm), _ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req), } } |
