rename is_valid_for
to is_valid
This commit is contained in:
parent
dd34e0c966
commit
9095cf9905
4 changed files with 5 additions and 5 deletions
|
@ -541,7 +541,7 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
|
||||||
// become 0..0 when the type becomes i1, which would be rejected
|
// become 0..0 when the type becomes i1, which would be rejected
|
||||||
// by the LLVM verifier.
|
// by the LLVM verifier.
|
||||||
if let Int(..) = scalar.value {
|
if let Int(..) = scalar.value {
|
||||||
if !scalar.is_bool() && !scalar.is_always_valid_for(bx) {
|
if !scalar.is_bool() && !scalar.is_always_valid(bx) {
|
||||||
bx.range_metadata(callsite, scalar.valid_range);
|
bx.range_metadata(callsite, scalar.valid_range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,7 +464,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
||||||
) {
|
) {
|
||||||
match scalar.value {
|
match scalar.value {
|
||||||
abi::Int(..) => {
|
abi::Int(..) => {
|
||||||
if !scalar.is_always_valid_for(bx) {
|
if !scalar.is_always_valid(bx) {
|
||||||
bx.range_metadata(load, scalar.valid_range);
|
bx.range_metadata(load, scalar.valid_range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
// then `i1 1` (i.e., E::B) is effectively `i8 -1`.
|
// then `i1 1` (i.e., E::B) is effectively `i8 -1`.
|
||||||
signed = !scalar.is_bool() && s;
|
signed = !scalar.is_bool() && s;
|
||||||
|
|
||||||
if !scalar.is_always_valid_for(bx.cx())
|
if !scalar.is_always_valid(bx.cx())
|
||||||
&& scalar.valid_range.end >= scalar.valid_range.start
|
&& scalar.valid_range.end >= scalar.valid_range.start
|
||||||
{
|
{
|
||||||
// We want `table[e as usize ± k]` to not
|
// We want `table[e as usize ± k]` to not
|
||||||
|
|
|
@ -830,7 +830,7 @@ impl Scalar {
|
||||||
|
|
||||||
/// Returns `true` if all possible numbers are valid, i.e `valid_range` covers the whole layout
|
/// Returns `true` if all possible numbers are valid, i.e `valid_range` covers the whole layout
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_always_valid_for<C: HasDataLayout>(&self, cx: &C) -> bool {
|
pub fn is_always_valid<C: HasDataLayout>(&self, cx: &C) -> bool {
|
||||||
self.valid_range.is_full_for(self.value.size(cx))
|
self.valid_range.is_full_for(self.value.size(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1280,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
|
||||||
s.valid_range.contains(0)
|
s.valid_range.contains(0)
|
||||||
} else {
|
} else {
|
||||||
// The range must include all values.
|
// The range must include all values.
|
||||||
s.is_always_valid_for(cx)
|
s.is_always_valid(cx)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue