Commit a072e666 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[cleanup] Refactor first batch of general classes to use default members.

Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: Ibc5a81aea25f797e90db891e90b2977f27e13990
Reviewed-on: https://chromium-review.googlesource.com/1224410
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56015}
parent 68b36a15
...@@ -66,7 +66,7 @@ class CodeEventListener { ...@@ -66,7 +66,7 @@ class CodeEventListener {
}; };
#undef DECLARE_ENUM #undef DECLARE_ENUM
virtual ~CodeEventListener() {} virtual ~CodeEventListener() = default;
virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, virtual void CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code,
const char* comment) = 0; const char* comment) = 0;
...@@ -98,7 +98,7 @@ class CodeEventDispatcher { ...@@ -98,7 +98,7 @@ class CodeEventDispatcher {
public: public:
using LogEventsAndTags = CodeEventListener::LogEventsAndTags; using LogEventsAndTags = CodeEventListener::LogEventsAndTags;
CodeEventDispatcher() {} CodeEventDispatcher() = default;
bool AddListener(CodeEventListener* listener) { bool AddListener(CodeEventListener* listener) {
base::LockGuard<base::Mutex> guard(&mutex_); base::LockGuard<base::Mutex> guard(&mutex_);
......
...@@ -114,7 +114,7 @@ class CodeStub : public ZoneObject { ...@@ -114,7 +114,7 @@ class CodeStub : public ZoneObject {
static const char* MajorName(Major major_key); static const char* MajorName(Major major_key);
explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {} explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {}
virtual ~CodeStub() {} virtual ~CodeStub() = default;
static void GenerateStubsAheadOfTime(Isolate* isolate); static void GenerateStubsAheadOfTime(Isolate* isolate);
......
...@@ -307,8 +307,6 @@ void JSStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array, ...@@ -307,8 +307,6 @@ void JSStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array,
is_strict_ = (flags & FrameArray::kIsStrict) != 0; is_strict_ = (flags & FrameArray::kIsStrict) != 0;
} }
JSStackFrame::JSStackFrame() {}
JSStackFrame::JSStackFrame(Isolate* isolate, Handle<Object> receiver, JSStackFrame::JSStackFrame(Isolate* isolate, Handle<Object> receiver,
Handle<JSFunction> function, Handle<JSFunction> function,
Handle<AbstractCode> code, int offset) Handle<AbstractCode> code, int offset)
...@@ -642,8 +640,6 @@ Handle<Script> JSStackFrame::GetScript() const { ...@@ -642,8 +640,6 @@ Handle<Script> JSStackFrame::GetScript() const {
return handle(Script::cast(function_->shared()->script()), isolate_); return handle(Script::cast(function_->shared()->script()), isolate_);
} }
WasmStackFrame::WasmStackFrame() {}
void WasmStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array, void WasmStackFrame::FromFrameArray(Isolate* isolate, Handle<FrameArray> array,
int frame_ix) { int frame_ix) {
// This function is called for compiled and interpreted wasm frames, and for // This function is called for compiled and interpreted wasm frames, and for
...@@ -735,8 +731,6 @@ Handle<Script> WasmStackFrame::GetScript() const { ...@@ -735,8 +731,6 @@ Handle<Script> WasmStackFrame::GetScript() const {
return handle(wasm_instance_->module_object()->script(), isolate_); return handle(wasm_instance_->module_object()->script(), isolate_);
} }
AsmJsWasmStackFrame::AsmJsWasmStackFrame() {}
void AsmJsWasmStackFrame::FromFrameArray(Isolate* isolate, void AsmJsWasmStackFrame::FromFrameArray(Isolate* isolate,
Handle<FrameArray> array, Handle<FrameArray> array,
int frame_ix) { int frame_ix) {
......
...@@ -50,7 +50,7 @@ class MessageLocation { ...@@ -50,7 +50,7 @@ class MessageLocation {
class StackFrameBase { class StackFrameBase {
public: public:
virtual ~StackFrameBase() {} virtual ~StackFrameBase() = default;
virtual Handle<Object> GetReceiver() const = 0; virtual Handle<Object> GetReceiver() const = 0;
virtual Handle<Object> GetFunction() const = 0; virtual Handle<Object> GetFunction() const = 0;
...@@ -77,7 +77,7 @@ class StackFrameBase { ...@@ -77,7 +77,7 @@ class StackFrameBase {
virtual MaybeHandle<String> ToString() = 0; virtual MaybeHandle<String> ToString() = 0;
protected: protected:
StackFrameBase() {} StackFrameBase() = default;
explicit StackFrameBase(Isolate* isolate) : isolate_(isolate) {} explicit StackFrameBase(Isolate* isolate) : isolate_(isolate) {}
Isolate* isolate_; Isolate* isolate_;
...@@ -91,7 +91,7 @@ class JSStackFrame : public StackFrameBase { ...@@ -91,7 +91,7 @@ class JSStackFrame : public StackFrameBase {
JSStackFrame(Isolate* isolate, Handle<Object> receiver, JSStackFrame(Isolate* isolate, Handle<Object> receiver,
Handle<JSFunction> function, Handle<AbstractCode> code, Handle<JSFunction> function, Handle<AbstractCode> code,
int offset); int offset);
~JSStackFrame() override {} ~JSStackFrame() override = default;
Handle<Object> GetReceiver() const override { return receiver_; } Handle<Object> GetReceiver() const override { return receiver_; }
Handle<Object> GetFunction() const override; Handle<Object> GetFunction() const override;
...@@ -114,7 +114,7 @@ class JSStackFrame : public StackFrameBase { ...@@ -114,7 +114,7 @@ class JSStackFrame : public StackFrameBase {
MaybeHandle<String> ToString() override; MaybeHandle<String> ToString() override;
private: private:
JSStackFrame(); JSStackFrame() = default;
void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix); void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix);
bool HasScript() const override; bool HasScript() const override;
...@@ -133,7 +133,7 @@ class JSStackFrame : public StackFrameBase { ...@@ -133,7 +133,7 @@ class JSStackFrame : public StackFrameBase {
class WasmStackFrame : public StackFrameBase { class WasmStackFrame : public StackFrameBase {
public: public:
~WasmStackFrame() override {} ~WasmStackFrame() override = default;
Handle<Object> GetReceiver() const override; Handle<Object> GetReceiver() const override;
Handle<Object> GetFunction() const override; Handle<Object> GetFunction() const override;
...@@ -168,7 +168,7 @@ class WasmStackFrame : public StackFrameBase { ...@@ -168,7 +168,7 @@ class WasmStackFrame : public StackFrameBase {
int offset_; int offset_;
private: private:
WasmStackFrame(); WasmStackFrame() = default;
void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix); void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix);
friend class FrameArrayIterator; friend class FrameArrayIterator;
...@@ -177,7 +177,7 @@ class WasmStackFrame : public StackFrameBase { ...@@ -177,7 +177,7 @@ class WasmStackFrame : public StackFrameBase {
class AsmJsWasmStackFrame : public WasmStackFrame { class AsmJsWasmStackFrame : public WasmStackFrame {
public: public:
~AsmJsWasmStackFrame() override {} ~AsmJsWasmStackFrame() override = default;
Handle<Object> GetReceiver() const override; Handle<Object> GetReceiver() const override;
Handle<Object> GetFunction() const override; Handle<Object> GetFunction() const override;
...@@ -193,7 +193,7 @@ class AsmJsWasmStackFrame : public WasmStackFrame { ...@@ -193,7 +193,7 @@ class AsmJsWasmStackFrame : public WasmStackFrame {
private: private:
friend class FrameArrayIterator; friend class FrameArrayIterator;
AsmJsWasmStackFrame(); AsmJsWasmStackFrame() = default;
void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix); void FromFrameArray(Isolate* isolate, Handle<FrameArray> array, int frame_ix);
bool is_at_number_conversion_; bool is_at_number_conversion_;
......
...@@ -11472,7 +11472,7 @@ class StringComparator { ...@@ -11472,7 +11472,7 @@ class StringComparator {
}; };
public: public:
inline StringComparator() {} inline StringComparator() = default;
template<typename Chars1, typename Chars2> template<typename Chars1, typename Chars2>
static inline bool Equals(State* state_1, State* state_2, int to_check) { static inline bool Equals(State* state_1, State* state_2, int to_check) {
......
...@@ -22,10 +22,6 @@ namespace internal { ...@@ -22,10 +22,6 @@ namespace internal {
OFStreamBase::OFStreamBase(FILE* f) : f_(f) {} OFStreamBase::OFStreamBase(FILE* f) : f_(f) {}
OFStreamBase::~OFStreamBase() {}
int OFStreamBase::sync() { int OFStreamBase::sync() {
std::fflush(f_); std::fflush(f_);
return 0; return 0;
...@@ -47,9 +43,6 @@ OFStream::OFStream(FILE* f) : std::ostream(nullptr), buf_(f) { ...@@ -47,9 +43,6 @@ OFStream::OFStream(FILE* f) : std::ostream(nullptr), buf_(f) {
rdbuf(&buf_); rdbuf(&buf_);
} }
OFStream::~OFStream() {}
#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT) #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
AndroidLogStream::~AndroidLogStream() { AndroidLogStream::~AndroidLogStream() {
// If there is anything left in the line buffer, print it now, even though it // If there is anything left in the line buffer, print it now, even though it
......
...@@ -21,7 +21,7 @@ namespace internal { ...@@ -21,7 +21,7 @@ namespace internal {
class OFStreamBase : public std::streambuf { class OFStreamBase : public std::streambuf {
public: public:
explicit OFStreamBase(FILE* f); explicit OFStreamBase(FILE* f);
~OFStreamBase() override; ~OFStreamBase() override = default;
protected: protected:
FILE* const f_; FILE* const f_;
...@@ -35,7 +35,7 @@ class OFStreamBase : public std::streambuf { ...@@ -35,7 +35,7 @@ class OFStreamBase : public std::streambuf {
class V8_EXPORT_PRIVATE OFStream : public std::ostream { class V8_EXPORT_PRIVATE OFStream : public std::ostream {
public: public:
explicit OFStream(FILE* f); explicit OFStream(FILE* f);
~OFStream() override; ~OFStream() override = default;
private: private:
OFStreamBase buf_; OFStreamBase buf_;
......
...@@ -41,7 +41,7 @@ class PrototypeIterator { ...@@ -41,7 +41,7 @@ class PrototypeIterator {
inline explicit PrototypeIterator(Isolate* isolate, Handle<Map> receiver_map, inline explicit PrototypeIterator(Isolate* isolate, Handle<Map> receiver_map,
WhereToEnd where_to_end = END_AT_NULL); WhereToEnd where_to_end = END_AT_NULL);
~PrototypeIterator() {} ~PrototypeIterator() = default;
inline bool HasAccess() const; inline bool HasAccess() const;
......
...@@ -144,7 +144,7 @@ class V8_EXPORT_PRIVATE RegisterConfiguration { ...@@ -144,7 +144,7 @@ class V8_EXPORT_PRIVATE RegisterConfiguration {
bool AreAliases(MachineRepresentation rep, int index, bool AreAliases(MachineRepresentation rep, int index,
MachineRepresentation other_rep, int other_index) const; MachineRepresentation other_rep, int other_index) const;
virtual ~RegisterConfiguration() {} virtual ~RegisterConfiguration() = default;
private: private:
const int num_general_registers_; const int num_general_registers_;
......
...@@ -724,7 +724,7 @@ class RuntimeState { ...@@ -724,7 +724,7 @@ class RuntimeState {
} }
private: private:
RuntimeState() {} RuntimeState() = default;
#ifndef V8_INTL_SUPPORT #ifndef V8_INTL_SUPPORT
unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_; unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_; unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;
......
...@@ -34,7 +34,7 @@ class SetupIsolateDelegate { ...@@ -34,7 +34,7 @@ class SetupIsolateDelegate {
public: public:
explicit SetupIsolateDelegate(bool create_heap_objects) explicit SetupIsolateDelegate(bool create_heap_objects)
: create_heap_objects_(create_heap_objects) {} : create_heap_objects_(create_heap_objects) {}
virtual ~SetupIsolateDelegate() {} virtual ~SetupIsolateDelegate() = default;
virtual void SetupBuiltins(Isolate* isolate); virtual void SetupBuiltins(Isolate* isolate);
......
...@@ -27,7 +27,7 @@ class SnapshotByteSource final { ...@@ -27,7 +27,7 @@ class SnapshotByteSource final {
explicit SnapshotByteSource(Vector<const byte> payload) explicit SnapshotByteSource(Vector<const byte> payload)
: data_(payload.start()), length_(payload.length()), position_(0) {} : data_(payload.start()), length_(payload.length()), position_(0) {}
~SnapshotByteSource() {} ~SnapshotByteSource() = default;
bool HasMore() { return position_ < length_; } bool HasMore() { return position_ < length_; }
...@@ -82,10 +82,10 @@ class SnapshotByteSource final { ...@@ -82,10 +82,10 @@ class SnapshotByteSource final {
*/ */
class SnapshotByteSink { class SnapshotByteSink {
public: public:
SnapshotByteSink() {} SnapshotByteSink() = default;
explicit SnapshotByteSink(int initial_size) : data_(initial_size) {} explicit SnapshotByteSink(int initial_size) : data_(initial_size) {}
~SnapshotByteSink() {} ~SnapshotByteSink() = default;
void Put(byte b, const char* description) { data_.push_back(b); } void Put(byte b, const char* description) { data_.push_back(b); }
......
...@@ -176,7 +176,7 @@ class SplayTree { ...@@ -176,7 +176,7 @@ class SplayTree {
class NodeDeleter { class NodeDeleter {
public: public:
NodeDeleter() { } NodeDeleter() = default;
void Call(Node* node) { AllocationPolicy::Delete(node); } void Call(Node* node) { AllocationPolicy::Delete(node); }
private: private:
......
...@@ -17,7 +17,7 @@ class ByteArray; ...@@ -17,7 +17,7 @@ class ByteArray;
class StringAllocator { class StringAllocator {
public: public:
virtual ~StringAllocator() { } virtual ~StringAllocator() = default;
// Allocate a number of bytes. // Allocate a number of bytes.
virtual char* allocate(unsigned bytes) = 0; virtual char* allocate(unsigned bytes) = 0;
// Allocate a larger number of bytes and copy the old buffer to the new one. // Allocate a larger number of bytes and copy the old buffer to the new one.
...@@ -44,7 +44,8 @@ class FixedStringAllocator final : public StringAllocator { ...@@ -44,7 +44,8 @@ class FixedStringAllocator final : public StringAllocator {
public: public:
FixedStringAllocator(char* buffer, unsigned length) FixedStringAllocator(char* buffer, unsigned length)
: buffer_(buffer), length_(length) {} : buffer_(buffer), length_(length) {}
~FixedStringAllocator() override{}; ~FixedStringAllocator() override = default;
char* allocate(unsigned bytes) override; char* allocate(unsigned bytes) override;
char* grow(unsigned* bytes) override; char* grow(unsigned* bytes) override;
......
...@@ -16,7 +16,7 @@ namespace internal { ...@@ -16,7 +16,7 @@ namespace internal {
// Caching predicates used by scanners. // Caching predicates used by scanners.
class UnicodeCache { class UnicodeCache {
public: public:
UnicodeCache() {} UnicodeCache() = default;
typedef unibrow::Utf8Decoder<512> Utf8Decoder; typedef unibrow::Utf8Decoder<512> Utf8Decoder;
StaticResource<Utf8Decoder>* utf8_decoder() { return &utf8_decoder_; } StaticResource<Utf8Decoder>* utf8_decoder() { return &utf8_decoder_; }
......
...@@ -81,7 +81,7 @@ class V8_EXPORT_PRIVATE Utf8DecoderBase { ...@@ -81,7 +81,7 @@ class V8_EXPORT_PRIVATE Utf8DecoderBase {
template <size_t kBufferSize> template <size_t kBufferSize>
class Utf8Decoder : public Utf8DecoderBase { class Utf8Decoder : public Utf8DecoderBase {
public: public:
inline Utf8Decoder() {} inline Utf8Decoder() = default;
explicit inline Utf8Decoder(const v8::internal::Vector<const char>& stream); explicit inline Utf8Decoder(const v8::internal::Vector<const char>& stream);
inline void Reset(const v8::internal::Vector<const char>& stream); inline void Reset(const v8::internal::Vector<const char>& stream);
inline size_t WriteUtf16( inline size_t WriteUtf16(
......
...@@ -28,7 +28,7 @@ const int kMaxMappingSize = 4; ...@@ -28,7 +28,7 @@ const int kMaxMappingSize = 4;
template <class T, int size = 256> template <class T, int size = 256>
class Predicate { class Predicate {
public: public:
inline Predicate() { } inline Predicate() = default;
inline bool get(uchar c); inline bool get(uchar c);
private: private:
...@@ -68,7 +68,7 @@ class Predicate { ...@@ -68,7 +68,7 @@ class Predicate {
template <class T, int size = 256> template <class T, int size = 256>
class Mapping { class Mapping {
public: public:
inline Mapping() { } inline Mapping() = default;
inline int get(uchar c, uchar n, uchar* result); inline int get(uchar c, uchar n, uchar* result);
private: private:
friend class Test; friend class Test;
......
...@@ -59,7 +59,7 @@ class ThreadVisitor { ...@@ -59,7 +59,7 @@ class ThreadVisitor {
virtual void VisitThread(Isolate* isolate, ThreadLocalTop* top) = 0; virtual void VisitThread(Isolate* isolate, ThreadLocalTop* top) = 0;
protected: protected:
virtual ~ThreadVisitor() {} virtual ~ThreadVisitor() = default;
}; };
class ThreadManager { class ThreadManager {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
VectorSlotPair::VectorSlotPair() {} VectorSlotPair::VectorSlotPair() = default;
int VectorSlotPair::index() const { int VectorSlotPair::index() const {
return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_); return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
......
...@@ -56,7 +56,7 @@ enum class Root { ...@@ -56,7 +56,7 @@ enum class Root {
// pointers contained in roots. Used in GC and serialization/deserialization. // pointers contained in roots. Used in GC and serialization/deserialization.
class RootVisitor { class RootVisitor {
public: public:
virtual ~RootVisitor() {} virtual ~RootVisitor() = default;
// Visits a contiguous arrays of pointers in the half-open range // Visits a contiguous arrays of pointers in the half-open range
// [start, end). Any or all of the values may be modified on return. // [start, end). Any or all of the values may be modified on return.
...@@ -84,7 +84,7 @@ class RelocIterator; ...@@ -84,7 +84,7 @@ class RelocIterator;
// pointers contained in Objects. Used in GC and serialization/deserialization. // pointers contained in Objects. Used in GC and serialization/deserialization.
class ObjectVisitor { class ObjectVisitor {
public: public:
virtual ~ObjectVisitor() {} virtual ~ObjectVisitor() = default;
// Visits a contiguous arrays of pointers in the half-open range // Visits a contiguous arrays of pointers in the half-open range
// [start, end). Any or all of the values may be modified on return. // [start, end). Any or all of the values may be modified on return.
......
...@@ -488,7 +488,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -488,7 +488,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
// buffer is too small, a fatal error occurs. No deallocation of the buffer is // buffer is too small, a fatal error occurs. No deallocation of the buffer is
// done upon destruction of the assembler. // done upon destruction of the assembler.
Assembler(const AssemblerOptions& options, void* buffer, int buffer_size); Assembler(const AssemblerOptions& options, void* buffer, int buffer_size);
~Assembler() override {} ~Assembler() override = default;
// GetCode emits any pending (non-emitted) code and fills the descriptor // GetCode emits any pending (non-emitted) code and fills the descriptor
// desc. GetCode() is idempotent; it returns the same result if no other // desc. GetCode() is idempotent; it returns the same result if no other
......
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