From 4562e389a43caa2e30ebf277c12743edafe6a0ac Mon Sep 17 00:00:00 2001 From: River Riddle Date: Wed, 18 Dec 2019 09:28:48 -0800 Subject: NFC: Remove unnecessary 'llvm::' prefix from uses of llvm symbols declared in `mlir` namespace. Aside from being cleaner, this also makes the codebase more consistent. PiperOrigin-RevId: 286206974 --- mlir/lib/Parser/Parser.cpp | 51 ++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'mlir/lib/Parser/Parser.cpp') diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp index ddc8d0191f5..1a02745e90c 100644 --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -349,7 +349,7 @@ public: /// Parse an AffineMap where the dim and symbol identifiers are SSA ids. ParseResult parseAffineMapOfSSAIds(AffineMap &map, - llvm::function_ref parseElement); + function_ref parseElement); private: /// The Parser is subclassed and reinstantiated. Do not add additional @@ -832,7 +832,7 @@ static Symbol parseExtendedSymbol(Parser &p, Token::Kind identifierTok, /// parsing failed, nullptr is returned. The number of bytes read from the input /// string is returned in 'numRead'. template -static T parseSymbol(llvm::StringRef inputStr, MLIRContext *context, +static T parseSymbol(StringRef inputStr, MLIRContext *context, SymbolState &symbolState, ParserFn &&parserFn, size_t *numRead = nullptr) { SourceMgr sourceMgr; @@ -1866,7 +1866,7 @@ private: /// parseList([[1, 2], [3, 4]]) -> Success, [2, 2] /// parseList([[1, 2], 3]) -> Failure /// parseList([[1, [2, 3]], [4, [5]]]) -> Failure - ParseResult parseList(llvm::SmallVectorImpl &dims); + ParseResult parseList(SmallVectorImpl &dims); Parser &p; @@ -1877,7 +1877,7 @@ private: std::vector> storage; /// A flag that indicates the type of elements that have been parsed. - llvm::Optional knownEltKind; + Optional knownEltKind; }; } // namespace @@ -2032,13 +2032,11 @@ ParseResult TensorLiteralParser::parseElement() { /// parseList([[1, 2], [3, 4]]) -> Success, [2, 2] /// parseList([[1, 2], 3]) -> Failure /// parseList([[1, [2, 3]], [4, [5]]]) -> Failure -ParseResult -TensorLiteralParser::parseList(llvm::SmallVectorImpl &dims) { +ParseResult TensorLiteralParser::parseList(SmallVectorImpl &dims) { p.consumeToken(Token::l_square); - auto checkDims = - [&](const llvm::SmallVectorImpl &prevDims, - const llvm::SmallVectorImpl &newDims) -> ParseResult { + auto checkDims = [&](const SmallVectorImpl &prevDims, + const SmallVectorImpl &newDims) -> ParseResult { if (prevDims == newDims) return success(); return p.emitError("tensor literal is invalid; ranks are not consistent " @@ -2046,10 +2044,10 @@ TensorLiteralParser::parseList(llvm::SmallVectorImpl &dims) { }; bool first = true; - llvm::SmallVector newDims; + SmallVector newDims; unsigned size = 0; auto parseCommaSeparatedList = [&]() -> ParseResult { - llvm::SmallVector thisDims; + SmallVector thisDims; if (p.getToken().getKind() == Token::l_square) { if (parseList(thisDims)) return failure(); @@ -2275,7 +2273,7 @@ ParseResult Parser::parseFusedLocation(LocationAttr &loc) { return failure(); } - llvm::SmallVector locations; + SmallVector locations; auto parseElt = [&] { LocationAttr newLoc; if (parseLocationInstance(newLoc)) @@ -2411,7 +2409,7 @@ namespace { class AffineParser : public Parser { public: AffineParser(ParserState &state, bool allowParsingSSAIds = false, - llvm::function_ref parseElement = nullptr) + function_ref parseElement = nullptr) : Parser(state), allowParsingSSAIds(allowParsingSSAIds), parseElement(parseElement), numDimOperands(0), numSymbolOperands(0) {} @@ -2454,7 +2452,7 @@ private: private: bool allowParsingSSAIds; - llvm::function_ref parseElement; + function_ref parseElement; unsigned numDimOperands; unsigned numSymbolOperands; SmallVector, 4> dimsAndSymbols; @@ -3048,8 +3046,9 @@ ParseResult Parser::parseAffineMapOrIntegerSetReference(AffineMap &map, /// Parse an AffineMap of SSA ids. The callback 'parseElement' is used to /// parse SSA value uses encountered while parsing affine expressions. -ParseResult Parser::parseAffineMapOfSSAIds( - AffineMap &map, llvm::function_ref parseElement) { +ParseResult +Parser::parseAffineMapOfSSAIds(AffineMap &map, + function_ref parseElement) { return AffineParser(state, /*allowParsingSSAIds=*/true, parseElement) .parseAffineMapOfSSAIds(map); } @@ -3113,7 +3112,7 @@ public: /// Return the location of the value identified by its name and number if it /// has been already reference. - llvm::Optional getReferenceLoc(StringRef name, unsigned number) { + Optional getReferenceLoc(StringRef name, unsigned number) { auto &values = isolatedNameScopes.back().values; if (!values.count(name) || number >= values[name].size()) return {}; @@ -4781,8 +4780,8 @@ OwningModuleRef mlir::parseSourceString(StringRef moduleStr, /// parsing failed, nullptr is returned. The number of bytes read from the input /// string is returned in 'numRead'. template -static T parseSymbol(llvm::StringRef inputStr, MLIRContext *context, - size_t &numRead, ParserFn &&parserFn) { +static T parseSymbol(StringRef inputStr, MLIRContext *context, size_t &numRead, + ParserFn &&parserFn) { SymbolState aliasState; return parseSymbol( inputStr, context, aliasState, @@ -4795,35 +4794,33 @@ static T parseSymbol(llvm::StringRef inputStr, MLIRContext *context, &numRead); } -Attribute mlir::parseAttribute(llvm::StringRef attrStr, MLIRContext *context) { +Attribute mlir::parseAttribute(StringRef attrStr, MLIRContext *context) { size_t numRead = 0; return parseAttribute(attrStr, context, numRead); } -Attribute mlir::parseAttribute(llvm::StringRef attrStr, Type type) { +Attribute mlir::parseAttribute(StringRef attrStr, Type type) { size_t numRead = 0; return parseAttribute(attrStr, type, numRead); } -Attribute mlir::parseAttribute(llvm::StringRef attrStr, MLIRContext *context, +Attribute mlir::parseAttribute(StringRef attrStr, MLIRContext *context, size_t &numRead) { return parseSymbol(attrStr, context, numRead, [](Parser &parser) { return parser.parseAttribute(); }); } -Attribute mlir::parseAttribute(llvm::StringRef attrStr, Type type, - size_t &numRead) { +Attribute mlir::parseAttribute(StringRef attrStr, Type type, size_t &numRead) { return parseSymbol( attrStr, type.getContext(), numRead, [type](Parser &parser) { return parser.parseAttribute(type); }); } -Type mlir::parseType(llvm::StringRef typeStr, MLIRContext *context) { +Type mlir::parseType(StringRef typeStr, MLIRContext *context) { size_t numRead = 0; return parseType(typeStr, context, numRead); } -Type mlir::parseType(llvm::StringRef typeStr, MLIRContext *context, - size_t &numRead) { +Type mlir::parseType(StringRef typeStr, MLIRContext *context, size_t &numRead) { return parseSymbol(typeStr, context, numRead, [](Parser &parser) { return parser.parseType(); }); } -- cgit v1.2.3