codegen_llvm_back: whitespace & formatting fixes
This commit is contained in:
parent
06118eac4c
commit
1d1dc48407
7 changed files with 53 additions and 62 deletions
|
@ -83,6 +83,7 @@ impl<'a> ArchiveBuilder<'a> {
|
||||||
if self.src_archive().is_none() {
|
if self.src_archive().is_none() {
|
||||||
return Vec::new()
|
return Vec::new()
|
||||||
}
|
}
|
||||||
|
|
||||||
let archive = self.src_archive.as_ref().unwrap().as_ref().unwrap();
|
let archive = self.src_archive.as_ref().unwrap().as_ref().unwrap();
|
||||||
let ret = archive.iter()
|
let ret = archive.iter()
|
||||||
.filter_map(|child| child.ok())
|
.filter_map(|child| child.ok())
|
||||||
|
|
|
@ -47,8 +47,8 @@ use std::str;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
|
|
||||||
pub use rustc_codegen_utils::link::{find_crate_name, filename_for_input, default_output_for_target,
|
pub use rustc_codegen_utils::link::{find_crate_name, filename_for_input, default_output_for_target,
|
||||||
invalid_output_for_target, out_filename, check_file_is_writeable,
|
invalid_output_for_target, filename_for_metadata,
|
||||||
filename_for_metadata};
|
out_filename, check_file_is_writeable};
|
||||||
|
|
||||||
// The third parameter is for env vars, used on windows to set up the
|
// The third parameter is for env vars, used on windows to set up the
|
||||||
// path for MSVC to find its DLLs, and gcc to find its bundled
|
// path for MSVC to find its DLLs, and gcc to find its bundled
|
||||||
|
@ -147,9 +147,7 @@ pub(crate) fn link_binary(sess: &Session,
|
||||||
|
|
||||||
// Remove the temporary object file and metadata if we aren't saving temps
|
// Remove the temporary object file and metadata if we aren't saving temps
|
||||||
if !sess.opts.cg.save_temps {
|
if !sess.opts.cg.save_temps {
|
||||||
if sess.opts.output_types.should_codegen() &&
|
if sess.opts.output_types.should_codegen() && !preserve_objects_for_their_debuginfo(sess) {
|
||||||
!preserve_objects_for_their_debuginfo(sess)
|
|
||||||
{
|
|
||||||
for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
|
for obj in codegen_results.modules.iter().filter_map(|m| m.object.as_ref()) {
|
||||||
remove(sess, obj);
|
remove(sess, obj);
|
||||||
}
|
}
|
||||||
|
@ -1012,8 +1010,7 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: &
|
||||||
// ensure the line is interpreted as one whole argument.
|
// ensure the line is interpreted as one whole argument.
|
||||||
for c in self.arg.chars() {
|
for c in self.arg.chars() {
|
||||||
match c {
|
match c {
|
||||||
'\\' |
|
'\\' | ' ' => write!(f, "\\{}", c)?,
|
||||||
' ' => write!(f, "\\{}", c)?,
|
|
||||||
c => write!(f, "{}", c)?,
|
c => write!(f, "{}", c)?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,8 +617,7 @@ fn run_pass_manager(cgcx: &CodegenContext,
|
||||||
llvm::LLVMRustAddPass(pm, pass.unwrap());
|
llvm::LLVMRustAddPass(pm, pass.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
time_ext(cgcx.time_passes, None, "LTO passes", ||
|
time_ext(cgcx.time_passes, None, "LTO passes", || llvm::LLVMRunPassManager(pm, llmod));
|
||||||
llvm::LLVMRunPassManager(pm, llmod));
|
|
||||||
|
|
||||||
llvm::LLVMDisposePassManager(pm);
|
llvm::LLVMDisposePassManager(pm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,8 +117,7 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String
|
||||||
let relative = path_relative_from(&lib, &output).unwrap_or_else(||
|
let relative = path_relative_from(&lib, &output).unwrap_or_else(||
|
||||||
panic!("couldn't create relative path from {:?} to {:?}", output, lib));
|
panic!("couldn't create relative path from {:?} to {:?}", output, lib));
|
||||||
// FIXME (#9639): This needs to handle non-utf8 paths
|
// FIXME (#9639): This needs to handle non-utf8 paths
|
||||||
format!("{}/{}", prefix,
|
format!("{}/{}", prefix, relative.to_str().expect("non-utf8 component in path"))
|
||||||
relative.to_str().expect("non-utf8 component in path"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This routine is adapted from the *old* Path's `path_relative_from`
|
// This routine is adapted from the *old* Path's `path_relative_from`
|
||||||
|
|
|
@ -106,8 +106,7 @@ pub fn write_output_file(
|
||||||
file_type: llvm::FileType) -> Result<(), FatalError> {
|
file_type: llvm::FileType) -> Result<(), FatalError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let output_c = path2cstr(output);
|
let output_c = path2cstr(output);
|
||||||
let result = llvm::LLVMRustWriteOutputFile(
|
let result = llvm::LLVMRustWriteOutputFile(target, pm, m, output_c.as_ptr(), file_type);
|
||||||
target, pm, m, output_c.as_ptr(), file_type);
|
|
||||||
if result.into_result().is_err() {
|
if result.into_result().is_err() {
|
||||||
let msg = format!("could not write output to {}", output.display());
|
let msg = format!("could not write output to {}", output.display());
|
||||||
Err(llvm_err(handler, msg))
|
Err(llvm_err(handler, msg))
|
||||||
|
@ -590,8 +589,7 @@ unsafe fn optimize(cgcx: &CodegenContext,
|
||||||
|
|
||||||
for pass in &config.passes {
|
for pass in &config.passes {
|
||||||
if !addpass(pass) {
|
if !addpass(pass) {
|
||||||
diag_handler.warn(&format!("unknown pass `{}`, ignoring",
|
diag_handler.warn(&format!("unknown pass `{}`, ignoring", pass));
|
||||||
pass));
|
|
||||||
}
|
}
|
||||||
if pass == "name-anon-globals" {
|
if pass == "name-anon-globals" {
|
||||||
have_name_anon_globals_pass = true;
|
have_name_anon_globals_pass = true;
|
||||||
|
@ -1116,7 +1114,8 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some((id, product)) =
|
if let Some((id, product)) =
|
||||||
copy_cgu_workproducts_to_incr_comp_cache_dir(sess, &module.name, &files) {
|
copy_cgu_workproducts_to_incr_comp_cache_dir(sess, &module.name, &files)
|
||||||
|
{
|
||||||
work_products.insert(id, product);
|
work_products.insert(id, product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1584,10 +1583,8 @@ fn start_executing_work(tcx: TyCtxt,
|
||||||
|
|
||||||
let (name, mut cmd) = get_linker(sess, &linker, flavor);
|
let (name, mut cmd) = get_linker(sess, &linker, flavor);
|
||||||
cmd.args(&sess.target.target.options.asm_args);
|
cmd.args(&sess.target.target.options.asm_args);
|
||||||
Some(Arc::new(AssemblerCommand {
|
|
||||||
name,
|
Some(Arc::new(AssemblerCommand { name, cmd }))
|
||||||
cmd,
|
|
||||||
}))
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
|
@ -373,8 +373,7 @@ impl<'a> Linker for GccLinker<'a> {
|
||||||
// purely to support rustbuild right now, we should get a more
|
// purely to support rustbuild right now, we should get a more
|
||||||
// principled solution at some point to force the compiler to pass
|
// principled solution at some point to force the compiler to pass
|
||||||
// the right `-Wl,-install_name` with an `@rpath` in it.
|
// the right `-Wl,-install_name` with an `@rpath` in it.
|
||||||
if self.sess.opts.cg.rpath ||
|
if self.sess.opts.cg.rpath || self.sess.opts.debugging_opts.osx_rpath_install_name {
|
||||||
self.sess.opts.debugging_opts.osx_rpath_install_name {
|
|
||||||
self.linker_arg("-install_name");
|
self.linker_arg("-install_name");
|
||||||
let mut v = OsString::from("@rpath/");
|
let mut v = OsString::from("@rpath/");
|
||||||
v.push(out_filename.file_name().unwrap());
|
v.push(out_filename.file_name().unwrap());
|
||||||
|
|
|
@ -47,11 +47,10 @@ fn crate_export_threshold(crate_type: config::CrateType) -> SymbolExportLevel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn crates_export_threshold(crate_types: &[config::CrateType])
|
pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExportLevel {
|
||||||
-> SymbolExportLevel {
|
if crate_types.iter().any(|&crate_type|
|
||||||
if crate_types.iter().any(|&crate_type| {
|
crate_export_threshold(crate_type) == SymbolExportLevel::Rust)
|
||||||
crate_export_threshold(crate_type) == SymbolExportLevel::Rust
|
{
|
||||||
}) {
|
|
||||||
SymbolExportLevel::Rust
|
SymbolExportLevel::Rust
|
||||||
} else {
|
} else {
|
||||||
SymbolExportLevel::C
|
SymbolExportLevel::C
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue