Remove check_overflow method from MiscMethods
It can be retrieved from the Session too.
This commit is contained in:
parent
22b32432ca
commit
aacdce38f7
@ -27,7 +27,6 @@
|
|||||||
use crate::common::SignType;
|
use crate::common::SignType;
|
||||||
|
|
||||||
pub struct CodegenCx<'gcc, 'tcx> {
|
pub struct CodegenCx<'gcc, 'tcx> {
|
||||||
pub check_overflow: bool,
|
|
||||||
pub codegen_unit: &'tcx CodegenUnit<'tcx>,
|
pub codegen_unit: &'tcx CodegenUnit<'tcx>,
|
||||||
pub context: &'gcc Context<'gcc>,
|
pub context: &'gcc Context<'gcc>,
|
||||||
|
|
||||||
@ -134,8 +133,6 @@ pub fn new(
|
|||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
supports_128bit_integers: bool,
|
supports_128bit_integers: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let check_overflow = tcx.sess.overflow_checks();
|
|
||||||
|
|
||||||
let create_type = |ctype, rust_type| {
|
let create_type = |ctype, rust_type| {
|
||||||
let layout = tcx.layout_of(ParamEnv::reveal_all().and(rust_type)).unwrap();
|
let layout = tcx.layout_of(ParamEnv::reveal_all().and(rust_type)).unwrap();
|
||||||
let align = layout.align.abi.bytes();
|
let align = layout.align.abi.bytes();
|
||||||
@ -271,7 +268,6 @@ pub fn new(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut cx = Self {
|
let mut cx = Self {
|
||||||
check_overflow,
|
|
||||||
codegen_unit,
|
codegen_unit,
|
||||||
context,
|
context,
|
||||||
current_func: RefCell::new(None),
|
current_func: RefCell::new(None),
|
||||||
@ -511,10 +507,6 @@ fn sess(&self) -> &Session {
|
|||||||
&self.tcx.sess
|
&self.tcx.sess
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_overflow(&self) -> bool {
|
|
||||||
self.check_overflow
|
|
||||||
}
|
|
||||||
|
|
||||||
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> {
|
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> {
|
||||||
self.codegen_unit
|
self.codegen_unit
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
|
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
|
||||||
pub struct CodegenCx<'ll, 'tcx> {
|
pub struct CodegenCx<'ll, 'tcx> {
|
||||||
pub tcx: TyCtxt<'tcx>,
|
pub tcx: TyCtxt<'tcx>,
|
||||||
pub check_overflow: bool,
|
|
||||||
pub use_dll_storage_attrs: bool,
|
pub use_dll_storage_attrs: bool,
|
||||||
pub tls_model: llvm::ThreadLocalMode,
|
pub tls_model: llvm::ThreadLocalMode,
|
||||||
|
|
||||||
@ -442,8 +441,6 @@ pub(crate) fn new(
|
|||||||
// start) and then strongly recommending static linkage on Windows!
|
// start) and then strongly recommending static linkage on Windows!
|
||||||
let use_dll_storage_attrs = tcx.sess.target.is_like_windows;
|
let use_dll_storage_attrs = tcx.sess.target.is_like_windows;
|
||||||
|
|
||||||
let check_overflow = tcx.sess.overflow_checks();
|
|
||||||
|
|
||||||
let tls_model = to_llvm_tls_model(tcx.sess.tls_model());
|
let tls_model = to_llvm_tls_model(tcx.sess.tls_model());
|
||||||
|
|
||||||
let (llcx, llmod) = (&*llvm_module.llcx, llvm_module.llmod());
|
let (llcx, llmod) = (&*llvm_module.llcx, llvm_module.llmod());
|
||||||
@ -467,7 +464,6 @@ pub(crate) fn new(
|
|||||||
|
|
||||||
CodegenCx {
|
CodegenCx {
|
||||||
tcx,
|
tcx,
|
||||||
check_overflow,
|
|
||||||
use_dll_storage_attrs,
|
use_dll_storage_attrs,
|
||||||
tls_model,
|
tls_model,
|
||||||
llmod,
|
llmod,
|
||||||
@ -606,10 +602,6 @@ fn sess(&self) -> &Session {
|
|||||||
self.tcx.sess
|
self.tcx.sess
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_overflow(&self) -> bool {
|
|
||||||
self.check_overflow
|
|
||||||
}
|
|
||||||
|
|
||||||
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> {
|
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> {
|
||||||
self.codegen_unit
|
self.codegen_unit
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ fn codegen_assert_terminator(
|
|||||||
// with #[rustc_inherit_overflow_checks] and inlined from
|
// with #[rustc_inherit_overflow_checks] and inlined from
|
||||||
// another crate (mostly core::num generic/#[inline] fns),
|
// another crate (mostly core::num generic/#[inline] fns),
|
||||||
// while the current crate doesn't use overflow checks.
|
// while the current crate doesn't use overflow checks.
|
||||||
if !bx.cx().check_overflow() && msg.is_optional_overflow_check() {
|
if !bx.sess().overflow_checks() && msg.is_optional_overflow_check() {
|
||||||
const_cond = Some(expected);
|
const_cond = Some(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ fn apply_vcall_visibility_metadata(
|
|||||||
_vtable: Self::Value,
|
_vtable: Self::Value,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
fn check_overflow(&self) -> bool;
|
|
||||||
fn get_fn(&self, instance: Instance<'tcx>) -> Self::Function;
|
fn get_fn(&self, instance: Instance<'tcx>) -> Self::Function;
|
||||||
fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value;
|
fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value;
|
||||||
fn eh_personality(&self) -> Self::Value;
|
fn eh_personality(&self) -> Self::Value;
|
||||||
|
Loading…
Reference in New Issue
Block a user