Auto merge of #86911 - bjorn3:crate_info_refactor, r=petrochenkov

Refactor linker code

This merges `LinkerInfo` into `CrateInfo` as there is no reason to keep them separate. `LinkerInfo::to_linker` is merged into `get_linker` as both have different logic for each linker type and `to_linker` is directly called after `get_linker`. Also contains a couple of small cleanups.

See the individual commits for all changes.
This commit is contained in:
bors 2021-07-06 22:20:43 +00:00
commit b20e3ff2af
10 changed files with 169 additions and 204 deletions

View file

@ -12,7 +12,6 @@ extern crate rustc_span;
extern crate rustc_symbol_mangling;
extern crate rustc_target;
use rustc_codegen_ssa::back::linker::LinkerInfo;
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::{CodegenResults, CrateInfo};
use rustc_data_structures::fx::FxHashMap;
@ -38,8 +37,7 @@ impl CodegenBackend for TheBackend {
allocator_module: None,
metadata_module: None,
metadata,
linker_info: LinkerInfo::new(tcx, "fake_target_cpu".to_string()),
crate_info: CrateInfo::new(tcx),
crate_info: CrateInfo::new(tcx, "fake_target_cpu".to_string()),
})
}