mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
fix(from_low_high): Renamed according to clippy requirements
Changed for clippy naming convention requirement: ``` warning: methods called `from_*` usually take no `self` --> src/int.rs:996:22 | 996 | fn from_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> { | ^^^^^ | = help: consider choosing a less ambiguous name = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention = note: `#[warn(clippy::wrong_self_convention)]` on by default ```
This commit is contained in:
parent
3fd9db31bf
commit
a7d39b852a
35
src/int.rs
35
src/int.rs
@ -38,7 +38,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
self.cx.context.new_unary_op(self.location, operation, typ, a)
|
||||
} else {
|
||||
let element_type = typ.dyncast_array().expect("element type");
|
||||
self.from_low_high_rvalues(
|
||||
self.concat_low_high_rvalues(
|
||||
typ,
|
||||
self.cx.context.new_unary_op(
|
||||
self.location,
|
||||
@ -112,7 +112,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
let shift_value = self.gcc_sub(b, sixty_four);
|
||||
let high = self.high(a);
|
||||
let sign = if a_type.is_signed(self) { high >> sixty_three } else { zero };
|
||||
let array_value = self.from_low_high_rvalues(a_type, high >> shift_value, sign);
|
||||
let array_value = self.concat_low_high_rvalues(a_type, high >> shift_value, sign);
|
||||
then_block.add_assignment(self.location, result, array_value);
|
||||
then_block.end_with_jump(self.location, after_block);
|
||||
|
||||
@ -128,8 +128,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
let casted_low = self.context.new_cast(self.location, self.low(a), unsigned_type);
|
||||
let shifted_low = casted_low >> self.context.new_cast(self.location, b, unsigned_type);
|
||||
let shifted_low = self.context.new_cast(self.location, shifted_low, native_int_type);
|
||||
let array_value =
|
||||
self.from_low_high_rvalues(a_type, (high << shift_value) | shifted_low, high >> b);
|
||||
let array_value = self.concat_low_high_rvalues(
|
||||
a_type,
|
||||
(high << shift_value) | shifted_low,
|
||||
high >> b,
|
||||
);
|
||||
actual_else_block.add_assignment(self.location, result, array_value);
|
||||
actual_else_block.end_with_jump(self.location, after_block);
|
||||
|
||||
@ -610,7 +613,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
{
|
||||
a ^ b
|
||||
} else {
|
||||
self.from_low_high_rvalues(
|
||||
self.concat_low_high_rvalues(
|
||||
a_type,
|
||||
self.low(a) ^ self.low(b),
|
||||
self.high(a) ^ self.high(b),
|
||||
@ -659,7 +662,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
self.llbb().end_with_conditional(self.location, condition, then_block, else_block);
|
||||
|
||||
let array_value =
|
||||
self.from_low_high_rvalues(a_type, zero, self.low(a) << (b - sixty_four));
|
||||
self.concat_low_high_rvalues(a_type, zero, self.low(a) << (b - sixty_four));
|
||||
then_block.add_assignment(self.location, result, array_value);
|
||||
then_block.end_with_jump(self.location, after_block);
|
||||
|
||||
@ -677,7 +680,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
let high_low =
|
||||
self.context.new_cast(self.location, casted_low >> shift_value, native_int_type);
|
||||
|
||||
let array_value = self.from_low_high_rvalues(
|
||||
let array_value = self.concat_low_high_rvalues(
|
||||
a_type,
|
||||
self.low(a) << b,
|
||||
(self.high(a) << b) | high_low,
|
||||
@ -706,7 +709,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
||||
|
||||
// NOTE: we also need to swap the two elements here, in addition to swapping inside
|
||||
// the elements themselves like done above.
|
||||
return self.from_low_high_rvalues(arg_type, swapped_msb, swapped_lsb);
|
||||
return self.concat_low_high_rvalues(arg_type, swapped_msb, swapped_lsb);
|
||||
}
|
||||
|
||||
// TODO(antoyo): check if it's faster to use string literals and a
|
||||
@ -728,7 +731,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
self.context.new_rvalue_from_long(typ, int)
|
||||
} else {
|
||||
// NOTE: set the sign in high.
|
||||
self.from_low_high(typ, int, -(int.is_negative() as i64))
|
||||
self.concat_low_high(typ, int, -(int.is_negative() as i64))
|
||||
}
|
||||
}
|
||||
|
||||
@ -740,7 +743,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
} else if self.is_native_int_type_or_bool(typ) {
|
||||
self.context.new_rvalue_from_long(typ, int as i64)
|
||||
} else {
|
||||
self.from_low_high(typ, int as i64, 0)
|
||||
self.concat_low_high(typ, int as i64, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -757,7 +760,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
let shift = high << sixty_four;
|
||||
shift | self.context.new_cast(None, low, typ)
|
||||
} else {
|
||||
self.from_low_high(typ, low as i64, high as i64)
|
||||
self.concat_low_high(typ, low as i64, high as i64)
|
||||
}
|
||||
} else if typ.is_i128(self) {
|
||||
// FIXME(antoyo): libgccjit cannot create 128-bit values yet.
|
||||
@ -772,7 +775,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
if self.is_native_int_type_or_bool(typ) {
|
||||
self.context.new_rvalue_zero(typ)
|
||||
} else {
|
||||
self.from_low_high(typ, 0, 0)
|
||||
self.concat_low_high(typ, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -810,7 +813,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
"both types should either be native or non-native for or operation"
|
||||
);
|
||||
let native_int_type = a_type.dyncast_array().expect("get element type");
|
||||
self.from_low_high_rvalues(
|
||||
self.concat_low_high_rvalues(
|
||||
a_type,
|
||||
self.context.new_binary_op(
|
||||
loc,
|
||||
@ -855,7 +858,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
let is_negative =
|
||||
self.context.new_comparison(None, ComparisonOp::LessThan, value, zero);
|
||||
let is_negative = self.gcc_int_cast(is_negative, dest_element_type);
|
||||
self.from_low_high_rvalues(
|
||||
self.concat_low_high_rvalues(
|
||||
dest_typ,
|
||||
self.context.new_cast(None, value, dest_element_type),
|
||||
self.context.new_unary_op(None, UnaryOp::Minus, dest_element_type, is_negative),
|
||||
@ -975,7 +978,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
.to_rvalue()
|
||||
}
|
||||
|
||||
fn from_low_high_rvalues(
|
||||
fn concat_low_high_rvalues(
|
||||
&self,
|
||||
typ: Type<'gcc>,
|
||||
low: RValue<'gcc>,
|
||||
@ -990,7 +993,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
|
||||
self.context.new_array_constructor(None, typ, &values)
|
||||
}
|
||||
|
||||
fn from_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
|
||||
fn concat_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
|
||||
let (first, last) = match self.sess().target.options.endian {
|
||||
Endian::Little => (low, high),
|
||||
Endian::Big => (high, low),
|
||||
|
Loading…
Reference in New Issue
Block a user