Skip to content

Commit cac7aab

Browse files
committed
Apply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)
1 parent d1b63c6 commit cac7aab

File tree

22 files changed

+134
-138
lines changed

22 files changed

+134
-138
lines changed

mlir/examples/toy/Ch1/include/toy/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6262

6363
/// Expression class for numeric literals like "1.0".
6464
class NumberExprAST : public ExprAST {
65-
double Val;
65+
double val;
6666

6767
public:
6868
NumberExprAST(Location loc, double val)
69-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
69+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7070

71-
double getValue() { return Val; }
71+
double getValue() { return val; }
7272

7373
/// LLVM style RTTI
7474
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -154,9 +154,9 @@ class BinaryExprAST : public ExprAST {
154154
ExprAST *getLHS() { return lhs.get(); }
155155
ExprAST *getRHS() { return rhs.get(); }
156156

157-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
157+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
158158
std::unique_ptr<ExprAST> rhs)
159-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
159+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
160160
rhs(std::move(rhs)) {}
161161

162162
/// LLVM style RTTI

mlir/examples/toy/Ch2/include/toy/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6262

6363
/// Expression class for numeric literals like "1.0".
6464
class NumberExprAST : public ExprAST {
65-
double Val;
65+
double val;
6666

6767
public:
6868
NumberExprAST(Location loc, double val)
69-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
69+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7070

71-
double getValue() { return Val; }
71+
double getValue() { return val; }
7272

7373
/// LLVM style RTTI
7474
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -154,9 +154,9 @@ class BinaryExprAST : public ExprAST {
154154
ExprAST *getLHS() { return lhs.get(); }
155155
ExprAST *getRHS() { return rhs.get(); }
156156

157-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
157+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
158158
std::unique_ptr<ExprAST> rhs)
159-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
159+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
160160
rhs(std::move(rhs)) {}
161161

162162
/// LLVM style RTTI

mlir/examples/toy/Ch3/include/toy/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6262

6363
/// Expression class for numeric literals like "1.0".
6464
class NumberExprAST : public ExprAST {
65-
double Val;
65+
double val;
6666

6767
public:
6868
NumberExprAST(Location loc, double val)
69-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
69+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7070

71-
double getValue() { return Val; }
71+
double getValue() { return val; }
7272

7373
/// LLVM style RTTI
7474
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -154,9 +154,9 @@ class BinaryExprAST : public ExprAST {
154154
ExprAST *getLHS() { return lhs.get(); }
155155
ExprAST *getRHS() { return rhs.get(); }
156156

157-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
157+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
158158
std::unique_ptr<ExprAST> rhs)
159-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
159+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
160160
rhs(std::move(rhs)) {}
161161

162162
/// LLVM style RTTI

mlir/examples/toy/Ch4/include/toy/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6262

6363
/// Expression class for numeric literals like "1.0".
6464
class NumberExprAST : public ExprAST {
65-
double Val;
65+
double val;
6666

6767
public:
6868
NumberExprAST(Location loc, double val)
69-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
69+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7070

71-
double getValue() { return Val; }
71+
double getValue() { return val; }
7272

7373
/// LLVM style RTTI
7474
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -154,9 +154,9 @@ class BinaryExprAST : public ExprAST {
154154
ExprAST *getLHS() { return lhs.get(); }
155155
ExprAST *getRHS() { return rhs.get(); }
156156

157-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
157+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
158158
std::unique_ptr<ExprAST> rhs)
159-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
159+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
160160
rhs(std::move(rhs)) {}
161161

162162
/// LLVM style RTTI

mlir/examples/toy/Ch5/include/toy/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6262

6363
/// Expression class for numeric literals like "1.0".
6464
class NumberExprAST : public ExprAST {
65-
double Val;
65+
double val;
6666

6767
public:
6868
NumberExprAST(Location loc, double val)
69-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
69+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7070

71-
double getValue() { return Val; }
71+
double getValue() { return val; }
7272

7373
/// LLVM style RTTI
7474
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -154,9 +154,9 @@ class BinaryExprAST : public ExprAST {
154154
ExprAST *getLHS() { return lhs.get(); }
155155
ExprAST *getRHS() { return rhs.get(); }
156156

157-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
157+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
158158
std::unique_ptr<ExprAST> rhs)
159-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
159+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
160160
rhs(std::move(rhs)) {}
161161

162162
/// LLVM style RTTI

mlir/examples/toy/Ch6/include/toy/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6262

6363
/// Expression class for numeric literals like "1.0".
6464
class NumberExprAST : public ExprAST {
65-
double Val;
65+
double val;
6666

6767
public:
6868
NumberExprAST(Location loc, double val)
69-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
69+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7070

71-
double getValue() { return Val; }
71+
double getValue() { return val; }
7272

7373
/// LLVM style RTTI
7474
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -154,9 +154,9 @@ class BinaryExprAST : public ExprAST {
154154
ExprAST *getLHS() { return lhs.get(); }
155155
ExprAST *getRHS() { return rhs.get(); }
156156

157-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
157+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
158158
std::unique_ptr<ExprAST> rhs)
159-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
159+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
160160
rhs(std::move(rhs)) {}
161161

162162
/// LLVM style RTTI

mlir/examples/toy/Ch7/include/toy/AST.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;
6464

6565
/// Expression class for numeric literals like "1.0".
6666
class NumberExprAST : public ExprAST {
67-
double Val;
67+
double val;
6868

6969
public:
7070
NumberExprAST(Location loc, double val)
71-
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
71+
: ExprAST(Expr_Num, std::move(loc)), val(val) {}
7272

73-
double getValue() { return Val; }
73+
double getValue() { return val; }
7474

7575
/// LLVM style RTTI
7676
static bool classof(const ExprAST *c) { return c->getKind() == Expr_Num; }
@@ -174,9 +174,9 @@ class BinaryExprAST : public ExprAST {
174174
ExprAST *getLHS() { return lhs.get(); }
175175
ExprAST *getRHS() { return rhs.get(); }
176176

177-
BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
177+
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
178178
std::unique_ptr<ExprAST> rhs)
179-
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
179+
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
180180
rhs(std::move(rhs)) {}
181181

182182
/// LLVM style RTTI
@@ -264,8 +264,8 @@ class FunctionAST : public RecordAST {
264264
ExprASTList *getBody() { return body.get(); }
265265

266266
/// LLVM style RTTI
267-
static bool classof(const RecordAST *R) {
268-
return R->getKind() == Record_Function;
267+
static bool classof(const RecordAST *r) {
268+
return r->getKind() == Record_Function;
269269
}
270270
};
271271

@@ -288,8 +288,8 @@ class StructAST : public RecordAST {
288288
}
289289

290290
/// LLVM style RTTI
291-
static bool classof(const RecordAST *R) {
292-
return R->getKind() == Record_Struct;
291+
static bool classof(const RecordAST *r) {
292+
return r->getKind() == Record_Struct;
293293
}
294294
};
295295

mlir/include/mlir/Analysis/Utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ LogicalResult boundCheckLoadOrStoreOp(LoadOrStoreOpPointer loadOrStoreOp,
362362
bool emitError = true);
363363

364364
/// Returns the number of surrounding loops common to both A and B.
365-
unsigned getNumCommonSurroundingLoops(Operation &A, Operation &B);
365+
unsigned getNumCommonSurroundingLoops(Operation &a, Operation &b);
366366

367367
/// Gets the memory footprint of all data touched in the specified memory space
368368
/// in bytes; if the memory space is unspecified, considers all memory spaces.

mlir/include/mlir/Dialect/Affine/IR/AffineOps.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ class AffineBound {
440440
using operand_iterator = AffineForOp::operand_iterator;
441441
using operand_range = AffineForOp::operand_range;
442442

443-
operand_iterator operand_begin() { return op.operand_begin() + opStart; }
444-
operand_iterator operand_end() { return op.operand_begin() + opEnd; }
445-
operand_range getOperands() { return {operand_begin(), operand_end()}; }
443+
operand_iterator operandBegin() { return op.operand_begin() + opStart; }
444+
operand_iterator operandEnd() { return op.operand_begin() + opEnd; }
445+
operand_range getOperands() { return {operandBegin(), operandEnd()}; }
446446

447447
private:
448448
// 'affine.for' operation that contains this bound.

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ namespace llvm {
4545
template <>
4646
struct PointerLikeTypeTraits<mlir::spirv::FuncOp> {
4747
public:
48-
static inline void *getAsVoidPointer(mlir::spirv::FuncOp I) {
49-
return const_cast<void *>(I.getAsOpaquePointer());
48+
static inline void *getAsVoidPointer(mlir::spirv::FuncOp i) {
49+
return const_cast<void *>(i.getAsOpaquePointer());
5050
}
51-
static inline mlir::spirv::FuncOp getFromVoidPointer(void *P) {
52-
return mlir::spirv::FuncOp::getFromOpaquePointer(P);
51+
static inline mlir::spirv::FuncOp getFromVoidPointer(void *p) {
52+
return mlir::spirv::FuncOp::getFromOpaquePointer(p);
5353
}
54-
static constexpr int NumLowBitsAvailable = 3;
54+
static constexpr int numLowBitsAvailable = 3;
5555
};
5656

5757
} // namespace llvm

mlir/include/mlir/ExecutionEngine/CRunnerUtils.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
namespace mlir {
4444
namespace detail {
4545

46-
constexpr bool isPowerOf2(int N) { return (!(N & (N - 1))); }
46+
constexpr bool isPowerOf2(int n) { return (!(n & (n - 1))); }
4747

48-
constexpr unsigned nextPowerOf2(int N) {
49-
return (N <= 1) ? 1 : (isPowerOf2(N) ? N : (2 * nextPowerOf2((N + 1) / 2)));
48+
constexpr unsigned nextPowerOf2(int n) {
49+
return (n <= 1) ? 1 : (isPowerOf2(n) ? n : (2 * nextPowerOf2((n + 1) / 2)));
5050
}
5151

5252
template <typename T, int Dim, bool IsPowerOf2>
@@ -305,17 +305,16 @@ struct UnrankedMemRefType {
305305
template <typename T>
306306
class DynamicMemRefType {
307307
public:
308-
explicit DynamicMemRefType(const StridedMemRefType<T, 0> &mem_ref)
309-
: rank(0), basePtr(mem_ref.basePtr), data(mem_ref.data),
310-
offset(mem_ref.offset), sizes(nullptr), strides(nullptr) {}
308+
explicit DynamicMemRefType(const StridedMemRefType<T, 0> &memRef)
309+
: rank(0), basePtr(memRef.basePtr), data(memRef.data),
310+
offset(memRef.offset), sizes(nullptr), strides(nullptr) {}
311311
template <int N>
312-
explicit DynamicMemRefType(const StridedMemRefType<T, N> &mem_ref)
313-
: rank(N), basePtr(mem_ref.basePtr), data(mem_ref.data),
314-
offset(mem_ref.offset), sizes(mem_ref.sizes), strides(mem_ref.strides) {
315-
}
316-
explicit DynamicMemRefType(const UnrankedMemRefType<T> &mem_ref)
317-
: rank(mem_ref.rank) {
318-
auto *desc = static_cast<StridedMemRefType<T, 1> *>(mem_ref.descriptor);
312+
explicit DynamicMemRefType(const StridedMemRefType<T, N> &memRef)
313+
: rank(N), basePtr(memRef.basePtr), data(memRef.data),
314+
offset(memRef.offset), sizes(memRef.sizes), strides(memRef.strides) {}
315+
explicit DynamicMemRefType(const UnrankedMemRefType<T> &memRef)
316+
: rank(memRef.rank) {
317+
auto *desc = static_cast<StridedMemRefType<T, 1> *>(memRef.descriptor);
319318
basePtr = desc->basePtr;
320319
data = desc->data;
321320
offset = desc->offset;
@@ -353,7 +352,7 @@ extern "C" MLIR_CRUNNERUTILS_EXPORT void printNewline();
353352
//===----------------------------------------------------------------------===//
354353
// Small runtime support library for timing execution and printing GFLOPS
355354
//===----------------------------------------------------------------------===//
356-
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_flops(double flops);
355+
extern "C" MLIR_CRUNNERUTILS_EXPORT void printFlops(double flops);
357356
extern "C" MLIR_CRUNNERUTILS_EXPORT double rtclock();
358357

359358
#endif // MLIR_EXECUTIONENGINE_CRUNNERUTILS_H

mlir/include/mlir/ExecutionEngine/ExecutionEngine.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class ModuleOp;
3737
/// A simple object cache following Lang's LLJITWithObjectCache example.
3838
class SimpleObjectCache : public llvm::ObjectCache {
3939
public:
40-
void notifyObjectCompiled(const llvm::Module *M,
41-
llvm::MemoryBufferRef ObjBuffer) override;
42-
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module *M) override;
40+
void notifyObjectCompiled(const llvm::Module *m,
41+
llvm::MemoryBufferRef objBuffer) override;
42+
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module *m) override;
4343

4444
/// Dump cached object to output file `filename`.
4545
void dumpToObjectFile(StringRef filename);

0 commit comments

Comments
 (0)