Skip to content

Commit

Permalink
Apply clang-tidy fixes for readability-identifier-naming to MLIR (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
joker-eph committed Jan 14, 2022
1 parent d1b63c6 commit cac7aab
Show file tree
Hide file tree
Showing 22 changed files with 134 additions and 138 deletions.
10 changes: 5 additions & 5 deletions mlir/examples/toy/Ch1/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

/// LLVM style RTTI
Expand Down
10 changes: 5 additions & 5 deletions mlir/examples/toy/Ch2/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

/// LLVM style RTTI
Expand Down
10 changes: 5 additions & 5 deletions mlir/examples/toy/Ch3/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

/// LLVM style RTTI
Expand Down
10 changes: 5 additions & 5 deletions mlir/examples/toy/Ch4/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

/// LLVM style RTTI
Expand Down
10 changes: 5 additions & 5 deletions mlir/examples/toy/Ch5/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

/// LLVM style RTTI
Expand Down
10 changes: 5 additions & 5 deletions mlir/examples/toy/Ch6/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

/// LLVM style RTTI
Expand Down
18 changes: 9 additions & 9 deletions mlir/examples/toy/Ch7/include/toy/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ using ExprASTList = std::vector<std::unique_ptr<ExprAST>>;

/// Expression class for numeric literals like "1.0".
class NumberExprAST : public ExprAST {
double Val;
double val;

public:
NumberExprAST(Location loc, double val)
: ExprAST(Expr_Num, std::move(loc)), Val(val) {}
: ExprAST(Expr_Num, std::move(loc)), val(val) {}

double getValue() { return Val; }
double getValue() { return val; }

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

BinaryExprAST(Location loc, char Op, std::unique_ptr<ExprAST> lhs,
BinaryExprAST(Location loc, char op, std::unique_ptr<ExprAST> lhs,
std::unique_ptr<ExprAST> rhs)
: ExprAST(Expr_BinOp, std::move(loc)), op(Op), lhs(std::move(lhs)),
: ExprAST(Expr_BinOp, std::move(loc)), op(op), lhs(std::move(lhs)),
rhs(std::move(rhs)) {}

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

/// LLVM style RTTI
static bool classof(const RecordAST *R) {
return R->getKind() == Record_Function;
static bool classof(const RecordAST *r) {
return r->getKind() == Record_Function;
}
};

Expand All @@ -288,8 +288,8 @@ class StructAST : public RecordAST {
}

/// LLVM style RTTI
static bool classof(const RecordAST *R) {
return R->getKind() == Record_Struct;
static bool classof(const RecordAST *r) {
return r->getKind() == Record_Struct;
}
};

Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Analysis/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ LogicalResult boundCheckLoadOrStoreOp(LoadOrStoreOpPointer loadOrStoreOp,
bool emitError = true);

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

/// Gets the memory footprint of all data touched in the specified memory space
/// in bytes; if the memory space is unspecified, considers all memory spaces.
Expand Down
6 changes: 3 additions & 3 deletions mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ class AffineBound {
using operand_iterator = AffineForOp::operand_iterator;
using operand_range = AffineForOp::operand_range;

operand_iterator operand_begin() { return op.operand_begin() + opStart; }
operand_iterator operand_end() { return op.operand_begin() + opEnd; }
operand_range getOperands() { return {operand_begin(), operand_end()}; }
operand_iterator operandBegin() { return op.operand_begin() + opStart; }
operand_iterator operandEnd() { return op.operand_begin() + opEnd; }
operand_range getOperands() { return {operandBegin(), operandEnd()}; }

private:
// 'affine.for' operation that contains this bound.
Expand Down
10 changes: 5 additions & 5 deletions mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ namespace llvm {
template <>
struct PointerLikeTypeTraits<mlir::spirv::FuncOp> {
public:
static inline void *getAsVoidPointer(mlir::spirv::FuncOp I) {
return const_cast<void *>(I.getAsOpaquePointer());
static inline void *getAsVoidPointer(mlir::spirv::FuncOp i) {
return const_cast<void *>(i.getAsOpaquePointer());
}
static inline mlir::spirv::FuncOp getFromVoidPointer(void *P) {
return mlir::spirv::FuncOp::getFromOpaquePointer(P);
static inline mlir::spirv::FuncOp getFromVoidPointer(void *p) {
return mlir::spirv::FuncOp::getFromOpaquePointer(p);
}
static constexpr int NumLowBitsAvailable = 3;
static constexpr int numLowBitsAvailable = 3;
};

} // namespace llvm
Expand Down
27 changes: 13 additions & 14 deletions mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
namespace mlir {
namespace detail {

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

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

template <typename T, int Dim, bool IsPowerOf2>
Expand Down Expand Up @@ -305,17 +305,16 @@ struct UnrankedMemRefType {
template <typename T>
class DynamicMemRefType {
public:
explicit DynamicMemRefType(const StridedMemRefType<T, 0> &mem_ref)
: rank(0), basePtr(mem_ref.basePtr), data(mem_ref.data),
offset(mem_ref.offset), sizes(nullptr), strides(nullptr) {}
explicit DynamicMemRefType(const StridedMemRefType<T, 0> &memRef)
: rank(0), basePtr(memRef.basePtr), data(memRef.data),
offset(memRef.offset), sizes(nullptr), strides(nullptr) {}
template <int N>
explicit DynamicMemRefType(const StridedMemRefType<T, N> &mem_ref)
: rank(N), basePtr(mem_ref.basePtr), data(mem_ref.data),
offset(mem_ref.offset), sizes(mem_ref.sizes), strides(mem_ref.strides) {
}
explicit DynamicMemRefType(const UnrankedMemRefType<T> &mem_ref)
: rank(mem_ref.rank) {
auto *desc = static_cast<StridedMemRefType<T, 1> *>(mem_ref.descriptor);
explicit DynamicMemRefType(const StridedMemRefType<T, N> &memRef)
: rank(N), basePtr(memRef.basePtr), data(memRef.data),
offset(memRef.offset), sizes(memRef.sizes), strides(memRef.strides) {}
explicit DynamicMemRefType(const UnrankedMemRefType<T> &memRef)
: rank(memRef.rank) {
auto *desc = static_cast<StridedMemRefType<T, 1> *>(memRef.descriptor);
basePtr = desc->basePtr;
data = desc->data;
offset = desc->offset;
Expand Down Expand Up @@ -353,7 +352,7 @@ extern "C" MLIR_CRUNNERUTILS_EXPORT void printNewline();
//===----------------------------------------------------------------------===//
// Small runtime support library for timing execution and printing GFLOPS
//===----------------------------------------------------------------------===//
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_flops(double flops);
extern "C" MLIR_CRUNNERUTILS_EXPORT void printFlops(double flops);
extern "C" MLIR_CRUNNERUTILS_EXPORT double rtclock();

#endif // MLIR_EXECUTIONENGINE_CRUNNERUTILS_H
6 changes: 3 additions & 3 deletions mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class ModuleOp;
/// A simple object cache following Lang's LLJITWithObjectCache example.
class SimpleObjectCache : public llvm::ObjectCache {
public:
void notifyObjectCompiled(const llvm::Module *M,
llvm::MemoryBufferRef ObjBuffer) override;
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module *M) override;
void notifyObjectCompiled(const llvm::Module *m,
llvm::MemoryBufferRef objBuffer) override;
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module *m) override;

/// Dump cached object to output file `filename`.
void dumpToObjectFile(StringRef filename);
Expand Down
Loading

0 comments on commit cac7aab

Please sign in to comment.