Collapse all uses of target.options.foo into target.foo

with an eye on merging `TargetOptions` into `Target`.

`TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
This commit is contained in:
Vadim Petrochenkov 2020-11-08 14:27:51 +03:00
parent 87a0997ef9
commit bf66988aa1
48 changed files with 235 additions and 260 deletions

View file

@ -46,7 +46,7 @@ fn require_inited() {
}
unsafe fn configure_llvm(sess: &Session) {
let n_args = sess.opts.cg.llvm_args.len() + sess.target.options.llvm_args.len();
let n_args = sess.opts.cg.llvm_args.len() + sess.target.llvm_args.len();
let mut llvm_c_strs = Vec::with_capacity(n_args + 1);
let mut llvm_args = Vec::with_capacity(n_args + 1);
@ -57,7 +57,7 @@ unsafe fn configure_llvm(sess: &Session) {
}
let cg_opts = sess.opts.cg.llvm_args.iter();
let tg_opts = sess.target.options.llvm_args.iter();
let tg_opts = sess.target.llvm_args.iter();
let sess_args = cg_opts.chain(tg_opts);
let user_specified_args: FxHashSet<_> =
@ -84,12 +84,7 @@ unsafe fn configure_llvm(sess: &Session) {
if !sess.opts.debugging_opts.no_generate_arange_section {
add("-generate-arange-section", false);
}
match sess
.opts
.debugging_opts
.merge_functions
.unwrap_or(sess.target.options.merge_functions)
{
match sess.opts.debugging_opts.merge_functions.unwrap_or(sess.target.merge_functions) {
MergeFunctions::Disabled | MergeFunctions::Trampolines => {}
MergeFunctions::Aliases => {
add("-mergefunc-use-aliases", false);
@ -215,7 +210,7 @@ fn handle_native(name: &str) -> &str {
pub fn target_cpu(sess: &Session) -> &str {
let name = match sess.opts.cg.target_cpu {
Some(ref s) => &**s,
None => &*sess.target.options.cpu,
None => &*sess.target.cpu,
};
handle_native(name)