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

Fixing clang-tidy warning.

Bug: v8:8015
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Ibc5124e06f5774e7695029e2d21084a7efb965e6
Reviewed-on: https://chromium-review.googlesource.com/1224412
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56065}
This commit is contained in:
Florian Sattler 2018-09-19 19:03:08 +02:00 committed by Commit Bot
parent 884b396907
commit a8340d5eac
35 changed files with 68 additions and 87 deletions

View File

@ -35,7 +35,7 @@ class V8_PLATFORM_EXPORT TraceObject {
const char* as_string;
};
TraceObject() {}
TraceObject() = default;
~TraceObject();
void Initialize(
char phase, const uint8_t* category_enabled_flag, const char* name,
@ -106,8 +106,8 @@ class V8_PLATFORM_EXPORT TraceObject {
class V8_PLATFORM_EXPORT TraceWriter {
public:
TraceWriter() {}
virtual ~TraceWriter() {}
TraceWriter() = default;
virtual ~TraceWriter() = default;
virtual void AppendTraceEvent(TraceObject* trace_event) = 0;
virtual void Flush() = 0;
@ -147,8 +147,8 @@ class V8_PLATFORM_EXPORT TraceBufferChunk {
class V8_PLATFORM_EXPORT TraceBuffer {
public:
TraceBuffer() {}
virtual ~TraceBuffer() {}
TraceBuffer() = default;
virtual ~TraceBuffer() = default;
virtual TraceObject* AddTraceEvent(uint64_t* handle) = 0;
virtual TraceObject* GetEventByHandle(uint64_t handle) = 0;

View File

@ -445,7 +445,7 @@ class V8_EXPORT OutputStream { // NOLINT
kContinue = 0,
kAbort = 1
};
virtual ~OutputStream() {}
virtual ~OutputStream() = default;
/** Notify about the end of stream. */
virtual void EndOfStream() = 0;
/** Get preferred output chunk size. Called only once. */
@ -539,7 +539,7 @@ class V8_EXPORT ActivityControl { // NOLINT
kContinue = 0,
kAbort = 1
};
virtual ~ActivityControl() {}
virtual ~ActivityControl() = default;
/**
* Notify about current progress. The activity can be stopped by
* returning kAbort as the callback result.
@ -625,7 +625,7 @@ class V8_EXPORT AllocationProfile {
*/
virtual Node* GetRootNode() = 0;
virtual ~AllocationProfile() {}
virtual ~AllocationProfile() = default;
static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
@ -793,7 +793,7 @@ class V8_EXPORT HeapProfiler {
virtual const char* GetName(Local<Object> object) = 0;
protected:
virtual ~ObjectNameResolver() {}
virtual ~ObjectNameResolver() = default;
};
/**
@ -985,8 +985,8 @@ class V8_EXPORT RetainedObjectInfo { // NOLINT
virtual intptr_t GetSizeInBytes() { return -1; }
protected:
RetainedObjectInfo() {}
virtual ~RetainedObjectInfo() {}
RetainedObjectInfo() = default;
virtual ~RetainedObjectInfo() = default;
private:
RetainedObjectInfo(const RetainedObjectInfo&);

View File

@ -855,7 +855,7 @@ class V8_EXPORT HandleScope {
void operator=(const HandleScope&) = delete;
protected:
V8_INLINE HandleScope() {}
V8_INLINE HandleScope() = default;
void Initialize(Isolate* isolate);
@ -895,7 +895,7 @@ class V8_EXPORT HandleScope {
class V8_EXPORT EscapableHandleScope : public HandleScope {
public:
explicit EscapableHandleScope(Isolate* isolate);
V8_INLINE ~EscapableHandleScope() {}
V8_INLINE ~EscapableHandleScope() = default;
/**
* Pushes the value into the previous scope and returns a handle to it.
@ -1337,7 +1337,7 @@ class V8_EXPORT ScriptCompiler {
*/
class V8_EXPORT ExternalSourceStream {
public:
virtual ~ExternalSourceStream() {}
virtual ~ExternalSourceStream() = default;
/**
* V8 calls this to request the next chunk of data from the embedder. This
@ -1415,7 +1415,7 @@ class V8_EXPORT ScriptCompiler {
*/
class ScriptStreamingTask {
public:
virtual ~ScriptStreamingTask() {}
virtual ~ScriptStreamingTask() = default;
virtual void Run() = 0;
};
@ -1868,7 +1868,7 @@ class V8_EXPORT ValueSerializer {
public:
class V8_EXPORT Delegate {
public:
virtual ~Delegate() {}
virtual ~Delegate() = default;
/**
* Handles the case where a DataCloneError would be thrown in the structured
@ -2005,7 +2005,7 @@ class V8_EXPORT ValueDeserializer {
public:
class V8_EXPORT Delegate {
public:
virtual ~Delegate() {}
virtual ~Delegate() = default;
/**
* The embedder overrides this method to read some kind of host object, if
@ -2620,7 +2620,7 @@ class V8_EXPORT String : public Name {
class V8_EXPORT ExternalStringResourceBase { // NOLINT
public:
virtual ~ExternalStringResourceBase() {}
virtual ~ExternalStringResourceBase() = default;
V8_DEPRECATE_SOON("Use IsCacheable().",
virtual bool IsCompressible() const) {
@ -2644,7 +2644,7 @@ class V8_EXPORT String : public Name {
}
protected:
ExternalStringResourceBase() {}
ExternalStringResourceBase() = default;
/**
* Internally V8 will call this Dispose method when the external string
@ -2695,7 +2695,7 @@ class V8_EXPORT String : public Name {
* Override the destructor to manage the life cycle of the underlying
* buffer.
*/
~ExternalStringResource() override {}
~ExternalStringResource() override = default;
/**
* The string data from the underlying buffer.
@ -2708,7 +2708,7 @@ class V8_EXPORT String : public Name {
virtual size_t length() const = 0;
protected:
ExternalStringResource() {}
ExternalStringResource() = default;
};
/**
@ -2728,13 +2728,13 @@ class V8_EXPORT String : public Name {
* Override the destructor to manage the life cycle of the underlying
* buffer.
*/
~ExternalOneByteStringResource() override {}
~ExternalOneByteStringResource() override = default;
/** The string data from the underlying buffer.*/
virtual const char* data() const = 0;
/** The number of Latin-1 characters in the string.*/
virtual size_t length() const = 0;
protected:
ExternalOneByteStringResource() {}
ExternalOneByteStringResource() = default;
};
/**
@ -4404,7 +4404,7 @@ class V8_EXPORT WasmModuleObjectBuilderStreaming final {
void Abort(MaybeLocal<Value> exception);
Local<Promise> GetPromise();
~WasmModuleObjectBuilderStreaming();
~WasmModuleObjectBuilderStreaming() = default;
private:
WasmModuleObjectBuilderStreaming(const WasmModuleObjectBuilderStreaming&) =
@ -4463,7 +4463,7 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
class V8_EXPORT Allocator { // NOLINT
public:
virtual ~Allocator() {}
virtual ~Allocator() = default;
/**
* Allocate |length| bytes. Return NULL if allocation is not successful.
@ -6891,7 +6891,7 @@ typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
*/
class V8_EXPORT ExternalResourceVisitor { // NOLINT
public:
virtual ~ExternalResourceVisitor() {}
virtual ~ExternalResourceVisitor() = default;
virtual void VisitExternalString(Local<String> string) {}
};
@ -6901,7 +6901,7 @@ class V8_EXPORT ExternalResourceVisitor { // NOLINT
*/
class V8_EXPORT PersistentHandleVisitor { // NOLINT
public:
virtual ~PersistentHandleVisitor() {}
virtual ~PersistentHandleVisitor() = default;
virtual void VisitPersistentHandle(Persistent<Value>* value,
uint16_t class_id) {}
};

View File

@ -7452,9 +7452,6 @@ void WasmModuleObjectBuilderStreaming::Finish() {
void WasmModuleObjectBuilderStreaming::Abort(MaybeLocal<Value> exception) {
}
WasmModuleObjectBuilderStreaming::~WasmModuleObjectBuilderStreaming() {
}
// static
v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() {
return new ArrayBufferAllocator();
@ -9744,7 +9741,7 @@ debug::PostponeInterruptsScope::PostponeInterruptsScope(v8::Isolate* isolate)
new i::PostponeInterruptsScope(reinterpret_cast<i::Isolate*>(isolate),
i::StackGuard::API_INTERRUPT)) {}
debug::PostponeInterruptsScope::~PostponeInterruptsScope() {}
debug::PostponeInterruptsScope::~PostponeInterruptsScope() = default;
Local<String> CpuProfileNode::GetFunctionName() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);

View File

@ -364,12 +364,12 @@ class CpuFeatureScope {
#else
CpuFeatureScope(AssemblerBase* assembler, CpuFeature f,
CheckPolicy check = kCheckSupported) {}
// Define a destructor to avoid unused variable warnings.
~CpuFeatureScope() {}
~CpuFeatureScope() {
// Define a destructor to avoid unused variable warnings.
}
#endif
};
// CpuFeatures keeps track of which features are supported by the target CPU.
// Supported features must be enabled by a CpuFeatureScope before use.
// Example:
@ -444,7 +444,7 @@ double power_double_double(double x, double y);
class ConstantPoolEntry {
public:
ConstantPoolEntry() {}
ConstantPoolEntry() = default;
ConstantPoolEntry(int position, intptr_t value, bool sharing_ok,
RelocInfo::Mode rmode = RelocInfo::NONE)
: position_(position),

View File

@ -77,7 +77,9 @@ class PerThreadAssertScopeDebugOnly : public
#else
class PerThreadAssertScopeDebugOnly {
public:
PerThreadAssertScopeDebugOnly() { }
PerThreadAssertScopeDebugOnly() {
// Define a constructor to avoid unused variable warnings.
}
void Release() {}
#endif
};

View File

@ -27,9 +27,6 @@ BasicBlockProfiler::Data::Data(size_t n_blocks)
block_rpo_numbers_(n_blocks_),
counts_(n_blocks_, 0) {}
BasicBlockProfiler::Data::~Data() {}
static void InsertIntoString(std::ostringstream* os, std::string* string) {
string->insert(0, os->str());
}
@ -68,10 +65,6 @@ void BasicBlockProfiler::Data::ResetCounts() {
}
}
BasicBlockProfiler::BasicBlockProfiler() {}
BasicBlockProfiler::Data* BasicBlockProfiler::NewData(size_t n_blocks) {
base::LockGuard<base::Mutex> lock(&data_list_mutex_);
Data* data = new Data(n_blocks);

View File

@ -36,7 +36,7 @@ class BasicBlockProfiler {
const BasicBlockProfiler::Data& s);
explicit Data(size_t n_blocks);
~Data();
~Data() = default;
void ResetCounts();
@ -51,7 +51,7 @@ class BasicBlockProfiler {
typedef std::list<Data*> DataList;
BasicBlockProfiler();
BasicBlockProfiler() = default;
~BasicBlockProfiler();
V8_EXPORT_PRIVATE static BasicBlockProfiler* Get();

View File

@ -31,7 +31,7 @@ class BitVector : public ZoneObject {
current_(-1) {
Advance();
}
~Iterator() {}
~Iterator() = default;
bool Done() const { return current_index_ >= target_->data_length_; }
void Advance();

View File

@ -160,7 +160,7 @@ class Genesis {
GlobalContextType context_type);
Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template);
~Genesis() { }
~Genesis() = default;
Isolate* isolate() const { return isolate_; }
Factory* factory() const { return isolate_->factory(); }

View File

@ -24,7 +24,7 @@ class BaseCollectionsAssembler : public CodeStubAssembler {
explicit BaseCollectionsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
virtual ~BaseCollectionsAssembler() {}
virtual ~BaseCollectionsAssembler() = default;
protected:
enum Variant { kMap, kSet, kWeakMap, kWeakSet };

View File

@ -184,7 +184,7 @@ class SequenceCollector : public Collector<T, growth_factor, max_growth> {
: Collector<T, growth_factor, max_growth>(initial_capacity),
sequence_start_(kNoSequence) {}
~SequenceCollector() override {}
~SequenceCollector() override = default;
void StartSequence() {
DCHECK_EQ(sequence_start_, kNoSequence);

View File

@ -34,8 +34,6 @@ CompilationCache::CompilationCache(Isolate* isolate)
}
}
CompilationCache::~CompilationCache() {}
Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) {
DCHECK(generation < generations_);
Handle<CompilationCacheTable> result;

View File

@ -213,7 +213,7 @@ class CompilationCache {
private:
explicit CompilationCache(Isolate* isolate);
~CompilationCache();
~CompilationCache() = default;
base::HashMap* EagerOptimizingSet();

View File

@ -24,7 +24,7 @@ struct AsPrintableStatistics {
class CompilationStatistics final : public Malloced {
public:
CompilationStatistics() {}
CompilationStatistics() = default;
class BasicStats {
public:

View File

@ -194,7 +194,7 @@ class StringToIntHelper {
// buffer of one-byte digits, along with an optional radix prefix.
StringToIntHelper(Isolate* isolate, const uint8_t* subject, int length)
: isolate_(isolate), raw_one_byte_subject_(subject), length_(length) {}
virtual ~StringToIntHelper() {}
virtual ~StringToIntHelper() = default;
protected:
// Subclasses must implement these:

View File

@ -98,7 +98,7 @@ class StatsCounterBase {
const char* name_;
int* ptr_;
StatsCounterBase() {}
StatsCounterBase() = default;
StatsCounterBase(Counters* counters, const char* name)
: counters_(counters), name_(name), ptr_(nullptr) {}
@ -161,7 +161,7 @@ class StatsCounter : public StatsCounterBase {
private:
friend class Counters;
StatsCounter() {}
StatsCounter() = default;
StatsCounter(Counters* counters, const char* name)
: StatsCounterBase(counters, name), lookup_done_(false) {}
@ -227,7 +227,7 @@ class Histogram {
}
protected:
Histogram() {}
Histogram() = default;
Histogram(const char* name, int min, int max, int num_buckets,
Counters* counters)
: name_(name),
@ -277,7 +277,7 @@ class TimedHistogram : public Histogram {
friend class Counters;
HistogramTimerResolution resolution_;
TimedHistogram() {}
TimedHistogram() = default;
TimedHistogram(const char* name, int min, int max,
HistogramTimerResolution resolution, int num_buckets,
Counters* counters)
@ -393,7 +393,7 @@ class HistogramTimer : public TimedHistogram {
base::ElapsedTimer timer_;
HistogramTimer() {}
HistogramTimer() = default;
};
// Helper class for scoping a HistogramTimer.
@ -487,7 +487,7 @@ class AggregatableHistogramTimer : public Histogram {
private:
friend class Counters;
AggregatableHistogramTimer() {}
AggregatableHistogramTimer() = default;
AggregatableHistogramTimer(const char* name, int min, int max,
int num_buckets, Counters* counters)
: Histogram(name, min, max, num_buckets, counters) {}

View File

@ -289,7 +289,7 @@ class TranslatedFrame {
class TranslatedState {
public:
TranslatedState() {}
TranslatedState() = default;
explicit TranslatedState(const JavaScriptFrame* frame);
void Prepare(Address stack_frame_pointer);
@ -394,7 +394,7 @@ class TranslatedState {
class OptimizedFunctionVisitor {
public:
virtual ~OptimizedFunctionVisitor() {}
virtual ~OptimizedFunctionVisitor() = default;
virtual void VisitFunction(JSFunction* function) = 0;
};

View File

@ -16,7 +16,7 @@ typedef unsigned char byte;
// specific.
class NameConverter {
public:
virtual ~NameConverter() {}
virtual ~NameConverter() = default;
virtual const char* NameOfCPURegister(int reg) const;
virtual const char* NameOfByteCPURegister(int reg) const;
virtual const char* NameOfXMMRegister(int reg) const;

View File

@ -10,6 +10,7 @@
#include "src/heap/factory.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/isolate-inl.h"
#include "src/keys.h"
#include "src/messages.h"
#include "src/objects-inl.h"
#include "src/objects/arguments-inl.h"

View File

@ -19,7 +19,7 @@ class JSTypedArray;
class ElementsAccessor {
public:
explicit ElementsAccessor(const char* name) : name_(name) { }
virtual ~ElementsAccessor() { }
virtual ~ElementsAccessor() = default;
const char* name() const { return name_; }

View File

@ -73,7 +73,7 @@ class ExternalReferenceTable {
return OffsetOfEntry(size()) + 2 * kUInt32Size;
}
ExternalReferenceTable() {}
ExternalReferenceTable() = default;
void Init(Isolate* isolate);
private:

View File

@ -300,7 +300,7 @@ class StackFrame {
protected:
inline explicit StackFrame(StackFrameIteratorBase* iterator);
virtual ~StackFrame() { }
virtual ~StackFrame() = default;
// Compute the stack pointer for the calling frame.
virtual Address GetCallerStackPointer() const = 0;

View File

@ -177,7 +177,7 @@ class ELFStringTable;
template<typename THeader>
class DebugSectionBase : public ZoneObject {
public:
virtual ~DebugSectionBase() { }
virtual ~DebugSectionBase() = default;
virtual void WriteBody(Writer::Slot<THeader> header, Writer* writer) {
uintptr_t start = writer->position();
@ -238,7 +238,7 @@ class MachOSection : public DebugSectionBase<MachOSectionHeader> {
}
}
~MachOSection() override {}
~MachOSection() override = default;
virtual void PopulateHeader(Writer::Slot<Header> header) {
header->addr = 0;
@ -314,7 +314,7 @@ class ELFSection : public DebugSectionBase<ELFSectionHeader> {
ELFSection(const char* name, Type type, uintptr_t align)
: name_(name), type_(type), align_(align) { }
~ELFSection() override {}
~ELFSection() override = default;
void PopulateHeader(Writer::Slot<Header> header, ELFStringTable* strtab);

View File

@ -319,7 +319,7 @@ class SealHandleScope final {
public:
#ifndef DEBUG
explicit SealHandleScope(Isolate* isolate) {}
~SealHandleScope() {}
~SealHandleScope() = default;
#else
explicit inline SealHandleScope(Isolate* isolate);
inline ~SealHandleScope();

View File

@ -36,7 +36,7 @@ class IC {
// Construct the IC structure with the given number of extra
// JavaScript frames on the stack.
IC(Isolate* isolate, Handle<FeedbackVector> vector, FeedbackSlot slot);
virtual ~IC() {}
virtual ~IC() = default;
State state() const { return state_; }
inline Address address() const;

View File

@ -211,7 +211,7 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptor {
typedef CallInterfaceDescriptorData::Flags Flags;
CallInterfaceDescriptor() : data_(nullptr) {}
virtual ~CallInterfaceDescriptor() {}
virtual ~CallInterfaceDescriptor() = default;
CallInterfaceDescriptor(CallDescriptors::Key key)
: data_(CallDescriptors::call_descriptor_data(key)) {}

View File

@ -2265,10 +2265,6 @@ char* Isolate::RestoreThread(char* from) {
return from + sizeof(ThreadLocalTop);
}
Isolate::ThreadDataTable::ThreadDataTable() : table_() {}
Isolate::ThreadDataTable::~ThreadDataTable() {}
void Isolate::ReleaseSharedPtrs() {
while (managed_ptr_destructors_head_) {
ManagedPtrDestructor* l = managed_ptr_destructors_head_;

View File

@ -1552,8 +1552,7 @@ class Isolate : private HiddenFactory {
class ThreadDataTable {
public:
ThreadDataTable();
~ThreadDataTable();
ThreadDataTable() = default;
PerIsolateThreadData* Lookup(ThreadId thread_id);
void Insert(PerIsolateThreadData* data);

View File

@ -20,9 +20,6 @@
namespace v8 {
namespace internal {
KeyAccumulator::~KeyAccumulator() {
}
namespace {
static bool ContainsOnlyValidKeys(Handle<FixedArray> array) {

View File

@ -37,7 +37,7 @@ class KeyAccumulator final {
KeyAccumulator(Isolate* isolate, KeyCollectionMode mode,
PropertyFilter filter)
: isolate_(isolate), mode_(mode), filter_(filter) {}
~KeyAccumulator();
~KeyAccumulator() = default;
static MaybeHandle<FixedArray> GetKeys(
Handle<JSReceiver> object, KeyCollectionMode mode, PropertyFilter filter,

View File

@ -15,8 +15,6 @@ TraceBufferRingBuffer::TraceBufferRingBuffer(size_t max_chunks,
chunks_.resize(max_chunks);
}
TraceBufferRingBuffer::~TraceBufferRingBuffer() {}
TraceObject* TraceBufferRingBuffer::AddTraceEvent(uint64_t* handle) {
base::LockGuard<base::Mutex> guard(&mutex_);
if (is_empty_ || chunks_[chunk_index_]->IsFull()) {

View File

@ -18,7 +18,7 @@ namespace tracing {
class TraceBufferRingBuffer : public TraceBuffer {
public:
TraceBufferRingBuffer(size_t max_chunks, TraceWriter* trace_writer);
~TraceBufferRingBuffer() override;
~TraceBufferRingBuffer() override = default;
TraceObject* AddTraceEvent(uint64_t* handle) override;
TraceObject* GetEventByHandle(uint64_t handle) override;

View File

@ -40,7 +40,7 @@ const int g_num_builtin_categories = 3;
// Skip default categories.
v8::base::AtomicWord g_category_index = g_num_builtin_categories;
TracingController::TracingController() {}
TracingController::TracingController() = default;
TracingController::~TracingController() {
StopTracing();

View File

@ -63,7 +63,7 @@ class Log {
// Create a message builder starting from position 0.
// This acquires the mutex in the log as well.
explicit MessageBuilder(Log* log);
~MessageBuilder() { }
~MessageBuilder() = default;
void AppendString(String* str,
base::Optional<int> length_limit = base::nullopt);