moved default CPU message inline

This commit is contained in:
James Dietz 2023-04-28 17:23:40 -04:00
parent ea17aa9141
commit 9aa596a014
3 changed files with 11 additions and 15 deletions

View file

@ -2249,7 +2249,7 @@ extern "C" {
pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine, cpu: *const c_char);
pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
pub fn LLVMRustGetTargetFeature(
T: &TargetMachine,

View file

@ -330,11 +330,9 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) {
let tm = create_informational_target_machine(sess);
match req {
PrintRequest::TargetCPUs => {
println!(
"Default CPU for this target:\n {}",
handle_native(sess.target.cpu.as_ref())
);
unsafe { llvm::LLVMRustPrintTargetCPUs(tm, handle_native(sess.target.cpu.as_ref())) };
let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref()))
.expect("failed to convert to cstring");
unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) };
}
PrintRequest::TargetFeatures => print_target_features(sess, tm),
_ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req),