Skip to content

Commit 600c058

Browse files
authored
[clang-tidy] NO.17 enable cppcoreguidelines-explicit-virtual-functions,modernize-use-override (#61714)
* clangtidy 17 * fix
1 parent 7a0807f commit 600c058

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

paddle/fluid/framework/details/graph_test_base.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DummyOp : public OperatorBase {
4444

4545
class SumOpMaker : public OpProtoAndCheckerMaker {
4646
public:
47-
void Make() {
47+
void Make() override {
4848
AddInput("X", "").AsDuplicable();
4949
AddOutput("Out", "");
5050
AddComment("");
@@ -53,7 +53,7 @@ class SumOpMaker : public OpProtoAndCheckerMaker {
5353

5454
class AssignOpMaker : public OpProtoAndCheckerMaker {
5555
public:
56-
void Make() {
56+
void Make() override {
5757
AddInput("X", "").AsDuplicable();
5858
AddOutput("Out", "");
5959
AddComment("");
@@ -62,7 +62,7 @@ class AssignOpMaker : public OpProtoAndCheckerMaker {
6262

6363
class SplitOpMaker : public OpProtoAndCheckerMaker {
6464
public:
65-
void Make() {
65+
void Make() override {
6666
AddInput("X", "");
6767
AddOutput("Out", "").AsDuplicable();
6868
AddComment("");

paddle/fluid/framework/ir/graph_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class NOP : public OperatorBase {
3838

3939
class SumOpMaker : public OpProtoAndCheckerMaker {
4040
public:
41-
void Make() {
41+
void Make() override {
4242
AddInput("X", "").AsDuplicable();
4343
AddOutput("Out", "").AsDuplicable();
4444
AddComment("");
@@ -60,7 +60,7 @@ class SumOpVarTypeInference : public VarTypeInference {
6060

6161
class DummyOpMaker : public OpProtoAndCheckerMaker {
6262
public:
63-
void Make() {
63+
void Make() override {
6464
AddInput("X", "").AsDuplicable();
6565
AddOutput("Out", "").AsDuplicable();
6666
AddComment("");

paddle/fluid/framework/ir/pass_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void BuildCircleGraph(Graph* g) {
4343

4444
class TestPass : public Pass {
4545
protected:
46-
void ApplyImpl(ir::Graph* graph) const {
46+
void ApplyImpl(ir::Graph* graph) const override {
4747
graph->Set<int>("copy_test_pass_attr", new int);
4848
graph->Set<int>("copy_test_graph_attr", new int);
4949

@@ -226,7 +226,7 @@ TEST(PassTest, TestPassAttrCheckConvertAllBlocks) {
226226

227227
class TestPassWithDefault : public Pass {
228228
protected:
229-
void ApplyImpl(ir::Graph* graph) const {
229+
void ApplyImpl(ir::Graph* graph) const override {
230230
graph->Set<int>("copy_default_attr", new int);
231231

232232
int test_pass_attr = this->Get<int>("default_attr");

paddle/fluid/ir_adaptor/translator/op_translator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2722,7 +2722,7 @@ struct RandIntOpTranscriber : public OpTranscriber {
27222722
std::tuple<OpOutputTypeList, OpOutputMapping> GenerateOperationOutput(
27232723
pir::IrContext* ctx,
27242724
const OpDesc& op_desc,
2725-
const OpOutputInfoList& output_infos) {
2725+
const OpOutputInfoList& output_infos) override {
27262726
OpOutputMapping arg_to_idx;
27272727
OpOutputTypeList op_output_types = {};
27282728

test/cpp/fluid/framework/op_proto_maker_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ limitations under the License. */
2121

2222
class TestAttrProtoMaker : public paddle::framework::OpProtoAndCheckerMaker {
2323
public:
24-
void Make() {
24+
void Make() override {
2525
AddAttr<float>("scale", "scale of test op");
2626
AddAttr<float>("scale", "scale of test op");
2727
}
@@ -37,7 +37,7 @@ TEST(ProtoMaker, DuplicatedAttr) {
3737

3838
class TestInOutProtoMaker : public paddle::framework::OpProtoAndCheckerMaker {
3939
public:
40-
void Make() {
40+
void Make() override {
4141
AddInput("input", "input of test op");
4242
AddInput("input", "input of test op");
4343
}
@@ -54,7 +54,7 @@ TEST(ProtoMaker, DuplicatedInOut) {
5454
class OpProtoMakerWithScalar
5555
: public paddle::framework::OpProtoAndCheckerMaker {
5656
public:
57-
void Make() {
57+
void Make() override {
5858
AddAttr<paddle::experimental::Scalar>("generic_scalar",
5959
"generic_scalar of test op");
6060
AddAttr<std::vector<paddle::experimental::Scalar>>(

test/cpp/fluid/framework/operator_test.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class OpWithoutKernelTest : public OperatorBase {
5151

5252
class OpWithoutKernelCheckerMaker : public OpProtoAndCheckerMaker {
5353
public:
54-
void Make() {
54+
void Make() override {
5555
AddInput("input", "input of test op");
5656
AddOutput("output", "output of test op");
5757
AddAttr<float>("scale", "scale of cosine op");
@@ -106,7 +106,7 @@ static int special_type_value = 1;
106106

107107
class OpKernelTestProtoAndCheckerMaker : public OpProtoAndCheckerMaker {
108108
public:
109-
void Make() {
109+
void Make() override {
110110
AddInput("x", "input of test op");
111111
AddOutput("y", "output of test op");
112112
AddAttr<float>("scale", "scale of cosine op")
@@ -161,7 +161,7 @@ class CPUKernel2Test : public OpKernel<float> {
161161
class OpKernelTestMultiInputsProtoAndCheckerMaker
162162
: public OpProtoAndCheckerMaker {
163163
public:
164-
void Make() {
164+
void Make() override {
165165
AddInput("xs", "inputs of test op").AsDuplicable();
166166
AddInput("k", "input of test op");
167167
AddOutput("ys", "outputs of test op").AsDuplicable();
@@ -335,7 +335,7 @@ class IndicateLoDTensorDataTypeTest : public OperatorWithKernel {
335335

336336
class IndicateLoDTensorDataTypeTestProtoMaker : public OpProtoAndCheckerMaker {
337337
public:
338-
void Make() {
338+
void Make() override {
339339
AddInput("phi::DenseTensor", "Input of phi::DenseTensor type Variable.");
340340
AddComment("This Op is only for IndicateVarDataType interface test.");
341341
}
@@ -357,7 +357,7 @@ class IndicateSelectedRowsDataTypeTest : public OperatorWithKernel {
357357
class IndicateSelectedRowsDataTypeTestProtoMaker
358358
: public OpProtoAndCheckerMaker {
359359
public:
360-
void Make() {
360+
void Make() override {
361361
AddInput("SelectedRows", "Input of SelectedRows type Variable.");
362362
AddComment("This Op is only for IndicateVarDataType interface test.");
363363
}
@@ -377,7 +377,7 @@ class IndicateOtherDataTypeTest : public OperatorWithKernel {
377377
};
378378
class IndicateOtherDataTypeTestProtoMaker : public OpProtoAndCheckerMaker {
379379
public:
380-
void Make() {
380+
void Make() override {
381381
AddInput("Other", "Input of Other type Variable");
382382
AddComment("This Op is only for IndicateVarDataType interface test.");
383383
}
@@ -512,7 +512,7 @@ class SetLoDLevelTest : public OperatorWithKernel {
512512

513513
class GetSetLoDLevelTestMaker : public OpProtoAndCheckerMaker {
514514
public:
515-
void Make() {
515+
void Make() override {
516516
AddInput("X", "(phi::DenseTensor) Input Variable.");
517517
AddOutput("Out", "(phi::DenseTensor) Output Variable.");
518518
AddComment("This Op is only for Get/SetLoDLevel interface test.");
@@ -592,7 +592,7 @@ class OpUnusedVarTest : public OperatorWithKernel {
592592

593593
class OpUnusedVarTestProtoAndCheckerMaker : public OpProtoAndCheckerMaker {
594594
public:
595-
void Make() {
595+
void Make() override {
596596
AddInput("X", "input of test op");
597597
AddOutput("Y", "output of test op");
598598
AddComment("This is test op for unused var check.");

test/cpp/fluid/framework/var_type_inference_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NOP : public OperatorBase {
4141

4242
class SumOpMaker : public OpProtoAndCheckerMaker {
4343
public:
44-
void Make() {
44+
void Make() override {
4545
AddInput("X", "").AsDuplicable();
4646
AddOutput("Out", "");
4747
AddComment("");

test/cpp/pir/core/add_dialect_parser_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TestParserDialect : public pir::Dialect {
3737

3838
static const char* name() { return "tp"; }
3939

40-
void PrintAttribute(pir::Attribute attr, std::ostream& os) const;
40+
void PrintAttribute(pir::Attribute attr, std::ostream& os) const; // NOLINT
4141

4242
pir::Attribute ParseAttribute(pir::IrParser& parser); // NOLINT
4343

0 commit comments

Comments
 (0)