Commit b3aa217d authored by Anton Bikineev's avatar Anton Bikineev Committed by V8 LUCI CQ

LSC: Apply clang-tidy's modernize-use-bool-literals to V8

The check finds implicit conversions of integer literals to bools:
 bool b1 = 1;
 bool b2 = static_cast<bool>(1);
and transforms them to:
 bool b1 = true;
 bool b2 = true;

Bug: chromium:1290142
Change-Id: I1fec7d7a6f25af23e9b9aac687f5896e79f17b51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3406533
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78753}
parent abe18ec7
......@@ -195,7 +195,7 @@ class RangeCheck {
public:
constexpr RangeCheck(bool is_in_lower_bound, bool is_in_upper_bound)
: is_underflow_(!is_in_lower_bound), is_overflow_(!is_in_upper_bound) {}
constexpr RangeCheck() : is_underflow_(0), is_overflow_(0) {}
constexpr RangeCheck() : is_underflow_(false), is_overflow_(false) {}
constexpr bool IsValid() const { return !is_overflow_ && !is_underflow_; }
constexpr bool IsInvalid() const { return is_overflow_ && is_underflow_; }
constexpr bool IsOverflow() const { return is_overflow_ && !is_underflow_; }
......
......@@ -6794,7 +6794,7 @@ Node* EffectControlLinearizer::BuildAllocateBigInt(Node* bitfield,
DCHECK(machine()->Is64());
DCHECK_EQ(bitfield == nullptr, digit == nullptr);
static constexpr auto zero_bitfield =
BigInt::SignBits::update(BigInt::LengthBits::encode(0), 0);
BigInt::SignBits::update(BigInt::LengthBits::encode(0), false);
Node* map = __ HeapConstant(factory()->bigint_map());
......
......@@ -67,10 +67,10 @@ class FastCApiObject {
self->fast_call_count_++;
if (should_fallback) {
options.fallback = 1;
options.fallback = true;
return 0;
} else {
options.fallback = 0;
options.fallback = false;
}
return static_cast<double>(arg_i32) + static_cast<double>(arg_u32) +
......@@ -178,13 +178,13 @@ class FastCApiObject {
self->fast_call_count_++;
if (should_fallback) {
options.fallback = 1;
options.fallback = true;
return 0;
}
uint32_t length = seq_arg->Length();
if (length > 1024) {
options.fallback = 1;
options.fallback = true;
return 0;
}
......@@ -192,7 +192,7 @@ class FastCApiObject {
bool result = TryToCopyAndConvertArrayToCppBuffer<
CTypeInfoBuilder<Type>::Build().GetId(), Type>(seq_arg, buffer, 1024);
if (!result) {
options.fallback = 1;
options.fallback = true;
return 0;
}
DCHECK_EQ(seq_arg->Length(), length);
......@@ -323,7 +323,7 @@ class FastCApiObject {
self->fast_call_count_++;
if (should_fallback) {
options.fallback = 1;
options.fallback = true;
return 0;
}
......@@ -420,7 +420,7 @@ class FastCApiObject {
self->fast_call_count_++;
if (should_fallback) {
options.fallback = 1;
options.fallback = true;
return 0;
}
......@@ -479,7 +479,7 @@ class FastCApiObject {
self->fast_call_count_++;
if (should_fallback) {
options.fallback = 1;
options.fallback = true;
return 0;
}
......@@ -539,7 +539,7 @@ class FastCApiObject {
self->fast_call_count_++;
if (should_fallback) {
options.fallback = 1;
options.fallback = true;
return false;
}
......
......@@ -27985,7 +27985,7 @@ struct ApiNumberChecker : BasicApiChecker<T, ApiNumberChecker<T>, void> {
v8::FastApiCallbackOptions& options) {
v8::Object* receiver_obj = *receiver;
if (!IsValidUnwrapObject(receiver_obj)) {
options.fallback = 1;
options.fallback = true;
return;
}
ApiNumberChecker<T>* receiver_ptr =
......@@ -27998,7 +27998,7 @@ struct ApiNumberChecker : BasicApiChecker<T, ApiNumberChecker<T>, void> {
// against after loading it from a stack slot, as defined in
// EffectControlLinearizer::LowerFastApiCall.
CHECK_EQ(options.fallback, 0);
options.fallback = 1;
options.fallback = true;
}
}
......@@ -4332,7 +4332,7 @@ struct FastApiReceiver {
// TODO(mslekova): The fallback is not used by the test. Replace this
// with a CHECK.
if (!IsValidUnwrapObject(*receiver)) {
options.fallback = 1;
options.fallback = true;
return;
}
FastApiReceiver* receiver_ptr =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment