From 52a0e58bdb18767addc43415ceff5660e8771ad4 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 24 Oct 2018 11:05:18 -0700 Subject: [PATCH] Change typedef to using to be consistent across the codebase Google C++ style guide also prefers using to typedef. PiperOrigin-RevId: 218541849 --- mlir/include/mlir/Analysis/HyperRectangularSet.h | 4 ++-- mlir/include/mlir/IR/AffineExpr.h | 10 +++++----- mlir/include/mlir/IR/AffineMap.h | 2 +- mlir/include/mlir/IR/BasicBlock.h | 4 ++-- mlir/include/mlir/IR/CFGFunction.h | 2 +- mlir/include/mlir/IR/Function.h | 2 +- mlir/include/mlir/IR/Instructions.h | 10 +++++----- mlir/include/mlir/IR/IntegerSet.h | 2 +- mlir/include/mlir/IR/Module.h | 2 +- mlir/include/mlir/IR/OperationSupport.h | 6 +++--- mlir/include/mlir/IR/Statements.h | 6 +++--- mlir/include/mlir/IR/StmtBlock.h | 2 +- mlir/include/mlir/Support/STLExtras.h | 6 +++--- mlir/include/mlir/Transforms/PatternMatch.h | 6 +++--- mlir/lib/Parser/Parser.cpp | 4 ++-- mlir/lib/Transforms/ComposeAffineMaps.cpp | 2 +- mlir/lib/Transforms/ConstantFold.cpp | 2 +- mlir/lib/Transforms/LoopUnroll.cpp | 2 +- mlir/lib/Transforms/LoopUnrollAndJam.cpp | 2 +- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/mlir/include/mlir/Analysis/HyperRectangularSet.h b/mlir/include/mlir/Analysis/HyperRectangularSet.h index dbccf1c36b13..266a0d7123d7 100644 --- a/mlir/include/mlir/Analysis/HyperRectangularSet.h +++ b/mlir/include/mlir/Analysis/HyperRectangularSet.h @@ -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 AffineBoundExprList; +using AffineBoundExprList = SmallVector; /// 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 HyperRectangleListTy; + using HyperRectangleListTy = ::llvm::iplist; HyperRectangleListTy &getRectangles() { return hyperRectangles; } // Iteration over the statements in the block. diff --git a/mlir/include/mlir/IR/AffineExpr.h b/mlir/include/mlir/IR/AffineExpr.h index 4eab310bde96..968ba149dfe6 100644 --- a/mlir/include/mlir/IR/AffineExpr.h +++ b/mlir/include/mlir/IR/AffineExpr.h @@ -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; }; diff --git a/mlir/include/mlir/IR/AffineMap.h b/mlir/include/mlir/IR/AffineMap.h index 1cc387f5423b..1e98d6d7979d 100644 --- a/mlir/include/mlir/IR/AffineMap.h +++ b/mlir/include/mlir/IR/AffineMap.h @@ -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); } diff --git a/mlir/include/mlir/IR/BasicBlock.h b/mlir/include/mlir/IR/BasicBlock.h index a38e605ed589..c55d09c1ca66 100644 --- a/mlir/include/mlir/IR/BasicBlock.h +++ b/mlir/include/mlir/IR/BasicBlock.h @@ -51,7 +51,7 @@ public: //===--------------------------------------------------------------------===// // This is the list of arguments to the block. - typedef ArrayRef BBArgListType; + using BBArgListType = ArrayRef; 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 OperationListType; + using OperationListType = llvm::iplist; OperationListType &getOperations() { return operations; } const OperationListType &getOperations() const { return operations; } diff --git a/mlir/include/mlir/IR/CFGFunction.h b/mlir/include/mlir/IR/CFGFunction.h index fa74635b82e7..f3c1da379082 100644 --- a/mlir/include/mlir/IR/CFGFunction.h +++ b/mlir/include/mlir/IR/CFGFunction.h @@ -37,7 +37,7 @@ public: //===--------------------------------------------------------------------===// /// This is the list of blocks in the function. - typedef llvm::iplist BasicBlockListType; + using BasicBlockListType = llvm::iplist; BasicBlockListType &getBlocks() { return blocks; } const BasicBlockListType &getBlocks() const { return blocks; } diff --git a/mlir/include/mlir/IR/Function.h b/mlir/include/mlir/IR/Function.h index f876ab8cee92..ea87def017ae 100644 --- a/mlir/include/mlir/IR/Function.h +++ b/mlir/include/mlir/IR/Function.h @@ -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 NamedAttribute; +using NamedAttribute = std::pair; /// This is the base class for all of the MLIR function types. class Function : public llvm::ilist_node_with_parent { diff --git a/mlir/include/mlir/IR/Instructions.h b/mlir/include/mlir/IR/Instructions.h index 33f2afd843e0..0ab792b1c94c 100644 --- a/mlir/include/mlir/IR/Instructions.h +++ b/mlir/include/mlir/IR/Instructions.h @@ -283,7 +283,7 @@ public: const CFGValue *getResult(unsigned idx) const { return &getInstResult(idx); } // Support non-const result iteration. - typedef ResultIterator result_iterator; + using result_iterator = ResultIterator; 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_result_iterator; + using const_result_iterator = + ResultIterator; 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; // Support const operand iteration. - typedef OperandIterator - const_operand_iterator; + using const_operand_iterator = + OperandIterator; ArrayRef getInstOperands() const { return operands; } MutableArrayRef getInstOperands() { return operands; } diff --git a/mlir/include/mlir/IR/IntegerSet.h b/mlir/include/mlir/IR/IntegerSet.h index e79cb47ebce3..fb00e88676de 100644 --- a/mlir/include/mlir/IR/IntegerSet.h +++ b/mlir/include/mlir/IR/IntegerSet.h @@ -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) {} diff --git a/mlir/include/mlir/IR/Module.h b/mlir/include/mlir/IR/Module.h index 9ea6d33f837c..083d38a0f590 100644 --- a/mlir/include/mlir/IR/Module.h +++ b/mlir/include/mlir/IR/Module.h @@ -38,7 +38,7 @@ public: MLIRContext *getContext() const { return context; } /// This is the list of functions in the module. - typedef llvm::iplist FunctionListType; + using FunctionListType = llvm::iplist; FunctionListType &getFunctions() { return functions; } const FunctionListType &getFunctions() const { return functions; } diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h index af1e55474377..351569149fe2 100644 --- a/mlir/include/mlir/IR/OperationSupport.h +++ b/mlir/include/mlir/IR/OperationSupport.h @@ -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 NamedAttribute; +using NamedAttribute = std::pair; class OperationName { public: - typedef llvm::PointerUnion - RepresentationUnion; + using RepresentationUnion = + llvm::PointerUnion; OperationName(AbstractOperation *op) : representation(op) {} OperationName(StringRef name, MLIRContext *context); diff --git a/mlir/include/mlir/IR/Statements.h b/mlir/include/mlir/IR/Statements.h index 4821263a6794..5fa0126d8761 100644 --- a/mlir/include/mlir/IR/Statements.h +++ b/mlir/include/mlir/IR/Statements.h @@ -126,7 +126,7 @@ public: const MLValue *getResult(unsigned idx) const { return &getStmtResult(idx); } // Support non-const result iteration. - typedef ResultIterator result_iterator; + using result_iterator = ResultIterator; 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_result_iterator; + using const_result_iterator = + ResultIterator; const_result_iterator result_begin() const { return const_result_iterator(this, 0); } diff --git a/mlir/include/mlir/IR/StmtBlock.h b/mlir/include/mlir/IR/StmtBlock.h index fd28f6e34445..6ee37d5472b4 100644 --- a/mlir/include/mlir/IR/StmtBlock.h +++ b/mlir/include/mlir/IR/StmtBlock.h @@ -64,7 +64,7 @@ public: //===--------------------------------------------------------------------===// /// This is the list of statements in the block. - typedef llvm::iplist StmtListType; + using StmtListType = llvm::iplist; StmtListType &getStatements() { return statements; } const StmtListType &getStatements() const { return statements; } diff --git a/mlir/include/mlir/Support/STLExtras.h b/mlir/include/mlir/Support/STLExtras.h index 69e0b67249e3..33434fea41f7 100644 --- a/mlir/include/mlir/Support/STLExtras.h +++ b/mlir/include/mlir/Support/STLExtras.h @@ -85,7 +85,7 @@ static inline unsigned llvm_combineHashValue(unsigned a, unsigned b) { namespace llvm { template struct DenseMapInfo> { - typedef std::tuple Tuple; + using Tuple = std::tuple; static inline Tuple getEmptyKey() { return Tuple(DenseMapInfo::getEmptyKey()...); @@ -97,7 +97,7 @@ template struct DenseMapInfo> { template static unsigned getHashValueImpl(const Tuple &values, std::false_type) { - typedef typename std::tuple_element::type EltType; + using EltType = typename std::tuple_element::type; std::integral_constant atEnd; return llvm_combineHashValue( DenseMapInfo::getHashValue(std::get(values)), @@ -116,7 +116,7 @@ template struct DenseMapInfo> { template static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type) { - typedef typename std::tuple_element::type EltType; + using EltType = typename std::tuple_element::type; std::integral_constant atEnd; return DenseMapInfo::isEqual(std::get(lhs), std::get(rhs)) && isEqualImpl(lhs, rhs, atEnd); diff --git a/mlir/include/mlir/Transforms/PatternMatch.h b/mlir/include/mlir/Transforms/PatternMatch.h index db3de26cbe5d..920819bfc1d0 100644 --- a/mlir/include/mlir/Transforms/PatternMatch.h +++ b/mlir/include/mlir/Transforms/PatternMatch.h @@ -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> - PatternMatchResult; +using PatternMatchResult = + std::pair>; //===----------------------------------------------------------------------===// // Pattern class @@ -264,7 +264,7 @@ public: explicit PatternMatcher(ArrayRef patterns) : patterns(patterns.begin(), patterns.end()) {} - typedef std::pair> MatchResult; + using MatchResult = std::pair>; /// 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 diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp index 171b11938b50..e35c20c6d43b 100644 --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -103,8 +103,8 @@ private: namespace { -typedef std::function - CreateOperationFunction; +using CreateOperationFunction = + std::function; /// This class implement support for parsing global entities like types and /// shared entities like SSA names. It is intended to be subclassed by diff --git a/mlir/lib/Transforms/ComposeAffineMaps.cpp b/mlir/lib/Transforms/ComposeAffineMaps.cpp index 4038631c696f..8f7919d07607 100644 --- a/mlir/lib/Transforms/ComposeAffineMaps.cpp +++ b/mlir/lib/Transforms/ComposeAffineMaps.cpp @@ -46,7 +46,7 @@ struct ComposeAffineMaps : public MLFunctionPass, std::vector affineApplyOpsToErase; explicit ComposeAffineMaps() {} - typedef llvm::iplist StmtListType; + using StmtListType = llvm::iplist; void walk(StmtListType::iterator Start, StmtListType::iterator End); void visitOperationStmt(OperationStmt *stmt); PassResult runOnMLFunction(MLFunction *f); diff --git a/mlir/lib/Transforms/ConstantFold.cpp b/mlir/lib/Transforms/ConstantFold.cpp index 7aa997b65ae8..c149a17a74b6 100644 --- a/mlir/lib/Transforms/ConstantFold.cpp +++ b/mlir/lib/Transforms/ConstantFold.cpp @@ -31,7 +31,7 @@ struct ConstantFold : public FunctionPass, StmtWalker { SmallVector existingConstants; // Operation statements that were folded and that need to be erased. std::vector opStmtsToErase; - typedef std::function ConstantFactoryType; + using ConstantFactoryType = std::function; bool foldOperation(Operation *op, SmallVectorImpl &existingConstants, diff --git a/mlir/lib/Transforms/LoopUnroll.cpp b/mlir/lib/Transforms/LoopUnroll.cpp index 2211a93cd544..3f4b673f273e 100644 --- a/mlir/lib/Transforms/LoopUnroll.cpp +++ b/mlir/lib/Transforms/LoopUnroll.cpp @@ -80,7 +80,7 @@ PassResult LoopUnroll::runOnMLFunction(MLFunction *f) { std::vector loops; // This method specialized to encode custom return logic. - typedef llvm::iplist StmtListType; + using StmtListType = llvm::iplist; bool walkPostOrder(StmtListType::iterator Start, StmtListType::iterator End) { bool hasInnerLoops = false; diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Transforms/LoopUnrollAndJam.cpp index b8e98379051b..a4a69ecdc5c6 100644 --- a/mlir/lib/Transforms/LoopUnrollAndJam.cpp +++ b/mlir/lib/Transforms/LoopUnrollAndJam.cpp @@ -125,7 +125,7 @@ bool mlir::loopUnrollJamByFactor(ForStmt *forStmt, uint64_t unrollJamFactor) { // tree). class JamBlockGatherer : public StmtWalker { public: - typedef llvm::iplist StmtListType; + using StmtListType = llvm::iplist; // Store iterators to the first and last stmt of each sub-block found. std::vector> subBlocks;