From f126b9e3d1820e2c2c34953a12876bbd539f3683 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 12 Aug 2023 01:58:04 +0800 Subject: [PATCH] src: modernize use-equals-default PR-URL: https://github.com/nodejs/node/pull/48735 Reviewed-By: Rafael Gonzaga Reviewed-By: Yagiz Nizipli --- src/api/environment.cc | 2 -- src/blob_serializer_deserializer.h | 4 ++-- src/cleanup_queue.h | 2 +- src/crypto/crypto_ec.cc | 2 -- src/crypto/crypto_ec.h | 2 +- src/inspector_agent.cc | 2 +- src/js_native_api_v8.h | 4 ++-- src/json_parser.h | 2 +- src/node.cc | 3 --- src/node.h | 4 ++-- src/node_internals.h | 2 +- 11 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/api/environment.cc b/src/api/environment.cc index 2128ca6c4ebb75..6a6164b6d29443 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -408,8 +408,6 @@ void FreeIsolateData(IsolateData* isolate_data) { delete isolate_data; } -InspectorParentHandle::~InspectorParentHandle() {} - // Hide the internal handle class from the public API. #if HAVE_INSPECTOR struct InspectorParentHandleImpl : public InspectorParentHandle { diff --git a/src/blob_serializer_deserializer.h b/src/blob_serializer_deserializer.h index aa07bee54fd1bc..fe7989e22a3536 100644 --- a/src/blob_serializer_deserializer.h +++ b/src/blob_serializer_deserializer.h @@ -39,7 +39,7 @@ class BlobDeserializer : public BlobSerializerDeserializer { public: explicit BlobDeserializer(bool is_debug_v, std::string_view s) : BlobSerializerDeserializer(is_debug_v), sink(s) {} - ~BlobDeserializer() {} + ~BlobDeserializer() = default; size_t read_total = 0; std::string_view sink; @@ -85,7 +85,7 @@ class BlobSerializer : public BlobSerializerDeserializer { public: explicit BlobSerializer(bool is_debug_v) : BlobSerializerDeserializer(is_debug_v) {} - ~BlobSerializer() {} + ~BlobSerializer() = default; Impl* impl() { return static_cast(this); } const Impl* impl() const { return static_cast(this); } diff --git a/src/cleanup_queue.h b/src/cleanup_queue.h index 2ca333aca855ff..15451ab9473c81 100644 --- a/src/cleanup_queue.h +++ b/src/cleanup_queue.h @@ -18,7 +18,7 @@ class CleanupQueue : public MemoryRetainer { public: typedef void (*Callback)(void*); - CleanupQueue() {} + CleanupQueue() = default; // Not copyable. CleanupQueue(const CleanupQueue&) = delete; diff --git a/src/crypto/crypto_ec.cc b/src/crypto/crypto_ec.cc index 415464be04db6b..b3a73f5c9d10a6 100644 --- a/src/crypto/crypto_ec.cc +++ b/src/crypto/crypto_ec.cc @@ -130,8 +130,6 @@ void ECDH::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackFieldWithSize("key", key_ ? kSizeOf_EC_KEY : 0); } -ECDH::~ECDH() {} - void ECDH::New(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); diff --git a/src/crypto/crypto_ec.h b/src/crypto/crypto_ec.h index 9782ce0bf35a66..f9570bd41f92eb 100644 --- a/src/crypto/crypto_ec.h +++ b/src/crypto/crypto_ec.h @@ -20,7 +20,7 @@ int GetOKPCurveFromName(const char* name); class ECDH final : public BaseObject { public: - ~ECDH() override; + ~ECDH() override = default; static void Initialize(Environment* env, v8::Local target); static void RegisterExternalReferences(ExternalReferenceRegistry* registry); diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index fe1e573242f6e2..f0b4cc43c864ae 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -687,7 +687,7 @@ Agent::Agent(Environment* env) debug_options_(env->options()->debug_options()), host_port_(env->inspector_host_port()) {} -Agent::~Agent() {} +Agent::~Agent() = default; bool Agent::Start(const std::string& path, const DebugOptions& options, diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 4f0fb8b3d152f7..1ac738af2adb88 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -10,8 +10,8 @@ namespace v8impl { class RefTracker { public: - RefTracker() {} - virtual ~RefTracker() {} + RefTracker() = default; + virtual ~RefTracker() = default; virtual void Finalize() {} typedef RefTracker RefList; diff --git a/src/json_parser.h b/src/json_parser.h index 3978a24222eb03..f2e7d592d9aaa7 100644 --- a/src/json_parser.h +++ b/src/json_parser.h @@ -16,7 +16,7 @@ namespace node { class JSONParser { public: JSONParser(); - ~JSONParser() {} + ~JSONParser() = default; bool Parse(const std::string& content); std::optional GetTopLevelStringField(std::string_view field); std::optional GetTopLevelBoolField(std::string_view field); diff --git a/src/node.cc b/src/node.cc index 7ca3e14ee06c3a..039c285a05f067 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1138,9 +1138,6 @@ void TearDownOncePerProcess() { } } -InitializationResult::~InitializationResult() {} -InitializationResultImpl::~InitializationResultImpl() {} - ExitCode GenerateAndWriteSnapshotData(const SnapshotData** snapshot_data_ptr, const InitializationResultImpl* result) { ExitCode exit_code = result->exit_code_enum(); diff --git a/src/node.h b/src/node.h index 846ec413f8e1fc..c560ace29bd2fe 100644 --- a/src/node.h +++ b/src/node.h @@ -285,7 +285,7 @@ enum Flags : uint32_t { class NODE_EXTERN InitializationResult { public: - virtual ~InitializationResult(); + virtual ~InitializationResult() = default; // Returns a suggested process exit code. virtual int exit_code() const = 0; @@ -654,7 +654,7 @@ enum Flags : uint64_t { } // namespace EnvironmentFlags struct InspectorParentHandle { - virtual ~InspectorParentHandle(); + virtual ~InspectorParentHandle() = default; }; // TODO(addaleax): Maybe move per-Environment options parsing here. diff --git a/src/node_internals.h b/src/node_internals.h index 9243344eb788b5..d7f78664615fcf 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -318,7 +318,7 @@ void MarkBootstrapComplete(const v8::FunctionCallbackInfo& args); class InitializationResultImpl final : public InitializationResult { public: - ~InitializationResultImpl(); + ~InitializationResultImpl() = default; int exit_code() const { return static_cast(exit_code_enum()); } ExitCode exit_code_enum() const { return exit_code_; } bool early_return() const { return early_return_; }