Change typedef to using to be consistent across the codebase

Google C++ style guide also prefers using to typedef.

PiperOrigin-RevId: 218541849
This commit is contained in:
Lei Zhang 2018-10-24 11:05:18 -07:00 committed by jpienaar
parent e8d254b909
commit 52a0e58bdb
19 changed files with 38 additions and 38 deletions

View File

@ -46,7 +46,7 @@ class HyperRectangleList;
/// A list of affine bounds.
// Not using a MutableAffineMap here since numSymbols is the same as the
// containing HyperRectangularSet's numSymbols, and its numDims is 0.
typedef SmallVector<AffineExpr, 4> AffineBoundExprList;
using AffineBoundExprList = SmallVector<AffineExpr, 4>;
/// A HyperRectangularSet is a symbolic set of integer points contained in a
/// hyper-rectangular space. It supports set manipulation operations
@ -259,7 +259,7 @@ public:
//===--------------------------------------------------------------------===//
/// These are for the list of hyper-rectangular set elements.
typedef ::llvm::iplist<HyperRectangularSet> HyperRectangleListTy;
using HyperRectangleListTy = ::llvm::iplist<HyperRectangularSet>;
HyperRectangleListTy &getRectangles() { return hyperRectangles; }
// Iteration over the statements in the block.

View File

@ -71,7 +71,7 @@ enum class AffineExprKind {
/// An AffineExpr is a POD interface to the underlying storage type pointer.
class AffineExpr {
public:
typedef detail::AffineExprStorage ImplType;
using ImplType = detail::AffineExprStorage;
AffineExpr() : expr(nullptr) {}
/* implicit */ AffineExpr(const ImplType *expr)
@ -146,7 +146,7 @@ protected:
/// the op type: see checks in the constructor.
class AffineBinaryOpExpr : public AffineExpr {
public:
typedef detail::AffineBinaryOpExprStorage ImplType;
using ImplType = detail::AffineBinaryOpExprStorage;
/* implicit */ AffineBinaryOpExpr(AffineExpr::ImplType *ptr);
AffineExpr getLHS() const;
AffineExpr getRHS() const;
@ -155,7 +155,7 @@ public:
/// A dimensional identifier appearing in an affine expression.
class AffineDimExpr : public AffineExpr {
public:
typedef detail::AffineDimExprStorage ImplType;
using ImplType = detail::AffineDimExprStorage;
/* implicit */ AffineDimExpr(AffineExpr::ImplType *ptr);
unsigned getPosition() const;
};
@ -163,7 +163,7 @@ public:
/// A symbolic identifier appearing in an affine expression.
class AffineSymbolExpr : public AffineExpr {
public:
typedef detail::AffineSymbolExprStorage ImplType;
using ImplType = detail::AffineSymbolExprStorage;
/* implicit */ AffineSymbolExpr(AffineExpr::ImplType *ptr);
unsigned getPosition() const;
};
@ -171,7 +171,7 @@ public:
/// An integer constant appearing in affine expression.
class AffineConstantExpr : public AffineExpr {
public:
typedef detail::AffineConstantExprStorage ImplType;
using ImplType = detail::AffineConstantExprStorage;
/* implicit */ AffineConstantExpr(AffineExpr::ImplType *ptr);
int64_t getValue() const;
};

View File

@ -44,7 +44,7 @@ class MLIRContext;
/// is unique to this affine map.
class AffineMap {
public:
typedef detail::AffineMapStorage ImplType;
using ImplType = detail::AffineMapStorage;
explicit AffineMap(ImplType *map = nullptr) : map(map) {}
static AffineMap Invalid() { return AffineMap(nullptr); }

View File

@ -51,7 +51,7 @@ public:
//===--------------------------------------------------------------------===//
// This is the list of arguments to the block.
typedef ArrayRef<BBArgument *> BBArgListType;
using BBArgListType = ArrayRef<BBArgument *>;
BBArgListType getArguments() const { return arguments; }
using args_iterator = BBArgListType::iterator;
@ -78,7 +78,7 @@ public:
//===--------------------------------------------------------------------===//
/// This is the list of operations in the block.
typedef llvm::iplist<OperationInst> OperationListType;
using OperationListType = llvm::iplist<OperationInst>;
OperationListType &getOperations() { return operations; }
const OperationListType &getOperations() const { return operations; }

View File

@ -37,7 +37,7 @@ public:
//===--------------------------------------------------------------------===//
/// This is the list of blocks in the function.
typedef llvm::iplist<BasicBlock> BasicBlockListType;
using BasicBlockListType = llvm::iplist<BasicBlock>;
BasicBlockListType &getBlocks() { return blocks; }
const BasicBlockListType &getBlocks() const { return blocks; }

View File

@ -39,7 +39,7 @@ class Module;
/// NamedAttribute is used for function attribute lists, it holds an
/// identifier for the name and a value for the attribute. The attribute
/// pointer should always be non-null.
typedef std::pair<Identifier, Attribute *> NamedAttribute;
using NamedAttribute = std::pair<Identifier, Attribute *>;
/// This is the base class for all of the MLIR function types.
class Function : public llvm::ilist_node_with_parent<Function, Module> {

View File

@ -283,7 +283,7 @@ public:
const CFGValue *getResult(unsigned idx) const { return &getInstResult(idx); }
// Support non-const result iteration.
typedef ResultIterator<OperationInst, CFGValue> result_iterator;
using result_iterator = ResultIterator<OperationInst, CFGValue>;
result_iterator result_begin() { return result_iterator(this, 0); }
result_iterator result_end() {
return result_iterator(this, getNumResults());
@ -293,8 +293,8 @@ public:
}
// Support const operand iteration.
typedef ResultIterator<const OperationInst, const CFGValue>
const_result_iterator;
using const_result_iterator =
ResultIterator<const OperationInst, const CFGValue>;
const_result_iterator result_begin() const {
return const_result_iterator(this, 0);
}
@ -473,8 +473,8 @@ public:
// Support non-const operand iteration.
using operand_iterator = OperandIterator<CondBranchInst, CFGValue>;
// Support const operand iteration.
typedef OperandIterator<const CondBranchInst, const CFGValue>
const_operand_iterator;
using const_operand_iterator =
OperandIterator<const CondBranchInst, const CFGValue>;
ArrayRef<InstOperand> getInstOperands() const { return operands; }
MutableArrayRef<InstOperand> getInstOperands() { return operands; }

View File

@ -51,7 +51,7 @@ class MLIRContext;
/// in the bump allocator.
class IntegerSet {
public:
typedef detail::IntegerSetStorage ImplType;
using ImplType = detail::IntegerSetStorage;
explicit IntegerSet(ImplType *set = nullptr) : set(set) {}

View File

@ -38,7 +38,7 @@ public:
MLIRContext *getContext() const { return context; }
/// This is the list of functions in the module.
typedef llvm::iplist<Function> FunctionListType;
using FunctionListType = llvm::iplist<Function>;
FunctionListType &getFunctions() { return functions; }
const FunctionListType &getFunctions() const { return functions; }

View File

@ -124,12 +124,12 @@ private:
/// NamedAttribute is a used for operation attribute lists, it holds an
/// identifier for the name and a value for the attribute. The attribute
/// pointer should always be non-null.
typedef std::pair<Identifier, Attribute *> NamedAttribute;
using NamedAttribute = std::pair<Identifier, Attribute *>;
class OperationName {
public:
typedef llvm::PointerUnion<Identifier, const AbstractOperation *>
RepresentationUnion;
using RepresentationUnion =
llvm::PointerUnion<Identifier, const AbstractOperation *>;
OperationName(AbstractOperation *op) : representation(op) {}
OperationName(StringRef name, MLIRContext *context);

View File

@ -126,7 +126,7 @@ public:
const MLValue *getResult(unsigned idx) const { return &getStmtResult(idx); }
// Support non-const result iteration.
typedef ResultIterator<OperationStmt, MLValue> result_iterator;
using result_iterator = ResultIterator<OperationStmt, MLValue>;
result_iterator result_begin() { return result_iterator(this, 0); }
result_iterator result_end() {
return result_iterator(this, getNumResults());
@ -136,8 +136,8 @@ public:
}
// Support const operand iteration.
typedef ResultIterator<const OperationStmt, const MLValue>
const_result_iterator;
using const_result_iterator =
ResultIterator<const OperationStmt, const MLValue>;
const_result_iterator result_begin() const {
return const_result_iterator(this, 0);
}

View File

@ -64,7 +64,7 @@ public:
//===--------------------------------------------------------------------===//
/// This is the list of statements in the block.
typedef llvm::iplist<Statement> StmtListType;
using StmtListType = llvm::iplist<Statement>;
StmtListType &getStatements() { return statements; }
const StmtListType &getStatements() const { return statements; }

View File

@ -85,7 +85,7 @@ static inline unsigned llvm_combineHashValue(unsigned a, unsigned b) {
namespace llvm {
template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> {
typedef std::tuple<Ts...> Tuple;
using Tuple = std::tuple<Ts...>;
static inline Tuple getEmptyKey() {
return Tuple(DenseMapInfo<Ts>::getEmptyKey()...);
@ -97,7 +97,7 @@ template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> {
template <unsigned I>
static unsigned getHashValueImpl(const Tuple &values, std::false_type) {
typedef typename std::tuple_element<I, Tuple>::type EltType;
using EltType = typename std::tuple_element<I, Tuple>::type;
std::integral_constant<bool, I + 1 == sizeof...(Ts)> atEnd;
return llvm_combineHashValue(
DenseMapInfo<EltType>::getHashValue(std::get<I>(values)),
@ -116,7 +116,7 @@ template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> {
template <unsigned I>
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type) {
typedef typename std::tuple_element<I, Tuple>::type EltType;
using EltType = typename std::tuple_element<I, Tuple>::type;
std::integral_constant<bool, I + 1 == sizeof...(Ts)> atEnd;
return DenseMapInfo<EltType>::isEqual(std::get<I>(lhs), std::get<I>(rhs)) &&
isEqualImpl<I + 1>(lhs, rhs, atEnd);

View File

@ -77,8 +77,8 @@ protected:
/// the benefit of the match, the second is a state token that can optionally
/// be produced by a pattern match to maintain state between the match and
/// rewrite phases.
typedef std::pair<PatternBenefit, std::unique_ptr<PatternState>>
PatternMatchResult;
using PatternMatchResult =
std::pair<PatternBenefit, std::unique_ptr<PatternState>>;
//===----------------------------------------------------------------------===//
// Pattern class
@ -264,7 +264,7 @@ public:
explicit PatternMatcher(ArrayRef<Pattern *> patterns)
: patterns(patterns.begin(), patterns.end()) {}
typedef std::pair<Pattern *, std::unique_ptr<PatternState>> MatchResult;
using MatchResult = std::pair<Pattern *, std::unique_ptr<PatternState>>;
/// Find the highest benefit pattern available in the pattern set for the DAG
/// rooted at the specified node. This returns the pattern (and any state it

View File

@ -103,8 +103,8 @@ private:
namespace {
typedef std::function<Operation *(const OperationState &)>
CreateOperationFunction;
using CreateOperationFunction =
std::function<Operation *(const OperationState &)>;
/// This class implement support for parsing global entities like types and
/// shared entities like SSA names. It is intended to be subclassed by

View File

@ -46,7 +46,7 @@ struct ComposeAffineMaps : public MLFunctionPass,
std::vector<OperationStmt *> affineApplyOpsToErase;
explicit ComposeAffineMaps() {}
typedef llvm::iplist<Statement> StmtListType;
using StmtListType = llvm::iplist<Statement>;
void walk(StmtListType::iterator Start, StmtListType::iterator End);
void visitOperationStmt(OperationStmt *stmt);
PassResult runOnMLFunction(MLFunction *f);

View File

@ -31,7 +31,7 @@ struct ConstantFold : public FunctionPass, StmtWalker<ConstantFold> {
SmallVector<SSAValue *, 8> existingConstants;
// Operation statements that were folded and that need to be erased.
std::vector<OperationStmt *> opStmtsToErase;
typedef std::function<SSAValue *(Attribute *, Type *)> ConstantFactoryType;
using ConstantFactoryType = std::function<SSAValue *(Attribute *, Type *)>;
bool foldOperation(Operation *op,
SmallVectorImpl<SSAValue *> &existingConstants,

View File

@ -80,7 +80,7 @@ PassResult LoopUnroll::runOnMLFunction(MLFunction *f) {
std::vector<ForStmt *> loops;
// This method specialized to encode custom return logic.
typedef llvm::iplist<Statement> StmtListType;
using StmtListType = llvm::iplist<Statement>;
bool walkPostOrder(StmtListType::iterator Start,
StmtListType::iterator End) {
bool hasInnerLoops = false;

View File

@ -125,7 +125,7 @@ bool mlir::loopUnrollJamByFactor(ForStmt *forStmt, uint64_t unrollJamFactor) {
// tree).
class JamBlockGatherer : public StmtWalker<JamBlockGatherer> {
public:
typedef llvm::iplist<Statement> StmtListType;
using StmtListType = llvm::iplist<Statement>;
// Store iterators to the first and last stmt of each sub-block found.
std::vector<std::pair<StmtBlock::iterator, StmtBlock::iterator>> subBlocks;