1
Fork 0

Remove more Session methods that duplicate DiagCtxt methods.

This commit is contained in:
Nicholas Nethercote 2023-12-21 16:26:09 +11:00
parent 8af3d8dcab
commit 8a9db25459
36 changed files with 62 additions and 74 deletions

View file

@ -716,7 +716,7 @@ fn link_dwarf_object<'a>(
Ok(()) => {}
Err(e) => {
sess.dcx().emit_err(errors::ThorinErrorWrapper(e));
sess.abort_if_errors();
sess.dcx().abort_if_errors();
}
}
}
@ -765,7 +765,7 @@ fn link_natively<'a>(
}
// May have not found libraries in the right formats.
sess.abort_if_errors();
sess.dcx().abort_if_errors();
// Invoke the system linker
info!("{:?}", &cmd);
@ -970,7 +970,7 @@ fn link_natively<'a>(
}
}
sess.abort_if_errors();
sess.dcx().abort_if_errors();
}
info!("linker stderr:\n{}", escape_string(&prog.stderr));
info!("linker stdout:\n{}", escape_string(&prog.stdout));
@ -993,7 +993,7 @@ fn link_natively<'a>(
sess.dcx().emit_note(errors::CheckInstalledVisualStudio);
sess.dcx().emit_note(errors::InsufficientVSCodeProduct);
}
sess.abort_if_errors();
sess.dcx().abort_if_errors();
}
}

View file

@ -1883,7 +1883,7 @@ impl SharedEmitterMain {
err.emit();
}
Ok(SharedEmitterMessage::AbortIfErrors) => {
sess.abort_if_errors();
sess.dcx().abort_if_errors();
}
Ok(SharedEmitterMessage::Fatal(msg)) => {
sess.dcx().fatal(msg);
@ -1939,7 +1939,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
let compiled_modules = sess.time("join_worker_thread", || match self.coordinator.join() {
Ok(Ok(compiled_modules)) => compiled_modules,
Ok(Err(())) => {
sess.abort_if_errors();
sess.dcx().abort_if_errors();
panic!("expected abort due to worker thread errors")
}
Err(_) => {
@ -1947,7 +1947,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
}
});
sess.abort_if_errors();
sess.dcx().abort_if_errors();
let work_products =
copy_all_cgu_workproducts_to_incr_comp_cache_dir(sess, &compiled_modules);

View file

@ -448,8 +448,9 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
let Some(llfn) = cx.declare_c_main(llfty) else {
// FIXME: We should be smart and show a better diagnostic here.
let span = cx.tcx().def_span(rust_main_def_id);
cx.sess().dcx().emit_err(errors::MultipleMainFunctions { span });
cx.sess().abort_if_errors();
let dcx = cx.tcx().dcx();
dcx.emit_err(errors::MultipleMainFunctions { span });
dcx.abort_if_errors();
bug!();
};
@ -752,7 +753,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
// This will unwind if there are errors, which triggers our `AbortCodegenOnDrop`
// guard. Unfortunately, just skipping the `submit_codegened_module_to_llvm` makes
// compilation hang on post-monomorphization errors.
tcx.sess.abort_if_errors();
tcx.dcx().abort_if_errors();
submit_codegened_module_to_llvm(
&backend,