1
Fork 0

Rename debugging_opts to unstable_opts

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
This commit is contained in:
Joshua Nelson 2022-07-06 07:44:47 -05:00
parent c80dde43f9
commit 3c9765cff1
125 changed files with 396 additions and 394 deletions

View file

@ -67,7 +67,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
let output_metadata = sess.opts.output_types.contains_key(&OutputType::Metadata);
for &crate_type in sess.crate_types().iter() {
// Ignore executable crates if we have -Z no-codegen, as they will error.
if (sess.opts.debugging_opts.no_codegen || !sess.opts.output_types.should_codegen())
if (sess.opts.unstable_opts.no_codegen || !sess.opts.output_types.should_codegen())
&& !output_metadata
&& crate_type == CrateType::Executable
{
@ -595,7 +595,7 @@ fn link_dwarf_object<'a>(
let mut package = thorin::DwarfPackage::new(&thorin_sess);
// Input objs contain .o/.dwo files from the current crate.
match sess.opts.debugging_opts.split_dwarf_kind {
match sess.opts.unstable_opts.split_dwarf_kind {
SplitDwarfKind::Single => {
for input_obj in cg_results.modules.iter().filter_map(|m| m.object.as_ref()) {
package.add_input_object(input_obj)?;
@ -1022,7 +1022,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
// Temporarily support both -Z strip and -C strip
fn strip_value(sess: &Session) -> Strip {
match (sess.opts.debugging_opts.strip, sess.opts.cg.strip) {
match (sess.opts.unstable_opts.strip, sess.opts.cg.strip) {
(s, Strip::None) => s,
(_, s) => s,
}
@ -1074,7 +1074,7 @@ fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut d
return;
}
let sanitizer = sess.opts.debugging_opts.sanitizer;
let sanitizer = sess.opts.unstable_opts.sanitizer;
if sanitizer.contains(SanitizerSet::ADDRESS) {
link_sanitizer_runtime(sess, linker, "asan");
}
@ -1253,7 +1253,7 @@ fn preserve_objects_for_their_debuginfo(sess: &Session) -> (bool, bool) {
return (false, false);
}
match (sess.split_debuginfo(), sess.opts.debugging_opts.split_dwarf_kind) {
match (sess.split_debuginfo(), sess.opts.unstable_opts.split_dwarf_kind) {
// If there is no split debuginfo then do not preserve objects.
(SplitDebuginfo::Off, _) => (false, false),
// If there is packed split debuginfo, then the debuginfo in the objects
@ -1601,7 +1601,7 @@ fn add_pre_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor)
if let Some(args) = sess.target.pre_link_args.get(&flavor) {
cmd.args(args.iter().map(Deref::deref));
}
cmd.args(&sess.opts.debugging_opts.pre_link_args);
cmd.args(&sess.opts.unstable_opts.pre_link_args);
}
/// Add a link script embedded in the target, if applicable.
@ -1809,7 +1809,7 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
/// Add options making relocation sections in the produced ELF files read-only
/// and suppressing lazy binding.
fn add_relro_args(cmd: &mut dyn Linker, sess: &Session) {
match sess.opts.debugging_opts.relro_level.unwrap_or(sess.target.relro_level) {
match sess.opts.unstable_opts.relro_level.unwrap_or(sess.target.relro_level) {
RelroLevel::Full => cmd.full_relro(),
RelroLevel::Partial => cmd.partial_relro(),
RelroLevel::Off => cmd.no_relro(),
@ -1957,7 +1957,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
// (or alternatively link all native libraries after their respective crates).
// This change is somewhat breaking in practice due to local static libraries being linked
// as whole-archive (#85144), so removing whole-archive may be a pre-requisite.
if sess.opts.debugging_opts.link_native_libraries {
if sess.opts.unstable_opts.link_native_libraries {
add_local_native_libraries(cmd, sess, codegen_results);
}
@ -1969,7 +1969,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
// If -Zlink-native-libraries=false is set, then the assumption is that an
// external build system already has the native dependencies defined, and it
// will provide them to the linker itself.
if sess.opts.debugging_opts.link_native_libraries {
if sess.opts.unstable_opts.link_native_libraries {
add_upstream_native_libraries(cmd, sess, codegen_results);
}
@ -2037,7 +2037,7 @@ fn add_order_independent_options(
add_link_script(cmd, sess, tmpdir, crate_type);
if sess.target.os == "fuchsia" && crate_type == CrateType::Executable {
let prefix = if sess.opts.debugging_opts.sanitizer.contains(SanitizerSet::ADDRESS) {
let prefix = if sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::ADDRESS) {
"asan/"
} else {
""
@ -2362,7 +2362,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
// If -Zlink-native-libraries=false is set, then the assumption is that an
// external build system already has the native dependencies defined, and it
// will provide them to the linker itself.
if sess.opts.debugging_opts.link_native_libraries {
if sess.opts.unstable_opts.link_native_libraries {
let mut last = (None, NativeLibKind::Unspecified, None);
for lib in &codegen_results.crate_info.native_libraries[&cnum] {
let Some(name) = lib.name else {
@ -2709,7 +2709,7 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, String> {
}
fn add_gcc_ld_path(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
if let Some(ld_impl) = sess.opts.debugging_opts.gcc_ld {
if let Some(ld_impl) = sess.opts.unstable_opts.gcc_ld {
if let LinkerFlavor::Gcc = flavor {
match ld_impl {
LdImpl::Lld => {

View file

@ -303,7 +303,7 @@ impl<'a> GccLinker<'a> {
config::OptLevel::Aggressive => "O3",
};
if let Some(path) = &self.sess.opts.debugging_opts.profile_sample_use {
if let Some(path) = &self.sess.opts.unstable_opts.profile_sample_use {
self.linker_arg(&format!("-plugin-opt=sample-profile={}", path.display()));
};
self.linker_args(&[
@ -325,7 +325,7 @@ impl<'a> GccLinker<'a> {
// purely to support rustbuild right now, we should get a more
// principled solution at some point to force the compiler to pass
// the right `-Wl,-install_name` with an `@rpath` in it.
if self.sess.opts.cg.rpath || self.sess.opts.debugging_opts.osx_rpath_install_name {
if self.sess.opts.cg.rpath || self.sess.opts.unstable_opts.osx_rpath_install_name {
let mut rpath = OsString::from("@rpath/");
rpath.push(out_filename.file_name().unwrap());
self.linker_args(&[OsString::from("-install_name"), rpath]);

View file

@ -232,15 +232,15 @@ fn exported_symbols_provider_local<'tcx>(
}));
}
if tcx.sess.opts.debugging_opts.sanitizer.contains(SanitizerSet::MEMORY) {
if tcx.sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::MEMORY) {
let mut msan_weak_symbols = Vec::new();
// Similar to profiling, preserve weak msan symbol during LTO.
if tcx.sess.opts.debugging_opts.sanitizer_recover.contains(SanitizerSet::MEMORY) {
if tcx.sess.opts.unstable_opts.sanitizer_recover.contains(SanitizerSet::MEMORY) {
msan_weak_symbols.push("__msan_keep_going");
}
if tcx.sess.opts.debugging_opts.sanitizer_memory_track_origins != 0 {
if tcx.sess.opts.unstable_opts.sanitizer_memory_track_origins != 0 {
msan_weak_symbols.push("__msan_track_origins");
}

View file

@ -179,24 +179,24 @@ impl ModuleConfig {
SwitchWithOptPath::Disabled
),
pgo_use: if_regular!(sess.opts.cg.profile_use.clone(), None),
pgo_sample_use: if_regular!(sess.opts.debugging_opts.profile_sample_use.clone(), None),
debug_info_for_profiling: sess.opts.debugging_opts.debug_info_for_profiling,
pgo_sample_use: if_regular!(sess.opts.unstable_opts.profile_sample_use.clone(), None),
debug_info_for_profiling: sess.opts.unstable_opts.debug_info_for_profiling,
instrument_coverage: if_regular!(sess.instrument_coverage(), false),
instrument_gcov: if_regular!(
// compiler_builtins overrides the codegen-units settings,
// which is incompatible with -Zprofile which requires that
// only a single codegen unit is used per crate.
sess.opts.debugging_opts.profile && !is_compiler_builtins,
sess.opts.unstable_opts.profile && !is_compiler_builtins,
false
),
sanitizer: if_regular!(sess.opts.debugging_opts.sanitizer, SanitizerSet::empty()),
sanitizer: if_regular!(sess.opts.unstable_opts.sanitizer, SanitizerSet::empty()),
sanitizer_recover: if_regular!(
sess.opts.debugging_opts.sanitizer_recover,
sess.opts.unstable_opts.sanitizer_recover,
SanitizerSet::empty()
),
sanitizer_memory_track_origins: if_regular!(
sess.opts.debugging_opts.sanitizer_memory_track_origins,
sess.opts.unstable_opts.sanitizer_memory_track_origins,
0
),
@ -247,7 +247,7 @@ impl ModuleConfig {
// O2 and O3) since it can be useful for reducing code size.
merge_functions: match sess
.opts
.debugging_opts
.unstable_opts
.merge_functions
.unwrap_or(sess.target.merge_functions)
{
@ -259,9 +259,9 @@ impl ModuleConfig {
},
inline_threshold: sess.opts.cg.inline_threshold,
new_llvm_pass_manager: sess.opts.debugging_opts.new_llvm_pass_manager,
new_llvm_pass_manager: sess.opts.unstable_opts.new_llvm_pass_manager,
emit_lifetime_markers: sess.emit_lifetime_markers(),
llvm_plugins: if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![]),
llvm_plugins: if_regular!(sess.opts.unstable_opts.llvm_plugins.clone(), vec![]),
}
}
@ -926,7 +926,7 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
) -> Result<WorkItemResult<B>, FatalError> {
let diag_handler = cgcx.create_diag_handler();
if !cgcx.opts.debugging_opts.combine_cgu
if !cgcx.opts.unstable_opts.combine_cgu
|| module.kind == ModuleKind::Metadata
|| module.kind == ModuleKind::Allocator
{
@ -1048,14 +1048,13 @@ fn start_executing_work<B: ExtraBackendMethods>(
each_linked_rlib_for_lto.push((cnum, path.to_path_buf()));
}));
let ol = if tcx.sess.opts.debugging_opts.no_codegen
|| !tcx.sess.opts.output_types.should_codegen()
{
// If we know that we wont be doing codegen, create target machines without optimisation.
config::OptLevel::No
} else {
tcx.backend_optimization_level(())
};
let ol =
if tcx.sess.opts.unstable_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
// If we know that we wont be doing codegen, create target machines without optimisation.
config::OptLevel::No
} else {
tcx.backend_optimization_level(())
};
let backend_features = tcx.global_backend_features(());
let cgcx = CodegenContext::<B> {
backend: backend.clone(),
@ -1064,7 +1063,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
lto: sess.lto(),
fewer_names: sess.fewer_names(),
save_temps: sess.opts.cg.save_temps,
time_trace: sess.opts.debugging_opts.llvm_time_trace,
time_trace: sess.opts.unstable_opts.llvm_time_trace,
opts: Arc::new(sess.opts.clone()),
prof: sess.prof.clone(),
exported_symbols,
@ -1087,7 +1086,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
target_arch: tcx.sess.target.arch.to_string(),
debuginfo: tcx.sess.opts.debuginfo,
split_debuginfo: tcx.sess.split_debuginfo(),
split_dwarf_kind: tcx.sess.opts.debugging_opts.split_dwarf_kind,
split_dwarf_kind: tcx.sess.opts.unstable_opts.split_dwarf_kind,
};
// This is the "main loop" of parallel work happening for parallel codegen.
@ -1346,7 +1345,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
.binary_search_by_key(&cost, |&(_, cost)| cost)
.unwrap_or_else(|e| e);
work_items.insert(insertion_index, (work, cost));
if !cgcx.opts.debugging_opts.no_parallel_llvm {
if !cgcx.opts.unstable_opts.no_parallel_llvm {
helper.request_token();
}
}
@ -1466,7 +1465,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
};
work_items.insert(insertion_index, (llvm_work_item, cost));
if !cgcx.opts.debugging_opts.no_parallel_llvm {
if !cgcx.opts.unstable_opts.no_parallel_llvm {
helper.request_token();
}
assert!(!codegen_aborted);

View file

@ -521,7 +521,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
need_metadata_module: bool,
) -> OngoingCodegen<B> {
// Skip crate items and just output metadata in -Z no-codegen mode.
if tcx.sess.opts.debugging_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
if tcx.sess.opts.unstable_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
let ongoing_codegen = start_async_codegen(backend, tcx, target_cpu, metadata, None, 1);
ongoing_codegen.codegen_finished(tcx);

View file

@ -25,7 +25,7 @@ impl<'a, 'tcx> VirtualIndex {
let llty = bx.fn_ptr_backend_type(fn_abi);
let llvtable = bx.pointercast(llvtable, bx.type_ptr_to(llty));
if bx.cx().sess().opts.debugging_opts.virtual_function_elimination
if bx.cx().sess().opts.unstable_opts.virtual_function_elimination
&& bx.cx().sess().lto() == Lto::Fat
{
let typeid =

View file

@ -687,7 +687,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
source_info,
target,
cleanup,
self.cx.tcx().sess.opts.debugging_opts.strict_init_checks,
self.cx.tcx().sess.opts.unstable_opts.strict_init_checks,
) {
return;
}

View file

@ -101,7 +101,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
return span;
}
if span.from_expansion() && !self.cx.sess().opts.debugging_opts.debug_macros {
if span.from_expansion() && !self.cx.sess().opts.unstable_opts.debug_macros {
// Walk up the macro expansion chain until we reach a non-expanded span.
// We also stop at the function body level because no line stepping can occur
// at the level above that.

View file

@ -221,7 +221,7 @@ pub trait BuilderMethods<'a, 'tcx>:
assert!(matches!(self.cx().type_kind(float_ty), TypeKind::Float | TypeKind::Double));
assert_eq!(self.cx().type_kind(int_ty), TypeKind::Integer);
if let Some(false) = self.cx().sess().opts.debugging_opts.saturating_float_casts {
if let Some(false) = self.cx().sess().opts.unstable_opts.saturating_float_casts {
return if signed { self.fptosi(x, dest_ty) } else { self.fptoui(x, dest_ty) };
}