Skip to content

Commit 9f5800a

Browse files
committed
src: mark virtual functions with override keyword
Add `override` keywords where appropriate. Makes maintenance easier because the compiler will shout at you when a base class changes in an incompatible way.
1 parent b33a87d commit 9f5800a

File tree

9 files changed

+43
-43
lines changed

9 files changed

+43
-43
lines changed

src/cares_wrap.cc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class QueryWrap : public AsyncWrap {
231231
: AsyncWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_CARES) {
232232
}
233233

234-
virtual ~QueryWrap() {
234+
virtual ~QueryWrap() override {
235235
CHECK_EQ(false, persistent().IsEmpty());
236236
persistent().Reset();
237237
}
@@ -358,7 +358,7 @@ class QueryAWrap: public QueryWrap {
358358
: QueryWrap(env, req_wrap_obj) {
359359
}
360360

361-
int Send(const char* name) {
361+
int Send(const char* name) override {
362362
ares_query(env()->cares_channel(),
363363
name,
364364
ns_c_in,
@@ -369,7 +369,7 @@ class QueryAWrap: public QueryWrap {
369369
}
370370

371371
protected:
372-
void Parse(unsigned char* buf, int len) {
372+
void Parse(unsigned char* buf, int len) override {
373373
HandleScope handle_scope(env()->isolate());
374374
Context::Scope context_scope(env()->context());
375375

@@ -395,7 +395,7 @@ class QueryAaaaWrap: public QueryWrap {
395395
: QueryWrap(env, req_wrap_obj) {
396396
}
397397

398-
int Send(const char* name) {
398+
int Send(const char* name) override {
399399
ares_query(env()->cares_channel(),
400400
name,
401401
ns_c_in,
@@ -406,7 +406,7 @@ class QueryAaaaWrap: public QueryWrap {
406406
}
407407

408408
protected:
409-
void Parse(unsigned char* buf, int len) {
409+
void Parse(unsigned char* buf, int len) override {
410410
HandleScope handle_scope(env()->isolate());
411411
Context::Scope context_scope(env()->context());
412412

@@ -432,7 +432,7 @@ class QueryCnameWrap: public QueryWrap {
432432
: QueryWrap(env, req_wrap_obj) {
433433
}
434434

435-
int Send(const char* name) {
435+
int Send(const char* name) override {
436436
ares_query(env()->cares_channel(),
437437
name,
438438
ns_c_in,
@@ -443,7 +443,7 @@ class QueryCnameWrap: public QueryWrap {
443443
}
444444

445445
protected:
446-
void Parse(unsigned char* buf, int len) {
446+
void Parse(unsigned char* buf, int len) override {
447447
HandleScope handle_scope(env()->isolate());
448448
Context::Scope context_scope(env()->context());
449449
struct hostent* host;
@@ -471,7 +471,7 @@ class QueryMxWrap: public QueryWrap {
471471
: QueryWrap(env, req_wrap_obj) {
472472
}
473473

474-
int Send(const char* name) {
474+
int Send(const char* name) override {
475475
ares_query(env()->cares_channel(),
476476
name,
477477
ns_c_in,
@@ -482,7 +482,7 @@ class QueryMxWrap: public QueryWrap {
482482
}
483483

484484
protected:
485-
void Parse(unsigned char* buf, int len) {
485+
void Parse(unsigned char* buf, int len) override {
486486
HandleScope handle_scope(env()->isolate());
487487
Context::Scope context_scope(env()->context());
488488

@@ -520,7 +520,7 @@ class QueryNsWrap: public QueryWrap {
520520
: QueryWrap(env, req_wrap_obj) {
521521
}
522522

523-
int Send(const char* name) {
523+
int Send(const char* name) override {
524524
ares_query(env()->cares_channel(),
525525
name,
526526
ns_c_in,
@@ -531,7 +531,7 @@ class QueryNsWrap: public QueryWrap {
531531
}
532532

533533
protected:
534-
void Parse(unsigned char* buf, int len) {
534+
void Parse(unsigned char* buf, int len) override {
535535
HandleScope handle_scope(env()->isolate());
536536
Context::Scope context_scope(env()->context());
537537
struct hostent* host;
@@ -556,7 +556,7 @@ class QueryTxtWrap: public QueryWrap {
556556
: QueryWrap(env, req_wrap_obj) {
557557
}
558558

559-
int Send(const char* name) {
559+
int Send(const char* name) override {
560560
ares_query(env()->cares_channel(),
561561
name,
562562
ns_c_in,
@@ -567,7 +567,7 @@ class QueryTxtWrap: public QueryWrap {
567567
}
568568

569569
protected:
570-
void Parse(unsigned char* buf, int len) {
570+
void Parse(unsigned char* buf, int len) override {
571571
HandleScope handle_scope(env()->isolate());
572572
Context::Scope context_scope(env()->context());
573573
struct ares_txt_reply* txt_out;
@@ -610,7 +610,7 @@ class QuerySrvWrap: public QueryWrap {
610610
: QueryWrap(env, req_wrap_obj) {
611611
}
612612

613-
int Send(const char* name) {
613+
int Send(const char* name) override {
614614
ares_query(env()->cares_channel(),
615615
name,
616616
ns_c_in,
@@ -621,7 +621,7 @@ class QuerySrvWrap: public QueryWrap {
621621
}
622622

623623
protected:
624-
void Parse(unsigned char* buf, int len) {
624+
void Parse(unsigned char* buf, int len) override {
625625
HandleScope handle_scope(env()->isolate());
626626
Context::Scope context_scope(env()->context());
627627

@@ -664,7 +664,7 @@ class QueryNaptrWrap: public QueryWrap {
664664
: QueryWrap(env, req_wrap_obj) {
665665
}
666666

667-
int Send(const char* name) {
667+
int Send(const char* name) override {
668668
ares_query(env()->cares_channel(),
669669
name,
670670
ns_c_in,
@@ -675,7 +675,7 @@ class QueryNaptrWrap: public QueryWrap {
675675
}
676676

677677
protected:
678-
void Parse(unsigned char* buf, int len) {
678+
void Parse(unsigned char* buf, int len) override {
679679
HandleScope handle_scope(env()->isolate());
680680
Context::Scope context_scope(env()->context());
681681

@@ -726,7 +726,7 @@ class QuerySoaWrap: public QueryWrap {
726726
: QueryWrap(env, req_wrap_obj) {
727727
}
728728

729-
int Send(const char* name) {
729+
int Send(const char* name) override {
730730
ares_query(env()->cares_channel(),
731731
name,
732732
ns_c_in,
@@ -737,7 +737,7 @@ class QuerySoaWrap: public QueryWrap {
737737
}
738738

739739
protected:
740-
void Parse(unsigned char* buf, int len) {
740+
void Parse(unsigned char* buf, int len) override {
741741
HandleScope handle_scope(env()->isolate());
742742
Context::Scope context_scope(env()->context());
743743

@@ -779,7 +779,7 @@ class GetHostByAddrWrap: public QueryWrap {
779779
: QueryWrap(env, req_wrap_obj) {
780780
}
781781

782-
int Send(const char* name) {
782+
int Send(const char* name) override {
783783
int length, family;
784784
char address_buffer[sizeof(struct in6_addr)];
785785

@@ -803,7 +803,7 @@ class GetHostByAddrWrap: public QueryWrap {
803803
}
804804

805805
protected:
806-
void Parse(struct hostent* host) {
806+
void Parse(struct hostent* host) override {
807807
HandleScope handle_scope(env()->isolate());
808808
Context::Scope context_scope(env()->context());
809809
this->CallOnComplete(HostentToNames(env(), host));
@@ -817,7 +817,7 @@ class GetHostByNameWrap: public QueryWrap {
817817
: QueryWrap(env, req_wrap_obj) {
818818
}
819819

820-
int Send(const char* name, int family) {
820+
int Send(const char* name, int family) override {
821821
ares_gethostbyname(env()->cares_channel(),
822822
name,
823823
family,
@@ -827,7 +827,7 @@ class GetHostByNameWrap: public QueryWrap {
827827
}
828828

829829
protected:
830-
void Parse(struct hostent* host) {
830+
void Parse(struct hostent* host) override {
831831
HandleScope scope(env()->isolate());
832832

833833
Local<Array> addresses = HostentToAddresses(env(), host);

src/fs_event_wrap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FSEventWrap: public HandleWrap {
5454

5555
private:
5656
FSEventWrap(Environment* env, Handle<Object> object);
57-
virtual ~FSEventWrap();
57+
virtual ~FSEventWrap() override;
5858

5959
static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
6060
int status);

src/handle_wrap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class HandleWrap : public AsyncWrap {
6464
v8::Handle<v8::Object> object,
6565
uv_handle_t* handle,
6666
AsyncWrap::ProviderType provider);
67-
virtual ~HandleWrap();
67+
virtual ~HandleWrap() override;
6868

6969
private:
7070
friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&);

src/node.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ class ArrayBufferAllocator : public ArrayBuffer::Allocator {
160160
static const size_t kMaxLength = 0x3fffffff;
161161
static ArrayBufferAllocator the_singleton;
162162
virtual ~ArrayBufferAllocator() {}
163-
virtual void* Allocate(size_t length);
164-
virtual void* AllocateUninitialized(size_t length);
165-
virtual void Free(void* data, size_t length);
163+
virtual void* Allocate(size_t length) override;
164+
virtual void* AllocateUninitialized(size_t length) override;
165+
virtual void Free(void* data, size_t length) override;
166166
private:
167167
ArrayBufferAllocator() {}
168168
ArrayBufferAllocator(const ArrayBufferAllocator&);

src/node_stat_watcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace node {
3232

3333
class StatWatcher : public AsyncWrap {
3434
public:
35-
virtual ~StatWatcher();
35+
virtual ~StatWatcher() override;
3636

3737
static void Initialize(Environment* env, v8::Handle<v8::Object> target);
3838

src/node_v8_platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TaskQueue {
5151
class Platform : public v8::Platform {
5252
public:
5353
explicit Platform(unsigned int worker_count);
54-
~Platform();
54+
virtual ~Platform() override;
5555

5656
void CallOnBackgroundThread(v8::Task* task,
5757
ExpectedRuntime expected_runtime);

src/smalloc.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,11 @@ class RetainedAllocInfo: public RetainedObjectInfo {
473473
public:
474474
explicit RetainedAllocInfo(Handle<Value> wrapper);
475475

476-
virtual void Dispose();
477-
virtual bool IsEquivalent(RetainedObjectInfo* other);
478-
virtual intptr_t GetHash();
479-
virtual const char* GetLabel();
480-
virtual intptr_t GetSizeInBytes();
476+
virtual void Dispose() override;
477+
virtual bool IsEquivalent(RetainedObjectInfo* other) override;
478+
virtual intptr_t GetHash() override;
479+
virtual const char* GetLabel() override;
480+
virtual intptr_t GetSizeInBytes() override;
481481

482482
private:
483483
static const char label_[];

src/tls_wrap.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ class TLSCallbacks : public crypto::SSLWrap<TLSCallbacks>,
5252
v8::Handle<v8::Value> unused,
5353
v8::Handle<v8::Context> context);
5454

55-
const char* Error();
56-
int TryWrite(uv_buf_t** bufs, size_t* count);
55+
const char* Error() override;
56+
int TryWrite(uv_buf_t** bufs, size_t* count) override;
5757
int DoWrite(WriteWrap* w,
5858
uv_buf_t* bufs,
5959
size_t count,
6060
uv_stream_t* send_handle,
61-
uv_write_cb cb);
62-
void AfterWrite(WriteWrap* w);
61+
uv_write_cb cb) override;
62+
void AfterWrite(WriteWrap* w) override;
6363
void DoAlloc(uv_handle_t* handle,
6464
size_t suggested_size,
65-
uv_buf_t* buf);
65+
uv_buf_t* buf) override;
6666
void DoRead(uv_stream_t* handle,
6767
ssize_t nread,
6868
const uv_buf_t* buf,
69-
uv_handle_type pending);
70-
int DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb);
69+
uv_handle_type pending) override;
70+
int DoShutdown(ShutdownWrap* req_wrap, uv_shutdown_cb cb) override;
7171

7272
void NewSessionDoneCb();
7373

src/udp_wrap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class UDPWrap: public HandleWrap {
5858

5959
private:
6060
UDPWrap(Environment* env, v8::Handle<v8::Object> object);
61-
virtual ~UDPWrap();
61+
virtual ~UDPWrap() override;
6262

6363
static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,
6464
int family);

0 commit comments

Comments
 (0)