Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] NO.6 enable modernize-avoid-c-arrays check #55774

5 changes: 0 additions & 5 deletions paddle/ir/core/builtin_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

namespace ir {

const char *ModuleOp::attributes_name[attributes_num] = {"program"};

Program *ModuleOp::program() {
const AttributeMap &attr = this->attributes();
auto iter = attr.find("program");
Expand Down Expand Up @@ -67,9 +65,6 @@ void ModuleOp::Verify() const {
IR_ENFORCE(num_results() == 0u, "The size of inputs must be equal to 0.");
}

const char *GetParameterOp::attributes_name[attributes_num] = {
"parameter_name"};

void GetParameterOp::Build(Builder &builder,
OperationArgument &argument,
const std::string &name,
Expand Down
4 changes: 2 additions & 2 deletions paddle/ir/core/builtin_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class IR_API ModuleOp : public ir::Op<ModuleOp> {
using Op::Op;
static const char *name() { return "builtin.module"; }
static constexpr uint32_t attributes_num = 1;
static const char *attributes_name[attributes_num];
const std::array<char *, attributes_num> attributes_name = {"program"};
void Verify() const;
Program *program();
Block *block();
Expand All @@ -50,7 +50,7 @@ class IR_API GetParameterOp : public ir::Op<GetParameterOp> {
using Op::Op;
static const char *name() { return "builtin.get_parameter"; }
static constexpr uint32_t attributes_num = 1;
static const char *attributes_name[attributes_num];
const std::array<char *, attributes_num> attributes_name = {"parameter_name"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我们是必须要设定为 static,不建议修改

static void Build(Builder &builder, // NOLINT
OperationArgument &argument, // NOLINT
const std::string &name,
Expand Down
2 changes: 1 addition & 1 deletion paddle/utils/string/pretty_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "gflags/gflags.h"

DEFINE_bool(color, true, "Whether to turn on pretty log");
DEFINE_bool(color, true, "Whether to turn on pretty log"); // NOLINT

namespace paddle {
namespace string {} // namespace string
Expand Down