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