[cleanup] Fix leftover clang-tidy warnings.
Fixing clang-tidy warning. Replace 0 with nullptr. Add NOLINT for special cases. Add default/override to methods. Bug: v8:8015 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: Iff483356ace471d816051c6dd06ca08809ae1c09 Reviewed-on: https://chromium-review.googlesource.com/1238333 Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Commit-Queue: Florian Sattler <sattlerf@google.com> Cr-Commit-Position: refs/heads/master@{#56129}
This commit is contained in:
parent
c39a787fd0
commit
cdd8e54cb8
14
src/api.cc
14
src/api.cc
@ -1773,15 +1773,15 @@ static i::Handle<i::InterceptorInfo> CreateInterceptorInfo(
|
||||
isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE, i::TENURED));
|
||||
obj->set_flags(0);
|
||||
|
||||
if (getter != 0) SET_FIELD_WRAPPED(isolate, obj, set_getter, getter);
|
||||
if (setter != 0) SET_FIELD_WRAPPED(isolate, obj, set_setter, setter);
|
||||
if (query != 0) SET_FIELD_WRAPPED(isolate, obj, set_query, query);
|
||||
if (descriptor != 0)
|
||||
if (getter != nullptr) SET_FIELD_WRAPPED(isolate, obj, set_getter, getter);
|
||||
if (setter != nullptr) SET_FIELD_WRAPPED(isolate, obj, set_setter, setter);
|
||||
if (query != nullptr) SET_FIELD_WRAPPED(isolate, obj, set_query, query);
|
||||
if (descriptor != nullptr)
|
||||
SET_FIELD_WRAPPED(isolate, obj, set_descriptor, descriptor);
|
||||
if (remover != 0) SET_FIELD_WRAPPED(isolate, obj, set_deleter, remover);
|
||||
if (enumerator != 0)
|
||||
if (remover != nullptr) SET_FIELD_WRAPPED(isolate, obj, set_deleter, remover);
|
||||
if (enumerator != nullptr)
|
||||
SET_FIELD_WRAPPED(isolate, obj, set_enumerator, enumerator);
|
||||
if (definer != 0) SET_FIELD_WRAPPED(isolate, obj, set_definer, definer);
|
||||
if (definer != nullptr) SET_FIELD_WRAPPED(isolate, obj, set_definer, definer);
|
||||
obj->set_can_intercept_symbols(
|
||||
!(static_cast<int>(flags) &
|
||||
static_cast<int>(PropertyHandlerFlags::kOnlyInterceptStrings)));
|
||||
|
@ -364,7 +364,7 @@ class CpuFeatureScope {
|
||||
#else
|
||||
CpuFeatureScope(AssemblerBase* assembler, CpuFeature f,
|
||||
CheckPolicy check = kCheckSupported) {}
|
||||
~CpuFeatureScope() {
|
||||
~CpuFeatureScope() { // NOLINT (modernize-use-equals-default)
|
||||
// Define a destructor to avoid unused variable warnings.
|
||||
}
|
||||
#endif
|
||||
@ -461,7 +461,7 @@ class ConstantPoolEntry {
|
||||
int position() const { return position_; }
|
||||
bool sharing_ok() const { return merged_index_ != SHARING_PROHIBITED; }
|
||||
bool is_merged() const { return merged_index_ >= 0; }
|
||||
int merged_index(void) const {
|
||||
int merged_index() const {
|
||||
DCHECK(is_merged());
|
||||
return merged_index_;
|
||||
}
|
||||
@ -470,7 +470,7 @@ class ConstantPoolEntry {
|
||||
merged_index_ = index;
|
||||
DCHECK(is_merged());
|
||||
}
|
||||
int offset(void) const {
|
||||
int offset() const {
|
||||
DCHECK_GE(merged_index_, 0);
|
||||
return merged_index_;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class PerThreadAssertScopeDebugOnly : public
|
||||
#else
|
||||
class PerThreadAssertScopeDebugOnly {
|
||||
public:
|
||||
PerThreadAssertScopeDebugOnly() {
|
||||
PerThreadAssertScopeDebugOnly() { // NOLINT (modernize-use-equals-default)
|
||||
// Define a constructor to avoid unused variable warnings.
|
||||
}
|
||||
void Release() {}
|
||||
|
@ -19,7 +19,7 @@ class V8_BASE_EXPORT LsanPageAllocator
|
||||
: public NON_EXPORTED_BASE(::v8::PageAllocator) {
|
||||
public:
|
||||
LsanPageAllocator(v8::PageAllocator* page_allocator);
|
||||
virtual ~LsanPageAllocator() = default;
|
||||
~LsanPageAllocator() override = default;
|
||||
|
||||
size_t AllocatePageSize() override { return allocate_page_size_; }
|
||||
|
||||
|
@ -582,15 +582,6 @@ class Node::Uses::const_iterator final {
|
||||
typedef Node** pointer;
|
||||
typedef Node*& reference;
|
||||
|
||||
const_iterator(const const_iterator& other)
|
||||
: current_(other.current_)
|
||||
#ifdef DEBUG
|
||||
,
|
||||
next_(other.next_)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
Node* operator*() const { return current_->from(); }
|
||||
bool operator==(const const_iterator& other) const {
|
||||
return other.current_ == current_;
|
||||
|
@ -51,6 +51,7 @@ FrameInspector::FrameInspector(StandardFrame* frame, int inlined_frame_index,
|
||||
}
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
FrameInspector::~FrameInspector() {
|
||||
// Destructor needs to be defined in the .cc file, because it instantiates
|
||||
// std::unique_ptr destructors but the types are not known in the header.
|
||||
|
@ -19,7 +19,7 @@ class FrameInspector {
|
||||
FrameInspector(StandardFrame* frame, int inlined_frame_index,
|
||||
Isolate* isolate);
|
||||
|
||||
~FrameInspector();
|
||||
~FrameInspector(); // NOLINT (modernize-use-equals-default)
|
||||
|
||||
int GetParametersCount();
|
||||
Handle<JSFunction> GetFunction() const { return function_; }
|
||||
|
@ -961,6 +961,7 @@ class V8_EXPORT_PRIVATE Factory {
|
||||
// Downcast to the privately inherited sub-class using c-style casts to
|
||||
// avoid undefined behavior (as static_cast cannot cast across private
|
||||
// bases).
|
||||
// NOLINTNEXTLINE (google-readability-casting)
|
||||
return (Isolate*)this; // NOLINT(readability/casting)
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ class IdentityMap : public IdentityMapBase {
|
||||
void* v = nullptr;
|
||||
bool deleted_something = DeleteEntry(key, &v);
|
||||
if (deleted_value != nullptr && deleted_something) {
|
||||
*deleted_value = (V) reinterpret_cast<intptr_t>(v);
|
||||
*deleted_value = *reinterpret_cast<V*>(&v);
|
||||
}
|
||||
return deleted_something;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class V8_EXPORT_PRIVATE SwitchBuilder final
|
||||
case_sites_(builder->zone()) {
|
||||
case_sites_.resize(number_of_cases);
|
||||
}
|
||||
~SwitchBuilder() override;
|
||||
~SwitchBuilder() override; // NOLINT (modernize-use-equals-default)
|
||||
|
||||
// This method should be called by the SwitchBuilder owner when the case
|
||||
// statement with |index| is emitted to update the case jump site.
|
||||
|
@ -2300,6 +2300,7 @@ void Isolate::UnregisterManagedPtrDestructor(ManagedPtrDestructor* destructor) {
|
||||
destructor->next_ = nullptr;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
Isolate::PerIsolateThreadData::~PerIsolateThreadData() {
|
||||
#if defined(USE_SIMULATOR)
|
||||
delete simulator_;
|
||||
|
@ -1094,6 +1094,7 @@ class Isolate : private HiddenFactory {
|
||||
v8::internal::Factory* factory() {
|
||||
// Upcast to the privately inherited base-class using c-style casts to avoid
|
||||
// undefined behavior (as static_cast cannot cast across private bases).
|
||||
// NOLINTNEXTLINE (google-readability-casting)
|
||||
return (v8::internal::Factory*)this; // NOLINT(readability/casting)
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ DefaultWorkerThreadsTaskRunner::DefaultWorkerThreadsTaskRunner(
|
||||
}
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
DefaultWorkerThreadsTaskRunner::~DefaultWorkerThreadsTaskRunner() {
|
||||
// This destructor is needed because we have unique_ptr to the WorkerThreads,
|
||||
// und the {WorkerThread} class is forward declared in the header file.
|
||||
|
@ -32,7 +32,7 @@ namespace {
|
||||
int CurrencyDigits(const icu::UnicodeString& currency) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
uint32_t fraction_digits = ucurr_getDefaultFractionDigits(
|
||||
(const UChar*)(currency.getBuffer()), &status);
|
||||
reinterpret_cast<const UChar*>(currency.getBuffer()), &status);
|
||||
// For missing currency codes, default to the most common, 2
|
||||
return U_SUCCESS(status) ? fraction_digits : 2;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class ExternalReferenceEncoder {
|
||||
};
|
||||
|
||||
explicit ExternalReferenceEncoder(Isolate* isolate);
|
||||
~ExternalReferenceEncoder();
|
||||
~ExternalReferenceEncoder(); // NOLINT (modernize-use-equals-default)
|
||||
|
||||
Value Encode(Address key);
|
||||
Maybe<Value> TryEncode(Address key);
|
||||
|
@ -284,6 +284,7 @@ class Serializer<AllocatorT>::ObjectSerializer : public ObjectVisitor {
|
||||
serializer_->PushStack(obj);
|
||||
#endif // DEBUG
|
||||
}
|
||||
// NOLINTNEXTLINE (modernize-use-equals-default)
|
||||
~ObjectSerializer() override {
|
||||
#ifdef DEBUG
|
||||
serializer_->PopStack();
|
||||
|
@ -47,8 +47,8 @@ class Writer {
|
||||
WriteUnalignedValue(reinterpret_cast<Address>(current_location()), value);
|
||||
pos_ += sizeof(T);
|
||||
if (FLAG_trace_wasm_serialization) {
|
||||
StdoutStream{} << "wrote: " << (size_t)value << " sized: " << sizeof(T)
|
||||
<< std::endl;
|
||||
StdoutStream{} << "wrote: " << static_cast<size_t>(value)
|
||||
<< " sized: " << sizeof(T) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ class Reader {
|
||||
ReadUnalignedValue<T>(reinterpret_cast<Address>(current_location()));
|
||||
pos_ += sizeof(T);
|
||||
if (FLAG_trace_wasm_serialization) {
|
||||
StdoutStream{} << "read: " << (size_t)value << " sized: " << sizeof(T)
|
||||
<< std::endl;
|
||||
StdoutStream{} << "read: " << static_cast<size_t>(value)
|
||||
<< " sized: " << sizeof(T) << std::endl;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ class StaticOneByteResource : public v8::String::ExternalOneByteStringResource {
|
||||
public:
|
||||
explicit StaticOneByteResource(const char* data) : data_(data) {}
|
||||
|
||||
~StaticOneByteResource() = default;
|
||||
~StaticOneByteResource() override = default;
|
||||
|
||||
const char* data() const override { return data_; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user