Skip to content

Commit 5f866d0

Browse files
Michael Liufacebook-github-bot
authored andcommitted
Apply modernize-use-override (2nd iteration)
Summary: Use C++11’s override and remove virtual where applicable. Change are automatically generated. Reviewed By: Orvid Differential Revision: D14086124 fbshipit-source-id: 2005227d095d776ca3b4309a57f54e25782b9b58
1 parent f1da989 commit 5f866d0

28 files changed

+66
-56
lines changed

c10/test/util/intrusive_ptr_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DestructableMock : public intrusive_ptr_target {
4545
DestructableMock(bool* resourcesReleased, bool* wasDestructed)
4646
: resourcesReleased_(resourcesReleased), wasDestructed_(wasDestructed) {}
4747

48-
~DestructableMock() {
48+
~DestructableMock() override {
4949
*wasDestructed_ = true;
5050
}
5151

caffe2/contrib/prof/cuda_profile_ops.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class CudaProfileInitializeOp : public OperatorBase {
5151
}
5252
}
5353

54-
~CudaProfileInitializeOp() {
54+
~CudaProfileInitializeOp() override {
5555
unlink(config_.c_str());
5656
}
5757

58-
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
58+
bool Run(int /* unused */ /*stream_id*/ = 0) override {
5959
// If this fails, check the contents of "output" for hints.
6060
CUDA_CHECK(
6161
cudaProfilerInitialize(config_.c_str(), output_.c_str(), cudaCSV));
@@ -72,7 +72,7 @@ class CudaProfileStartOp : public OperatorBase {
7272
CudaProfileStartOp(const OperatorDef& operator_def, Workspace* ws)
7373
: OperatorBase(operator_def, ws) {}
7474

75-
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
75+
bool Run(int /* unused */ /*stream_id*/ = 0) override {
7676
CUDA_ENFORCE(cudaProfilerStart());
7777
return true;
7878
}
@@ -83,7 +83,7 @@ class CudaProfileStopOp : public OperatorBase {
8383
CudaProfileStopOp(const OperatorDef& operator_def, Workspace* ws)
8484
: OperatorBase(operator_def, ws) {}
8585

86-
virtual bool Run(int /* unused */ /*stream_id*/ = 0) {
86+
bool Run(int /* unused */ /*stream_id*/ = 0) override {
8787
CUDA_ENFORCE(cudaProfilerStop());
8888
return true;
8989
}

caffe2/core/blob_serialization.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace caffe2 {
3131
class StringSerializer : public BlobSerializerBase {
3232
public:
3333
StringSerializer() {}
34-
~StringSerializer() {}
34+
~StringSerializer() override {}
3535
/**
3636
* Serializes a Blob. Note that this blob has to contain Tensor,
3737
* otherwise this function produces a fatal error.

caffe2/core/blob_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CAFFE_KNOWN_TYPE(BlobTestNonDefaultConstructible);
4545
class BlobTestFooSerializer : public BlobSerializerBase {
4646
public:
4747
BlobTestFooSerializer() {}
48-
~BlobTestFooSerializer() {}
48+
~BlobTestFooSerializer() override {}
4949
/**
5050
* Serializes a Blob. Note that this blob has to contain Tensor,
5151
* otherwise this function produces a fatal error.
@@ -792,7 +792,7 @@ class VectorCursor : public db::Cursor {
792792
explicit VectorCursor(StringMap* data) : data_(data) {
793793
pos_ = 0;
794794
}
795-
~VectorCursor() {}
795+
~VectorCursor() override {}
796796
void Seek(const string& /* unused */) override {}
797797
void SeekToFirst() override {}
798798
void Next() override {
@@ -817,7 +817,7 @@ class VectorDB : public db::DB {
817817
public:
818818
VectorDB(const string& source, db::Mode mode)
819819
: DB(source, mode), name_(source) {}
820-
~VectorDB() {
820+
~VectorDB() override {
821821
data_.erase(name_);
822822
}
823823
void Close() override {}
@@ -949,7 +949,7 @@ struct DummyType {
949949
class DummyTypeSerializer : public BlobSerializerBase {
950950
public:
951951
DummyTypeSerializer() {}
952-
~DummyTypeSerializer() {}
952+
~DummyTypeSerializer() override {}
953953
void Serialize(
954954
const void* pointer,
955955
TypeMeta typeMeta,

caffe2/core/db.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MiniDBCursor : public Cursor {
2626
// We call Next() to read in the first entry.
2727
Next();
2828
}
29-
~MiniDBCursor() {}
29+
~MiniDBCursor() override {}
3030

3131
void Seek(const string& /*key*/) override {
3232
LOG(FATAL) << "MiniDB does not support seeking to a specific key.";
@@ -93,7 +93,7 @@ class MiniDBTransaction : public Transaction {
9393
public:
9494
explicit MiniDBTransaction(FILE* f, std::mutex* mutex)
9595
: file_(f), lock_(*mutex) {}
96-
~MiniDBTransaction() {
96+
~MiniDBTransaction() override {
9797
Commit();
9898
}
9999

@@ -140,7 +140,9 @@ class MiniDB : public DB {
140140
CAFFE_ENFORCE(file_, "Cannot open file: " + source);
141141
VLOG(1) << "Opened MiniDB " << source;
142142
}
143-
~MiniDB() { Close(); }
143+
~MiniDB() override {
144+
Close();
145+
}
144146

145147
void Close() override {
146148
if (file_) {

caffe2/core/net_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ class AsyncErrorOp final : public Operator<CPUContext> {
844844
return true;
845845
}
846846

847-
~AsyncErrorOp() {
847+
~AsyncErrorOp() override {
848848
if (thread_) {
849849
thread_->join();
850850
}
@@ -989,7 +989,7 @@ class SyncErrorOp final : public Operator<CPUContext> {
989989
}
990990
}
991991

992-
~SyncErrorOp() {}
992+
~SyncErrorOp() override {}
993993

994994
private:
995995
bool fail_;

caffe2/core/nomscheduler/tests/SchedulerTest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ SchedulerInput loadSchedulerInputFromString(const std::string& fileInput) {
9494
// constraints.
9595
class SimpleScheduler : Scheduler {
9696
public:
97-
virtual SchedulerOutput schedule(const SchedulerInput& input) override {
97+
SchedulerOutput schedule(const SchedulerInput& input) override {
9898
int numTasks = input.getNumberOfTasks();
9999
SchedulerOutput result(numTasks);
100100

caffe2/core/observer_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DummyObserver final : public ObserverBase<T> {
2020
void Start() override;
2121
void Stop() override;
2222

23-
~DummyObserver() {}
23+
~DummyObserver() override {}
2424
};
2525

2626
template <>

caffe2/cuda_rtc/elemenntwise_rtc_gpu.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ElementwiseRTCOp final : public Operator<CUDAContext> {
8080
CAFFE_ENFORCE(src.size(), "Op should have a non-zero source code size.");
8181
func_.Compile(InputSize(), OutputSize(), src);
8282
}
83-
~ElementwiseRTCOp() {}
83+
~ElementwiseRTCOp() override {}
8484

8585
bool RunOnDevice() override {
8686
static_assert(sizeof(void*) == sizeof(size_t),

caffe2/cuda_rtc/pool_op_rtc_gpu.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class MaxPoolRTCOp final : public ConvPoolOpBase<CUDAContext> {
192192
CAFFE_ENFORCE_EQ(
193193
order_, StorageOrder::NCHW, "Currently only NCHW is supported.");
194194
}
195-
~MaxPoolRTCOp() {}
195+
~MaxPoolRTCOp() override {}
196196

197197
bool RunOnDeviceWithOrderNCHW() override {
198198
auto& X = Input(0);
@@ -250,7 +250,7 @@ class MaxPoolGradientRTCOp final : public ConvPoolOpBase<CUDAContext> {
250250
CAFFE_ENFORCE_EQ(
251251
order_, StorageOrder::NCHW, "Currently only NCHW is supported.");
252252
}
253-
~MaxPoolGradientRTCOp() {}
253+
~MaxPoolGradientRTCOp() override {}
254254

255255
bool RunOnDeviceWithOrderNCHW() override {
256256
auto& X = Input(0);

0 commit comments

Comments
 (0)