Store individual output file name with every PrintRequest
This commit is contained in:
parent
11dcd1d3d7
commit
c0dc0c6875
6 changed files with 61 additions and 56 deletions
|
@ -40,7 +40,7 @@ use rustc_metadata::EncodedMetadata;
|
|||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::{OptLevel, OutputFilenames, PrintRequest};
|
||||
use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
|
||||
|
@ -262,9 +262,9 @@ impl CodegenBackend for LlvmCodegenBackend {
|
|||
|tcx, ()| llvm_util::global_llvm_features(tcx.sess, true)
|
||||
}
|
||||
|
||||
fn print(&self, req: PrintRequest, sess: &Session) {
|
||||
match req {
|
||||
PrintRequest::RelocationModels => {
|
||||
fn print(&self, req: &PrintRequest, sess: &Session) {
|
||||
match req.kind {
|
||||
PrintKind::RelocationModels => {
|
||||
println!("Available relocation models:");
|
||||
for name in &[
|
||||
"static",
|
||||
|
@ -280,21 +280,21 @@ impl CodegenBackend for LlvmCodegenBackend {
|
|||
}
|
||||
println!();
|
||||
}
|
||||
PrintRequest::CodeModels => {
|
||||
PrintKind::CodeModels => {
|
||||
println!("Available code models:");
|
||||
for name in &["tiny", "small", "kernel", "medium", "large"] {
|
||||
println!(" {}", name);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
PrintRequest::TlsModels => {
|
||||
PrintKind::TlsModels => {
|
||||
println!("Available TLS models:");
|
||||
for name in &["global-dynamic", "local-dynamic", "initial-exec", "local-exec"] {
|
||||
println!(" {}", name);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
PrintRequest::StackProtectorStrategies => {
|
||||
PrintKind::StackProtectorStrategies => {
|
||||
println!(
|
||||
r#"Available stack protector strategies:
|
||||
all
|
||||
|
@ -319,7 +319,7 @@ impl CodegenBackend for LlvmCodegenBackend {
|
|||
"#
|
||||
);
|
||||
}
|
||||
req => llvm_util::print(req, sess),
|
||||
_other => llvm_util::print(req, sess),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
|||
use rustc_data_structures::small_c_str::SmallCStr;
|
||||
use rustc_fs_util::path_to_c_string;
|
||||
use rustc_middle::bug;
|
||||
use rustc_session::config::PrintRequest;
|
||||
use rustc_session::config::{PrintKind, PrintRequest};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_target::spec::{MergeFunctions, PanicStrategy};
|
||||
|
@ -400,11 +400,11 @@ fn print_target_features(sess: &Session, tm: &llvm::TargetMachine) {
|
|||
println!("and may be renamed or removed in a future version of LLVM or rustc.\n");
|
||||
}
|
||||
|
||||
pub(crate) fn print(req: PrintRequest, sess: &Session) {
|
||||
pub(crate) fn print(req: &PrintRequest, sess: &Session) {
|
||||
require_inited();
|
||||
let tm = create_informational_target_machine(sess);
|
||||
match req {
|
||||
PrintRequest::TargetCPUs => {
|
||||
match req.kind {
|
||||
PrintKind::TargetCPUs => {
|
||||
// SAFETY generate a C compatible string from a byte slice to pass
|
||||
// the target CPU name into LLVM, the lifetime of the reference is
|
||||
// at least as long as the C function
|
||||
|
@ -412,7 +412,7 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) {
|
|||
.unwrap_or_else(|e| bug!("failed to convert to cstring: {}", e));
|
||||
unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) };
|
||||
}
|
||||
PrintRequest::TargetFeatures => print_target_features(sess, tm),
|
||||
PrintKind::TargetFeatures => print_target_features(sess, tm),
|
||||
_ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue