Skip to content

Commit e6949b4

Browse files
gengjiawenrvagg
authored andcommitted
src: apply clang-tidy rule modernize-use-override
PR-URL: #26103 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 28d6074 commit e6949b4

27 files changed

+40
-40
lines changed

src/async_wrap.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class AsyncWrap : public BaseObject {
109109
ProviderType provider,
110110
double execution_async_id = -1);
111111

112-
virtual ~AsyncWrap();
112+
~AsyncWrap() override;
113113

114114
static v8::Local<v8::FunctionTemplate> GetConstructorTemplate(
115115
Environment* env);
@@ -169,7 +169,7 @@ class AsyncWrap : public BaseObject {
169169
v8::Local<v8::Value>* argv);
170170

171171
virtual std::string diagnostic_name() const;
172-
virtual std::string MemoryInfoName() const;
172+
std::string MemoryInfoName() const override;
173173

174174
static void WeakCallback(const v8::WeakCallbackInfo<DestroyParam> &info);
175175

src/base_object.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class BaseObject : public MemoryRetainer {
3838
// Associates this object with `object`. It uses the 0th internal field for
3939
// that, and in particular aborts if there is no such field.
4040
inline BaseObject(Environment* env, v8::Local<v8::Object> object);
41-
virtual inline ~BaseObject();
41+
inline ~BaseObject() override;
4242

4343
// Returns the wrapped object. Returns an empty handle when
4444
// persistent.IsEmpty() is true.

src/cares_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ using node_ares_task_list =
149149
class ChannelWrap : public AsyncWrap {
150150
public:
151151
ChannelWrap(Environment* env, Local<Object> object);
152-
~ChannelWrap();
152+
~ChannelWrap() override;
153153

154154
static void New(const FunctionCallbackInfo<Value>& args);
155155

src/inspector/main_thread_interface.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CreateObjectRequest : public Request {
4242
CreateObjectRequest(int object_id, Factory factory)
4343
: object_id_(object_id), factory_(std::move(factory)) {}
4444

45-
void Call(MainThreadInterface* thread) {
45+
void Call(MainThreadInterface* thread) override {
4646
thread->AddObject(object_id_, WrapInDeletable(factory_(thread)));
4747
}
4848

src/inspector_agent.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
228228
worker_agent_->Wire(node_dispatcher_.get());
229229
}
230230

231-
virtual ~ChannelImpl() {
231+
~ChannelImpl() override {
232232
tracing_agent_->disable();
233233
tracing_agent_.reset(); // Dispose before the dispatchers
234234
worker_agent_->disable();

src/inspector_io.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class InspectorIoDelegate: public node::inspector::SocketServerDelegate {
215215
const std::string& target_id,
216216
const std::string& script_path,
217217
const std::string& script_name);
218-
~InspectorIoDelegate() {
218+
~InspectorIoDelegate() override {
219219
}
220220

221221
void StartSession(int session_id, const std::string& target_id) override;

src/inspector_socket_server.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class SocketSession {
184184
public:
185185
Delegate(InspectorSocketServer* server, int session_id)
186186
: server_(server), session_id_(session_id) { }
187-
~Delegate() {
187+
~Delegate() override {
188188
server_->SessionTerminated(session_id_);
189189
}
190190
void OnHttpGet(const std::string& host, const std::string& path) override;

src/module_wrap.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ModuleWrap : public BaseObject {
6161
v8::Local<v8::Object> object,
6262
v8::Local<v8::Module> module,
6363
v8::Local<v8::String> url);
64-
~ModuleWrap();
64+
~ModuleWrap() override;
6565

6666
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
6767
static void Link(const v8::FunctionCallbackInfo<v8::Value>& args);

src/node.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class Environment;
220220

221221
class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
222222
public:
223-
virtual ~MultiIsolatePlatform() { }
223+
~MultiIsolatePlatform() override { }
224224
// Returns true if work was dispatched or executed. New tasks that are
225225
// posted during flushing of the queue are postponed until the next
226226
// flushing.

src/node_api.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class ThreadSafeFunction : public node::AsyncResource {
134134
env->Ref();
135135
}
136136

137-
~ThreadSafeFunction() {
137+
~ThreadSafeFunction() override {
138138
node::RemoveEnvironmentCleanupHook(env->isolate, Cleanup, this);
139139
env->Unref();
140140
}
@@ -839,7 +839,7 @@ class Work : public node::AsyncResource, public node::ThreadPoolWork {
839839
_complete(complete) {
840840
}
841841

842-
virtual ~Work() { }
842+
~Work() override { }
843843

844844
public:
845845
static Work* New(node_napi_env env,

src/node_contextify.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class ContextifyScript : public BaseObject {
108108
SET_SELF_SIZE(ContextifyScript)
109109

110110
ContextifyScript(Environment* env, v8::Local<v8::Object> object);
111-
~ContextifyScript();
111+
~ContextifyScript() override;
112112

113113
static void Init(Environment* env, v8::Local<v8::Object> target);
114114
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);

src/node_crypto_bio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace crypto {
4040
// (a.k.a. std::unique_ptr<BIO>).
4141
class NodeBIO : public MemoryRetainer {
4242
public:
43-
~NodeBIO();
43+
~NodeBIO() override;
4444

4545
static BIOPointer New(Environment* env = nullptr);
4646

src/node_file.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class FileHandle : public AsyncWrap, public StreamBase {
357357
static FileHandle* New(Environment* env,
358358
int fd,
359359
v8::Local<v8::Object> obj = v8::Local<v8::Object>());
360-
virtual ~FileHandle();
360+
~FileHandle() override;
361361

362362
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
363363

src/node_internals.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
105105
public:
106106
inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
107107

108-
virtual void* Allocate(size_t size); // Defined in src/node.cc
109-
virtual void* AllocateUninitialized(size_t size)
108+
void* Allocate(size_t size) override; // Defined in src/node.cc
109+
void* AllocateUninitialized(size_t size) override
110110
{ return node::UncheckedMalloc(size); }
111-
virtual void Free(void* data, size_t) { free(data); }
111+
void Free(void* data, size_t) override { free(data); }
112112

113113
private:
114114
uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land.

src/node_messaging.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Message : public MemoryRetainer {
7878
class MessagePortData : public MemoryRetainer {
7979
public:
8080
explicit MessagePortData(MessagePort* owner);
81-
~MessagePortData();
81+
~MessagePortData() override;
8282

8383
MessagePortData(MessagePortData&& other) = delete;
8484
MessagePortData& operator=(MessagePortData&& other) = delete;
@@ -138,7 +138,7 @@ class MessagePort : public HandleWrap {
138138
MessagePort(Environment* env,
139139
v8::Local<v8::Context> context,
140140
v8::Local<v8::Object> wrap);
141-
~MessagePort();
141+
~MessagePort() override;
142142

143143
// Create a new message port instance, optionally over an existing
144144
// `MessagePortData` object.

src/node_options.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class DebugOptions : public Options {
8989
return break_first_line || break_node_first_line;
9090
}
9191

92-
void CheckOptions(std::vector<std::string>* errors);
92+
void CheckOptions(std::vector<std::string>* errors) override;
9393
};
9494

9595
class EnvironmentOptions : public Options {
@@ -135,7 +135,7 @@ class EnvironmentOptions : public Options {
135135

136136
inline DebugOptions* get_debug_options();
137137
inline const DebugOptions& debug_options() const;
138-
void CheckOptions(std::vector<std::string>* errors);
138+
void CheckOptions(std::vector<std::string>* errors) override;
139139

140140
private:
141141
DebugOptions debug_options_;
@@ -156,7 +156,7 @@ class PerIsolateOptions : public Options {
156156
bool report_verbose;
157157
#endif // NODE_REPORT
158158
inline EnvironmentOptions* get_per_env_options();
159-
void CheckOptions(std::vector<std::string>* errors);
159+
void CheckOptions(std::vector<std::string>* errors) override;
160160
};
161161

162162
class PerProcessOptions : public Options {
@@ -202,7 +202,7 @@ class PerProcessOptions : public Options {
202202
#endif // NODE_REPORT
203203

204204
inline PerIsolateOptions* get_per_isolate_options();
205-
void CheckOptions(std::vector<std::string>* errors);
205+
void CheckOptions(std::vector<std::string>* errors) override;
206206
};
207207

208208
// The actual options parser, as opposed to the structs containing them:

src/node_platform.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class PerIsolatePlatformData :
5656
public std::enable_shared_from_this<PerIsolatePlatformData> {
5757
public:
5858
PerIsolatePlatformData(v8::Isolate* isolate, uv_loop_t* loop);
59-
~PerIsolatePlatformData();
59+
~PerIsolatePlatformData() override;
6060

6161
void PostTask(std::unique_ptr<v8::Task> task) override;
6262
void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
@@ -123,7 +123,7 @@ class NodePlatform : public MultiIsolatePlatform {
123123
public:
124124
NodePlatform(int thread_pool_size,
125125
node::tracing::TracingController* tracing_controller);
126-
virtual ~NodePlatform() {}
126+
~NodePlatform() override {}
127127

128128
void DrainTasks(v8::Isolate* isolate) override;
129129
void CancelPendingDelayedTasks(v8::Isolate* isolate) override;

src/node_serdes.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SerializerContext : public BaseObject,
3333
SerializerContext(Environment* env,
3434
Local<Object> wrap);
3535

36-
~SerializerContext() {}
36+
~SerializerContext() override {}
3737

3838
void ThrowDataCloneError(Local<String> message) override;
3939
Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object) override;
@@ -68,7 +68,7 @@ class DeserializerContext : public BaseObject,
6868
Local<Object> wrap,
6969
Local<Value> buffer);
7070

71-
~DeserializerContext() {}
71+
~DeserializerContext() override {}
7272

7373
MaybeLocal<Object> ReadHostObject(Isolate* isolate) override;
7474

src/node_worker.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Worker : public AsyncWrap {
1818
v8::Local<v8::Object> wrap,
1919
const std::string& url,
2020
std::shared_ptr<PerIsolateOptions> per_isolate_opts);
21-
~Worker();
21+
~Worker() override;
2222

2323
// Run the worker. This is only called from the worker thread.
2424
void Run();

src/stream_base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class WriteWrap : public StreamReq {
8282
v8::Local<v8::Object> req_wrap_obj)
8383
: StreamReq(stream, req_wrap_obj) { }
8484

85-
~WriteWrap() {
85+
~WriteWrap() override {
8686
free(storage_);
8787
}
8888

src/stream_pipe.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace node {
1010
class StreamPipe : public AsyncWrap {
1111
public:
1212
StreamPipe(StreamBase* source, StreamBase* sink, v8::Local<v8::Object> obj);
13-
~StreamPipe();
13+
~StreamPipe() override;
1414

1515
void Unpipe();
1616

src/tracing/node_trace_buffer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class InternalTraceBuffer {
5151
class NodeTraceBuffer : public TraceBuffer {
5252
public:
5353
NodeTraceBuffer(size_t max_chunks, Agent* agent, uv_loop_t* tracing_loop);
54-
~NodeTraceBuffer();
54+
~NodeTraceBuffer() override;
5555

5656
TraceObject* AddTraceEvent(uint64_t* handle) override;
5757
TraceObject* GetEventByHandle(uint64_t handle) override;

src/tracing/node_trace_writer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using v8::platform::tracing::TraceWriter;
1717
class NodeTraceWriter : public AsyncTraceWriter {
1818
public:
1919
explicit NodeTraceWriter(const std::string& log_file_pattern);
20-
~NodeTraceWriter();
20+
~NodeTraceWriter() override;
2121

2222
void InitializeOnThread(uv_loop_t* loop) override;
2323
void AppendTraceEvent(TraceObject* trace_event) override;

test/cctest/node_test_fixture.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ class NodeTestFixture : public ::testing::Test {
8484
CHECK_EQ(0, uv_loop_close(&current_loop));
8585
}
8686

87-
virtual void SetUp() {
87+
void SetUp() override {
8888
allocator = ArrayBufferUniquePtr(node::CreateArrayBufferAllocator(),
8989
&node::FreeArrayBufferAllocator);
9090
isolate_ = NewIsolate(allocator.get(), &current_loop);
9191
CHECK_NE(isolate_, nullptr);
9292
}
9393

94-
virtual void TearDown() {
94+
void TearDown() override {
9595
isolate_->Dispose();
9696
platform->UnregisterIsolate(isolate_);
9797
isolate_ = nullptr;

test/cctest/test_environment.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static std::string cb_1_arg; // NOLINT(runtime/string)
1616

1717
class EnvironmentTest : public EnvironmentTestFixture {
1818
private:
19-
virtual void TearDown() {
19+
void TearDown() override {
2020
NodeTestFixture::TearDown();
2121
called_cb_1 = false;
2222
called_cb_2 = false;

test/cctest/test_inspector_socket.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class TestInspectorDelegate : public InspectorSocket::Delegate {
107107
handshake_delegate_(stop_if_stop_path),
108108
fail_on_ws_frame_(false) { }
109109

110-
~TestInspectorDelegate() {
110+
~TestInspectorDelegate() override {
111111
assert_is_delegate(this);
112112
delegate = nullptr;
113113
}
@@ -353,7 +353,7 @@ static void on_connection(uv_connect_t* connect, int status) {
353353

354354
class InspectorSocketTest : public ::testing::Test {
355355
protected:
356-
virtual void SetUp() {
356+
void SetUp() override {
357357
connected = false;
358358
GTEST_ASSERT_EQ(0, uv_loop_init(&loop));
359359
server = uv_tcp_t();
@@ -375,7 +375,7 @@ class InspectorSocketTest : public ::testing::Test {
375375
really_close(reinterpret_cast<uv_handle_t*>(&server));
376376
}
377377

378-
virtual void TearDown() {
378+
void TearDown() override {
379379
really_close(reinterpret_cast<uv_handle_t*>(&client_socket));
380380
SPIN_WHILE(delegate != nullptr);
381381
const int err = uv_loop_close(&loop);

test/cctest/test_inspector_socket_server.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class TestSocketServerDelegate : public SocketServerDelegate {
305305
targets_(target_ids),
306306
session_id_(0) {}
307307

308-
~TestSocketServerDelegate() {
308+
~TestSocketServerDelegate() override {
309309
harness_->Done();
310310
}
311311

0 commit comments

Comments
 (0)