[Mlir-commits] [mlir] 6842ec4 - [mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h
River Riddle
llvmlistbot at llvm.org
Wed Jan 26 21:38:08 PST 2022
Author: River Riddle
Date: 2022-01-26T21:37:23-08:00
New Revision: 6842ec42f665f38bc744e3c576004bc1fd36ad9d
URL: https://github.com/llvm/llvm-project/commit/6842ec42f665f38bc744e3c576004bc1fd36ad9d
DIFF: https://github.com/llvm/llvm-project/commit/6842ec42f665f38bc744e3c576004bc1fd36ad9d.diff
LOG: [mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.h
These are used pervasively during parsing.
Differential Revision: https://reviews.llvm.org/D118291
Added:
Modified:
mlir/docs/Tutorials/Toy/Ch-7.md
mlir/examples/toy/Ch2/mlir/Dialect.cpp
mlir/examples/toy/Ch3/mlir/Dialect.cpp
mlir/examples/toy/Ch4/mlir/Dialect.cpp
mlir/examples/toy/Ch5/mlir/Dialect.cpp
mlir/examples/toy/Ch6/mlir/Dialect.cpp
mlir/examples/toy/Ch7/mlir/Dialect.cpp
mlir/include/mlir/IR/Diagnostics.h
mlir/include/mlir/IR/OpImplementation.h
mlir/include/mlir/Parser/AsmParserState.h
mlir/include/mlir/Support/LLVM.h
mlir/include/mlir/TableGen/AttrOrTypeDef.h
mlir/include/mlir/TableGen/Builder.h
mlir/include/mlir/TableGen/Operator.h
mlir/include/mlir/TableGen/Pattern.h
mlir/include/mlir/TableGen/Predicate.h
mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
mlir/include/mlir/Tools/PDLL/AST/Nodes.h
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/DLTI/DLTI.cpp
mlir/lib/Dialect/EmitC/IR/EmitC.cpp
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
mlir/lib/Dialect/PDL/IR/PDLTypes.cpp
mlir/lib/Dialect/Quant/IR/TypeParser.cpp
mlir/lib/Dialect/SCF/SCF.cpp
mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/lib/ExecutionEngine/JitRunner.cpp
mlir/lib/IR/Diagnostics.cpp
mlir/lib/IR/FunctionImplementation.cpp
mlir/lib/IR/Operation.cpp
mlir/lib/Parser/AffineParser.cpp
mlir/lib/Parser/AsmParserImpl.h
mlir/lib/Parser/AsmParserState.cpp
mlir/lib/Parser/AttributeParser.cpp
mlir/lib/Parser/DialectSymbolParser.cpp
mlir/lib/Parser/Lexer.cpp
mlir/lib/Parser/Lexer.h
mlir/lib/Parser/Parser.cpp
mlir/lib/Parser/Parser.h
mlir/lib/Parser/ParserState.h
mlir/lib/Parser/Token.cpp
mlir/lib/Parser/Token.h
mlir/lib/Parser/TypeParser.cpp
mlir/lib/Pass/PassRegistry.cpp
mlir/lib/Support/MlirOptMain.cpp
mlir/lib/Support/ToolUtilities.cpp
mlir/lib/TableGen/AttrOrTypeDef.cpp
mlir/lib/TableGen/Builder.cpp
mlir/lib/TableGen/Operator.cpp
mlir/lib/TableGen/Predicate.cpp
mlir/lib/Tools/PDLL/AST/Nodes.cpp
mlir/lib/Tools/PDLL/Parser/Lexer.cpp
mlir/lib/Tools/PDLL/Parser/Lexer.h
mlir/lib/Tools/PDLL/Parser/Parser.cpp
mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
mlir/lib/Translation/Translation.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/tools/mlir-pdll/mlir-pdll.cpp
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
mlir/tools/mlir-tblgen/FormatGen.cpp
mlir/tools/mlir-tblgen/FormatGen.h
mlir/tools/mlir-tblgen/OpFormatGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp
mlir/unittests/Dialect/SparseTensor/MergerTest.cpp
Removed:
################################################################################
diff --git a/mlir/docs/Tutorials/Toy/Ch-7.md b/mlir/docs/Tutorials/Toy/Ch-7.md
index 0a99ac2fae88d..b06d5bc539d41 100644
--- a/mlir/docs/Tutorials/Toy/Ch-7.md
+++ b/mlir/docs/Tutorials/Toy/Ch-7.md
@@ -268,7 +268,7 @@ mlir::Type ToyDialect::parseType(mlir::DialectAsmParser &parser) const {
SmallVector<mlir::Type, 1> elementTypes;
do {
// Parse the current element type.
- llvm::SMLoc typeLoc = parser.getCurrentLocation();
+ SMLoc typeLoc = parser.getCurrentLocation();
mlir::Type elementType;
if (parser.parseType(elementType))
return nullptr;
diff --git a/mlir/examples/toy/Ch2/mlir/Dialect.cpp b/mlir/examples/toy/Ch2/mlir/Dialect.cpp
index 22eea79f01398..278c857ea4681 100644
--- a/mlir/examples/toy/Ch2/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch2/mlir/Dialect.cpp
@@ -44,7 +44,7 @@ void ToyDialect::initialize() {
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
- llvm::SMLoc operandsLoc = parser.getCurrentLocation();
+ SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
parser.parseOptionalAttrDict(result.attributes) ||
diff --git a/mlir/examples/toy/Ch3/mlir/Dialect.cpp b/mlir/examples/toy/Ch3/mlir/Dialect.cpp
index 22eea79f01398..278c857ea4681 100644
--- a/mlir/examples/toy/Ch3/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch3/mlir/Dialect.cpp
@@ -44,7 +44,7 @@ void ToyDialect::initialize() {
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
- llvm::SMLoc operandsLoc = parser.getCurrentLocation();
+ SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
parser.parseOptionalAttrDict(result.attributes) ||
diff --git a/mlir/examples/toy/Ch4/mlir/Dialect.cpp b/mlir/examples/toy/Ch4/mlir/Dialect.cpp
index 4b2a1ee53568a..183cd59261da8 100644
--- a/mlir/examples/toy/Ch4/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch4/mlir/Dialect.cpp
@@ -100,7 +100,7 @@ void ToyDialect::initialize() {
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
- llvm::SMLoc operandsLoc = parser.getCurrentLocation();
+ SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
parser.parseOptionalAttrDict(result.attributes) ||
diff --git a/mlir/examples/toy/Ch5/mlir/Dialect.cpp b/mlir/examples/toy/Ch5/mlir/Dialect.cpp
index f0762a757b1d9..f4ded4956c978 100644
--- a/mlir/examples/toy/Ch5/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch5/mlir/Dialect.cpp
@@ -100,7 +100,7 @@ void ToyDialect::initialize() {
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
- llvm::SMLoc operandsLoc = parser.getCurrentLocation();
+ SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
parser.parseOptionalAttrDict(result.attributes) ||
diff --git a/mlir/examples/toy/Ch6/mlir/Dialect.cpp b/mlir/examples/toy/Ch6/mlir/Dialect.cpp
index f0762a757b1d9..f4ded4956c978 100644
--- a/mlir/examples/toy/Ch6/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch6/mlir/Dialect.cpp
@@ -100,7 +100,7 @@ void ToyDialect::initialize() {
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
- llvm::SMLoc operandsLoc = parser.getCurrentLocation();
+ SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
parser.parseOptionalAttrDict(result.attributes) ||
diff --git a/mlir/examples/toy/Ch7/mlir/Dialect.cpp b/mlir/examples/toy/Ch7/mlir/Dialect.cpp
index 8b63c0bdeaeca..0bf5f7593758b 100644
--- a/mlir/examples/toy/Ch7/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch7/mlir/Dialect.cpp
@@ -87,7 +87,7 @@ struct ToyInlinerInterface : public DialectInlinerInterface {
static mlir::ParseResult parseBinaryOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
SmallVector<mlir::OpAsmParser::OperandType, 2> operands;
- llvm::SMLoc operandsLoc = parser.getCurrentLocation();
+ SMLoc operandsLoc = parser.getCurrentLocation();
Type type;
if (parser.parseOperandList(operands, /*requiredOperandCount=*/2) ||
parser.parseOptionalAttrDict(result.attributes) ||
@@ -501,7 +501,7 @@ mlir::Type ToyDialect::parseType(mlir::DialectAsmParser &parser) const {
SmallVector<mlir::Type, 1> elementTypes;
do {
// Parse the current element type.
- llvm::SMLoc typeLoc = parser.getCurrentLocation();
+ SMLoc typeLoc = parser.getCurrentLocation();
mlir::Type elementType;
if (parser.parseType(elementType))
return nullptr;
diff --git a/mlir/include/mlir/IR/Diagnostics.h b/mlir/include/mlir/IR/Diagnostics.h
index b259e51b67a23..97f333abc2288 100644
--- a/mlir/include/mlir/IR/Diagnostics.h
+++ b/mlir/include/mlir/IR/Diagnostics.h
@@ -564,7 +564,7 @@ class SourceMgrDiagnosticHandler : public ScopedDiagnosticHandler {
private:
/// Convert a location into the given memory buffer into an SMLoc.
- llvm::SMLoc convertLocToSMLoc(FileLineColLoc loc);
+ SMLoc convertLocToSMLoc(FileLineColLoc loc);
/// Given a location, returns the first nested location (including 'loc') that
/// can be shown to the user.
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h
index 77e858e484be7..20310201fd8e4 100644
--- a/mlir/include/mlir/IR/OpImplementation.h
+++ b/mlir/include/mlir/IR/OpImplementation.h
@@ -367,14 +367,14 @@ class AsmParser {
MLIRContext *getContext() const;
/// Return the location of the original name token.
- virtual llvm::SMLoc getNameLoc() const = 0;
+ virtual SMLoc getNameLoc() const = 0;
//===--------------------------------------------------------------------===//
// Utilities
//===--------------------------------------------------------------------===//
/// Emit a diagnostic at the specified location and return failure.
- virtual InFlightDiagnostic emitError(llvm::SMLoc loc,
+ virtual InFlightDiagnostic emitError(SMLoc loc,
const Twine &message = {}) = 0;
/// Return a builder which provides useful access to MLIRContext, global
@@ -383,8 +383,8 @@ class AsmParser {
/// Get the location of the next token and store it into the argument. This
/// always succeeds.
- virtual llvm::SMLoc getCurrentLocation() = 0;
- ParseResult getCurrentLocation(llvm::SMLoc *loc) {
+ virtual SMLoc getCurrentLocation() = 0;
+ ParseResult getCurrentLocation(SMLoc *loc) {
*loc = getCurrentLocation();
return success();
}
@@ -392,7 +392,7 @@ class AsmParser {
/// Re-encode the given source location as an MLIR location and return it.
/// Note: This method should only be used when a `Location` is necessary, as
/// the encoding process is not efficient.
- virtual Location getEncodedSourceLoc(llvm::SMLoc loc) = 0;
+ virtual Location getEncodedSourceLoc(SMLoc loc) = 0;
//===--------------------------------------------------------------------===//
// Token Parsing
@@ -627,7 +627,7 @@ class AsmParser {
/// unlike `OpBuilder::getType`, this method does not implicitly insert a
/// context parameter.
template <typename T, typename... ParamsT>
- T getChecked(llvm::SMLoc loc, ParamsT &&... params) {
+ T getChecked(SMLoc loc, ParamsT &&... params) {
return T::getChecked([&] { return emitError(loc); },
std::forward<ParamsT>(params)...);
}
@@ -656,7 +656,7 @@ class AsmParser {
/// Parse an attribute of a specific kind and type.
template <typename AttrType>
ParseResult parseAttribute(AttrType &result, Type type = {}) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of attribute.
Attribute attr;
@@ -690,7 +690,7 @@ class AsmParser {
template <typename AttrType>
ParseResult parseAttribute(AttrType &result, Type type, StringRef attrName,
NamedAttrList &attrs) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of attribute.
Attribute attr;
@@ -721,7 +721,7 @@ class AsmParser {
std::enable_if_t<detect_has_parse_method<AttrType>::value, ParseResult>
parseCustomAttributeWithFallback(AttrType &result, Type type,
StringRef attrName, NamedAttrList &attrs) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of attribute.
Attribute attr;
@@ -757,7 +757,7 @@ class AsmParser {
template <typename AttrType>
std::enable_if_t<detect_has_parse_method<AttrType>::value, ParseResult>
parseCustomAttributeWithFallback(AttrType &result) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of attribute.
Attribute attr;
@@ -868,7 +868,7 @@ class AsmParser {
/// Parse a type of a specific type.
template <typename TypeT>
ParseResult parseType(TypeT &result) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of type.
Type type;
@@ -897,7 +897,7 @@ class AsmParser {
template <typename TypeT>
std::enable_if_t<detect_type_has_parse_method<TypeT>::value, ParseResult>
parseCustomTypeWithFallback(TypeT &result) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of Type.
Type type;
@@ -945,7 +945,7 @@ class AsmParser {
/// Parse a colon followed by a type of a specific kind, e.g. a FunctionType.
template <typename TypeType>
ParseResult parseColonType(TypeType &result) {
- llvm::SMLoc loc = getCurrentLocation();
+ SMLoc loc = getCurrentLocation();
// Parse any kind of type.
Type type;
@@ -1084,7 +1084,7 @@ class OpAsmParser : public AsmParser {
/// This is the representation of an operand reference.
struct OperandType {
- llvm::SMLoc location; // Location of the token.
+ SMLoc location; // Location of the token.
StringRef name; // Value name, e.g. %42 or %abc
unsigned number; // Number, e.g. 12 for an operand like %xyz#12
};
@@ -1152,7 +1152,7 @@ class OpAsmParser : public AsmParser {
/// emitting an error and returning failure, or appending the results
/// to the list on success.
ParseResult resolveOperands(ArrayRef<OperandType> operands,
- ArrayRef<Type> types, llvm::SMLoc loc,
+ ArrayRef<Type> types, SMLoc loc,
SmallVectorImpl<Value> &result) {
if (operands.size() != types.size())
return emitError(loc)
@@ -1165,14 +1165,14 @@ class OpAsmParser : public AsmParser {
return success();
}
template <typename Operands>
- ParseResult resolveOperands(Operands &&operands, Type type, llvm::SMLoc loc,
+ ParseResult resolveOperands(Operands &&operands, Type type, SMLoc loc,
SmallVectorImpl<Value> &result) {
return resolveOperands(std::forward<Operands>(operands),
ArrayRef<Type>(type), loc, result);
}
template <typename Operands, typename Types>
std::enable_if_t<!std::is_convertible<Types, Type>::value, ParseResult>
- resolveOperands(Operands &&operands, Types &&types, llvm::SMLoc loc,
+ resolveOperands(Operands &&operands, Types &&types, SMLoc loc,
SmallVectorImpl<Value> &result) {
size_t operandSize = std::distance(operands.begin(), operands.end());
size_t typeSize = std::distance(types.begin(), types.end());
diff --git a/mlir/include/mlir/Parser/AsmParserState.h b/mlir/include/mlir/Parser/AsmParserState.h
index f5b27fa742fe1..6afa1c392d5ba 100644
--- a/mlir/include/mlir/Parser/AsmParserState.h
+++ b/mlir/include/mlir/Parser/AsmParserState.h
@@ -35,19 +35,19 @@ class AsmParserState {
/// values, Blocks, and Symbols.
struct SMDefinition {
SMDefinition() = default;
- SMDefinition(llvm::SMRange loc) : loc(loc) {}
+ SMDefinition(SMRange loc) : loc(loc) {}
/// The source location of the definition.
- llvm::SMRange loc;
+ SMRange loc;
/// The source location of all uses of the definition.
- SmallVector<llvm::SMRange> uses;
+ SmallVector<SMRange> uses;
};
/// This class represents the information for an operation definition within
/// an input file.
struct OperationDefinition {
struct ResultGroupDefinition {
- ResultGroupDefinition(unsigned index, llvm::SMRange loc)
+ ResultGroupDefinition(unsigned index, SMRange loc)
: startIndex(index), definition(loc) {}
/// The result number that starts this group.
@@ -56,31 +56,31 @@ class AsmParserState {
SMDefinition definition;
};
- OperationDefinition(Operation *op, llvm::SMRange loc, llvm::SMLoc endLoc)
+ OperationDefinition(Operation *op, SMRange loc, SMLoc endLoc)
: op(op), loc(loc), scopeLoc(loc.Start, endLoc) {}
/// The operation representing this definition.
Operation *op;
/// The source location for the operation, i.e. the location of its name.
- llvm::SMRange loc;
+ SMRange loc;
/// The full source range of the operation definition, i.e. a range
/// encompassing the start and end of the full operation definition.
- llvm::SMRange scopeLoc;
+ SMRange scopeLoc;
/// Source definitions for any result groups of this operation.
SmallVector<ResultGroupDefinition> resultGroups;
/// If this operation is a symbol operation, this vector contains symbol
/// uses of this operation.
- SmallVector<llvm::SMRange> symbolUses;
+ SmallVector<SMRange> symbolUses;
};
/// This class represents the information for a block definition within the
/// input file.
struct BlockDefinition {
- BlockDefinition(Block *block, llvm::SMRange loc = {})
+ BlockDefinition(Block *block, SMRange loc = {})
: block(block), definition(loc) {}
/// The block representing this definition.
@@ -124,7 +124,7 @@ class AsmParserState {
/// Returns (heuristically) the range of an identifier given a SMLoc
/// corresponding to the start of an identifier location.
- static llvm::SMRange convertIdLocToRange(llvm::SMLoc loc);
+ static SMRange convertIdLocToRange(SMLoc loc);
//===--------------------------------------------------------------------===//
// Populate State
@@ -142,8 +142,8 @@ class AsmParserState {
/// Finalize the most recently started operation definition.
void finalizeOperationDefinition(
- Operation *op, llvm::SMRange nameLoc, llvm::SMLoc endLoc,
- ArrayRef<std::pair<unsigned, llvm::SMLoc>> resultGroups = llvm::None);
+ Operation *op, SMRange nameLoc, SMLoc endLoc,
+ ArrayRef<std::pair<unsigned, SMLoc>> resultGroups = llvm::None);
/// Start a definition for a region nested under the current operation.
void startRegionDefinition();
@@ -152,18 +152,18 @@ class AsmParserState {
void finalizeRegionDefinition();
/// Add a definition of the given entity.
- void addDefinition(Block *block, llvm::SMLoc location);
- void addDefinition(BlockArgument blockArg, llvm::SMLoc location);
+ void addDefinition(Block *block, SMLoc location);
+ void addDefinition(BlockArgument blockArg, SMLoc location);
/// Add a source uses of the given value.
- void addUses(Value value, ArrayRef<llvm::SMLoc> locations);
- void addUses(Block *block, ArrayRef<llvm::SMLoc> locations);
+ void addUses(Value value, ArrayRef<SMLoc> locations);
+ void addUses(Block *block, ArrayRef<SMLoc> locations);
/// Add source uses for all the references nested under `refAttr`. The
/// provided `locations` should match 1-1 with the number of references in
/// `refAttr`, i.e.:
/// nestedReferences.size() + /*leafReference=*/1 == refLocations.size()
- void addUses(SymbolRefAttr refAttr, ArrayRef<llvm::SMRange> refLocations);
+ void addUses(SymbolRefAttr refAttr, ArrayRef<SMRange> refLocations);
/// Refine the `oldValue` to the `newValue`. This is used to indicate that
/// `oldValue` was a placeholder, and the uses of it should really refer to
diff --git a/mlir/include/mlir/Support/LLVM.h b/mlir/include/mlir/Support/LLVM.h
index eda75cccc9cc9..60eb7d0f9d2af 100644
--- a/mlir/include/mlir/Support/LLVM.h
+++ b/mlir/include/mlir/Support/LLVM.h
@@ -71,6 +71,8 @@ class APFloat;
template <typename Fn> class function_ref;
template <typename IteratorT> class iterator_range;
class raw_ostream;
+class SMLoc;
+class SMRange;
} // namespace llvm
namespace mlir {
@@ -127,6 +129,8 @@ using llvm::APSInt;
template <typename Fn> using function_ref = llvm::function_ref<Fn>;
using llvm::iterator_range;
using llvm::raw_ostream;
+using llvm::SMLoc;
+using llvm::SMRange;
} // namespace mlir
#endif // MLIR_SUPPORT_LLVM_H
diff --git a/mlir/include/mlir/TableGen/AttrOrTypeDef.h b/mlir/include/mlir/TableGen/AttrOrTypeDef.h
index 9f2375bc30207..7be684d4c5343 100644
--- a/mlir/include/mlir/TableGen/AttrOrTypeDef.h
+++ b/mlir/include/mlir/TableGen/AttrOrTypeDef.h
@@ -196,7 +196,7 @@ class AttrOrTypeDef {
Optional<StringRef> getExtraDecls() const;
// Get the code location (for error printing).
- ArrayRef<llvm::SMLoc> getLoc() const;
+ ArrayRef<SMLoc> getLoc() const;
// Returns true if the default get/getChecked methods should be skipped during
// generation.
diff --git a/mlir/include/mlir/TableGen/Builder.h b/mlir/include/mlir/TableGen/Builder.h
index a5e6d01c99571..a3257bcb85a15 100644
--- a/mlir/include/mlir/TableGen/Builder.h
+++ b/mlir/include/mlir/TableGen/Builder.h
@@ -62,7 +62,7 @@ class Builder {
};
/// Construct a builder from the given Record instance.
- Builder(const llvm::Record *record, ArrayRef<llvm::SMLoc> loc);
+ Builder(const llvm::Record *record, ArrayRef<SMLoc> loc);
/// Return a list of parameters used in this build method.
ArrayRef<Parameter> getParameters() const { return parameters; }
diff --git a/mlir/include/mlir/TableGen/Operator.h b/mlir/include/mlir/TableGen/Operator.h
index 298e76b4239d4..6bac85075622e 100644
--- a/mlir/include/mlir/TableGen/Operator.h
+++ b/mlir/include/mlir/TableGen/Operator.h
@@ -222,7 +222,7 @@ class Operator {
const_trait_iterator trait_end() const;
llvm::iterator_range<const_trait_iterator> getTraits() const;
- ArrayRef<llvm::SMLoc> getLoc() const;
+ ArrayRef<SMLoc> getLoc() const;
// Query functions for the documentation of the operator.
bool hasDescription() const;
diff --git a/mlir/include/mlir/TableGen/Pattern.h b/mlir/include/mlir/TableGen/Pattern.h
index f55b1afe0947e..656cfcb0f5c9c 100644
--- a/mlir/include/mlir/TableGen/Pattern.h
+++ b/mlir/include/mlir/TableGen/Pattern.h
@@ -245,7 +245,7 @@ class DagNode {
// values in a suitable way.
class SymbolInfoMap {
public:
- explicit SymbolInfoMap(ArrayRef<llvm::SMLoc> loc) : loc(loc) {}
+ explicit SymbolInfoMap(ArrayRef<SMLoc> loc) : loc(loc) {}
// Class for information regarding a symbol.
class SymbolInfo {
@@ -445,7 +445,7 @@ class SymbolInfoMap {
// Pattern instantiation location. This is intended to be used as parameter
// to PrintFatalError() to report errors.
- ArrayRef<llvm::SMLoc> loc;
+ ArrayRef<SMLoc> loc;
};
// Wrapper class providing helper methods for accessing MLIR Pattern defined
diff --git a/mlir/include/mlir/TableGen/Predicate.h b/mlir/include/mlir/TableGen/Predicate.h
index 88f118a6391d4..2e47afde0b27d 100644
--- a/mlir/include/mlir/TableGen/Predicate.h
+++ b/mlir/include/mlir/TableGen/Predicate.h
@@ -54,7 +54,7 @@ class Pred {
bool isCombined() const;
// Get the location of the predicate.
- ArrayRef<llvm::SMLoc> getLoc() const;
+ ArrayRef<SMLoc> getLoc() const;
// Records are pointer-comparable.
bool operator==(const Pred &other) const { return def == other.def; }
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h b/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
index 273ed57dbbad5..628f7dc4b3cc9 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
@@ -37,14 +37,14 @@ class Diagnostic {
StringRef getMessage() const { return message; }
/// Return the location of this diagnostic.
- llvm::SMRange getLocation() const { return location; }
+ SMRange getLocation() const { return location; }
/// Return the notes of this diagnostic.
auto getNotes() const { return llvm::make_pointee_range(notes); }
/// Attach a note to this diagnostic.
Diagnostic &attachNote(const Twine &msg,
- Optional<llvm::SMRange> noteLoc = llvm::None) {
+ Optional<SMRange> noteLoc = llvm::None) {
assert(getSeverity() != Severity::DK_Note &&
"cannot attach a Note to a Note");
notes.emplace_back(
@@ -57,7 +57,7 @@ class Diagnostic {
operator LogicalResult() const { return failure(); }
private:
- Diagnostic(Severity severity, llvm::SMRange loc, const Twine &msg)
+ Diagnostic(Severity severity, SMRange loc, const Twine &msg)
: severity(severity), message(msg.str()), location(loc) {}
// Allow access to the constructor.
@@ -68,7 +68,7 @@ class Diagnostic {
/// The message held by this diagnostic.
std::string message;
/// The raw location of this diagnostic.
- llvm::SMRange location;
+ SMRange location;
/// Any additional note diagnostics attached to this diagnostic.
std::vector<std::unique_ptr<Diagnostic>> notes;
};
@@ -142,11 +142,11 @@ class DiagnosticEngine {
using HandlerFn = llvm::unique_function<void(Diagnostic &)>;
/// Emit an error to the diagnostic engine.
- InFlightDiagnostic emitError(llvm::SMRange loc, const Twine &msg) {
+ InFlightDiagnostic emitError(SMRange loc, const Twine &msg) {
return InFlightDiagnostic(
this, Diagnostic(Diagnostic::Severity::DK_Error, loc, msg));
}
- InFlightDiagnostic emitWarning(llvm::SMRange loc, const Twine &msg) {
+ InFlightDiagnostic emitWarning(SMRange loc, const Twine &msg) {
return InFlightDiagnostic(
this, Diagnostic(Diagnostic::Severity::DK_Warning, loc, msg));
}
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
index e928edb85ce47..d46b9004b03ad 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
@@ -35,25 +35,25 @@ class VariableDecl;
/// contains a string name as well as the source location for that name.
struct Name {
static const Name &create(Context &ctx, StringRef name,
- llvm::SMRange location);
+ SMRange location);
/// Return the raw string name.
StringRef getName() const { return name; }
/// Get the location of this name.
- llvm::SMRange getLoc() const { return location; }
+ SMRange getLoc() const { return location; }
private:
Name() = delete;
Name(const Name &) = delete;
Name &operator=(const Name &) = delete;
- Name(StringRef name, llvm::SMRange location)
+ Name(StringRef name, SMRange location)
: name(name), location(location) {}
/// The string name of the decl.
StringRef name;
/// The location of the decl name.
- llvm::SMRange location;
+ SMRange location;
};
//===----------------------------------------------------------------------===//
@@ -118,7 +118,7 @@ class Node {
protected:
template <typename... Args>
- explicit NodeBase(llvm::SMRange loc, Args &&...args)
+ explicit NodeBase(SMRange loc, Args &&...args)
: BaseT(TypeID::get<T>(), loc, std::forward<Args>(args)...) {}
};
@@ -126,20 +126,20 @@ class Node {
TypeID getTypeID() const { return typeID; }
/// Return the location of this node.
- llvm::SMRange getLoc() const { return loc; }
+ SMRange getLoc() const { return loc; }
/// Print this node to the given stream.
void print(raw_ostream &os) const;
protected:
- Node(TypeID typeID, llvm::SMRange loc) : typeID(typeID), loc(loc) {}
+ Node(TypeID typeID, SMRange loc) : typeID(typeID), loc(loc) {}
private:
/// A unique type identifier for this node.
TypeID typeID;
/// The location of this node.
- llvm::SMRange loc;
+ SMRange loc;
};
//===----------------------------------------------------------------------===//
@@ -164,7 +164,7 @@ class Stmt : public Node {
class CompoundStmt final : public Node::NodeBase<CompoundStmt, Stmt>,
private llvm::TrailingObjects<CompoundStmt, Stmt *> {
public:
- static CompoundStmt *create(Context &ctx, llvm::SMRange location,
+ static CompoundStmt *create(Context &ctx, SMRange location,
ArrayRef<Stmt *> children);
/// Return the children of this compound statement.
@@ -178,7 +178,7 @@ class CompoundStmt final : public Node::NodeBase<CompoundStmt, Stmt>,
ArrayRef<Stmt *>::iterator end() const { return getChildren().end(); }
private:
- CompoundStmt(llvm::SMRange location, unsigned numChildren)
+ CompoundStmt(SMRange location, unsigned numChildren)
: Base(location), numChildren(numChildren) {}
/// The number of held children statements.
@@ -196,14 +196,14 @@ class CompoundStmt final : public Node::NodeBase<CompoundStmt, Stmt>,
/// to define variables.
class LetStmt final : public Node::NodeBase<LetStmt, Stmt> {
public:
- static LetStmt *create(Context &ctx, llvm::SMRange loc,
+ static LetStmt *create(Context &ctx, SMRange loc,
VariableDecl *varDecl);
/// Return the variable defined by this statement.
VariableDecl *getVarDecl() const { return varDecl; }
private:
- LetStmt(llvm::SMRange loc, VariableDecl *varDecl)
+ LetStmt(SMRange loc, VariableDecl *varDecl)
: Base(loc), varDecl(varDecl) {}
/// The variable defined by this statement.
@@ -225,7 +225,7 @@ class OpRewriteStmt : public Stmt {
Expr *getRootOpExpr() const { return rootOp; }
protected:
- OpRewriteStmt(TypeID typeID, llvm::SMRange loc, Expr *rootOp)
+ OpRewriteStmt(TypeID typeID, SMRange loc, Expr *rootOp)
: Stmt(typeID, loc), rootOp(rootOp) {}
protected:
@@ -241,10 +241,10 @@ class OpRewriteStmt : public Stmt {
/// PatternRewriter::eraseOp API.
class EraseStmt final : public Node::NodeBase<EraseStmt, OpRewriteStmt> {
public:
- static EraseStmt *create(Context &ctx, llvm::SMRange loc, Expr *rootOp);
+ static EraseStmt *create(Context &ctx, SMRange loc, Expr *rootOp);
private:
- EraseStmt(llvm::SMRange loc, Expr *rootOp) : Base(loc, rootOp) {}
+ EraseStmt(SMRange loc, Expr *rootOp) : Base(loc, rootOp) {}
};
//===----------------------------------------------------------------------===//
@@ -256,7 +256,7 @@ class EraseStmt final : public Node::NodeBase<EraseStmt, OpRewriteStmt> {
class ReplaceStmt final : public Node::NodeBase<ReplaceStmt, OpRewriteStmt>,
private llvm::TrailingObjects<ReplaceStmt, Expr *> {
public:
- static ReplaceStmt *create(Context &ctx, llvm::SMRange loc, Expr *rootOp,
+ static ReplaceStmt *create(Context &ctx, SMRange loc, Expr *rootOp,
ArrayRef<Expr *> replExprs);
/// Return the replacement values of this statement.
@@ -268,7 +268,7 @@ class ReplaceStmt final : public Node::NodeBase<ReplaceStmt, OpRewriteStmt>,
}
private:
- ReplaceStmt(llvm::SMRange loc, Expr *rootOp, unsigned numReplExprs)
+ ReplaceStmt(SMRange loc, Expr *rootOp, unsigned numReplExprs)
: Base(loc, rootOp), numReplExprs(numReplExprs) {}
/// The number of replacement values within this statement.
@@ -286,14 +286,14 @@ class ReplaceStmt final : public Node::NodeBase<ReplaceStmt, OpRewriteStmt>,
/// rewrites that span across multiple statements, which may be unconnected.
class RewriteStmt final : public Node::NodeBase<RewriteStmt, OpRewriteStmt> {
public:
- static RewriteStmt *create(Context &ctx, llvm::SMRange loc, Expr *rootOp,
+ static RewriteStmt *create(Context &ctx, SMRange loc, Expr *rootOp,
CompoundStmt *rewriteBody);
/// Return the compound rewrite body.
CompoundStmt *getRewriteBody() const { return rewriteBody; }
private:
- RewriteStmt(llvm::SMRange loc, Expr *rootOp, CompoundStmt *rewriteBody)
+ RewriteStmt(SMRange loc, Expr *rootOp, CompoundStmt *rewriteBody)
: Base(loc, rootOp), rewriteBody(rewriteBody) {}
/// The body of nested rewriters within this statement.
@@ -314,7 +314,7 @@ class Expr : public Stmt {
static bool classof(const Node *node);
protected:
- Expr(TypeID typeID, llvm::SMRange loc, Type type)
+ Expr(TypeID typeID, SMRange loc, Type type)
: Stmt(typeID, loc), type(type) {}
private:
@@ -330,7 +330,7 @@ class Expr : public Stmt {
/// textual assembly format of that attribute.
class AttributeExpr : public Node::NodeBase<AttributeExpr, Expr> {
public:
- static AttributeExpr *create(Context &ctx, llvm::SMRange loc,
+ static AttributeExpr *create(Context &ctx, SMRange loc,
StringRef value);
/// Get the raw value of this expression. This is the textual assembly format
@@ -338,7 +338,7 @@ class AttributeExpr : public Node::NodeBase<AttributeExpr, Expr> {
StringRef getValue() const { return value; }
private:
- AttributeExpr(Context &ctx, llvm::SMRange loc, StringRef value)
+ AttributeExpr(Context &ctx, SMRange loc, StringRef value)
: Base(loc, AttributeType::get(ctx)), value(value) {}
/// The value referenced by this expression.
@@ -352,14 +352,14 @@ class AttributeExpr : public Node::NodeBase<AttributeExpr, Expr> {
/// This expression represents a reference to a Decl node.
class DeclRefExpr : public Node::NodeBase<DeclRefExpr, Expr> {
public:
- static DeclRefExpr *create(Context &ctx, llvm::SMRange loc, Decl *decl,
+ static DeclRefExpr *create(Context &ctx, SMRange loc, Decl *decl,
Type type);
/// Get the decl referenced by this expression.
Decl *getDecl() const { return decl; }
private:
- DeclRefExpr(llvm::SMRange loc, Decl *decl, Type type)
+ DeclRefExpr(SMRange loc, Decl *decl, Type type)
: Base(loc, type), decl(decl) {}
/// The decl referenced by this expression.
@@ -374,7 +374,7 @@ class DeclRefExpr : public Node::NodeBase<DeclRefExpr, Expr> {
/// expression.
class MemberAccessExpr : public Node::NodeBase<MemberAccessExpr, Expr> {
public:
- static MemberAccessExpr *create(Context &ctx, llvm::SMRange loc,
+ static MemberAccessExpr *create(Context &ctx, SMRange loc,
const Expr *parentExpr, StringRef memberName,
Type type);
@@ -385,7 +385,7 @@ class MemberAccessExpr : public Node::NodeBase<MemberAccessExpr, Expr> {
StringRef getMemberName() const { return memberName; }
private:
- MemberAccessExpr(llvm::SMRange loc, const Expr *parentExpr,
+ MemberAccessExpr(SMRange loc, const Expr *parentExpr,
StringRef memberName, Type type)
: Base(loc, type), parentExpr(parentExpr), memberName(memberName) {}
@@ -406,7 +406,7 @@ class AllResultsMemberAccessExpr : public MemberAccessExpr {
/// Return the member name used for the "all-results" access.
static StringRef getMemberName() { return "$results"; }
- static AllResultsMemberAccessExpr *create(Context &ctx, llvm::SMRange loc,
+ static AllResultsMemberAccessExpr *create(Context &ctx, SMRange loc,
const Expr *parentExpr, Type type) {
return cast<AllResultsMemberAccessExpr>(
MemberAccessExpr::create(ctx, loc, parentExpr, getMemberName(), type));
@@ -431,7 +431,7 @@ class OperationExpr final
private llvm::TrailingObjects<OperationExpr, Expr *,
NamedAttributeDecl *> {
public:
- static OperationExpr *create(Context &ctx, llvm::SMRange loc,
+ static OperationExpr *create(Context &ctx, SMRange loc,
const OpNameDecl *nameDecl,
ArrayRef<Expr *> operands,
ArrayRef<Expr *> resultTypes,
@@ -445,7 +445,7 @@ class OperationExpr final
/// Return the location of the name of the operation expression, or an invalid
/// location if there isn't a name.
- llvm::SMRange getNameLoc() const { return nameLoc; }
+ SMRange getNameLoc() const { return nameLoc; }
/// Return the operands of this operation.
MutableArrayRef<Expr *> getOperands() {
@@ -472,9 +472,9 @@ class OperationExpr final
}
private:
- OperationExpr(llvm::SMRange loc, Type type, const OpNameDecl *nameDecl,
+ OperationExpr(SMRange loc, Type type, const OpNameDecl *nameDecl,
unsigned numOperands, unsigned numResultTypes,
- unsigned numAttributes, llvm::SMRange nameLoc)
+ unsigned numAttributes, SMRange nameLoc)
: Base(loc, type), nameDecl(nameDecl), numOperands(numOperands),
numResultTypes(numResultTypes), numAttributes(numAttributes),
nameLoc(nameLoc) {}
@@ -486,7 +486,7 @@ class OperationExpr final
unsigned numOperands, numResultTypes, numAttributes;
/// The location of the operation name in the expression if it has a name.
- llvm::SMRange nameLoc;
+ SMRange nameLoc;
/// TrailingObject utilities.
friend llvm::TrailingObjects<OperationExpr, Expr *, NamedAttributeDecl *>;
@@ -503,7 +503,7 @@ class OperationExpr final
class TupleExpr final : public Node::NodeBase<TupleExpr, Expr>,
private llvm::TrailingObjects<TupleExpr, Expr *> {
public:
- static TupleExpr *create(Context &ctx, llvm::SMRange loc,
+ static TupleExpr *create(Context &ctx, SMRange loc,
ArrayRef<Expr *> elements,
ArrayRef<StringRef> elementNames);
@@ -519,7 +519,7 @@ class TupleExpr final : public Node::NodeBase<TupleExpr, Expr>,
TupleType getType() const { return Base::getType().cast<TupleType>(); }
private:
- TupleExpr(llvm::SMRange loc, TupleType type) : Base(loc, type) {}
+ TupleExpr(SMRange loc, TupleType type) : Base(loc, type) {}
/// TrailingObject utilities.
friend class llvm::TrailingObjects<TupleExpr, Expr *>;
@@ -533,14 +533,14 @@ class TupleExpr final : public Node::NodeBase<TupleExpr, Expr>,
/// assembly format of that type.
class TypeExpr : public Node::NodeBase<TypeExpr, Expr> {
public:
- static TypeExpr *create(Context &ctx, llvm::SMRange loc, StringRef value);
+ static TypeExpr *create(Context &ctx, SMRange loc, StringRef value);
/// Get the raw value of this expression. This is the textual assembly format
/// of the MLIR Type.
StringRef getValue() const { return value; }
private:
- TypeExpr(Context &ctx, llvm::SMRange loc, StringRef value)
+ TypeExpr(Context &ctx, SMRange loc, StringRef value)
: Base(loc, TypeType::get(ctx)), value(value) {}
/// The value referenced by this expression.
@@ -561,7 +561,7 @@ class Decl : public Node {
static bool classof(const Node *node);
protected:
- Decl(TypeID typeID, llvm::SMRange loc, const Name *name = nullptr)
+ Decl(TypeID typeID, SMRange loc, const Name *name = nullptr)
: Node(typeID, loc), name(name) {}
private:
@@ -582,20 +582,20 @@ class ConstraintDecl : public Decl {
static bool classof(const Node *node);
protected:
- ConstraintDecl(TypeID typeID, llvm::SMRange loc, const Name *name = nullptr)
+ ConstraintDecl(TypeID typeID, SMRange loc, const Name *name = nullptr)
: Decl(typeID, loc, name) {}
};
/// This class represents a reference to a constraint, and contains a constraint
/// and the location of the reference.
struct ConstraintRef {
- ConstraintRef(const ConstraintDecl *constraint, llvm::SMRange refLoc)
+ ConstraintRef(const ConstraintDecl *constraint, SMRange refLoc)
: constraint(constraint), referenceLoc(refLoc) {}
explicit ConstraintRef(const ConstraintDecl *constraint)
: ConstraintRef(constraint, constraint->getLoc()) {}
const ConstraintDecl *constraint;
- llvm::SMRange referenceLoc;
+ SMRange referenceLoc;
};
//===----------------------------------------------------------------------===//
@@ -611,7 +611,7 @@ class CoreConstraintDecl : public ConstraintDecl {
static bool classof(const Node *node);
protected:
- CoreConstraintDecl(TypeID typeID, llvm::SMRange loc,
+ CoreConstraintDecl(TypeID typeID, SMRange loc,
const Name *name = nullptr)
: ConstraintDecl(typeID, loc, name) {}
};
@@ -624,7 +624,7 @@ class CoreConstraintDecl : public ConstraintDecl {
class AttrConstraintDecl
: public Node::NodeBase<AttrConstraintDecl, CoreConstraintDecl> {
public:
- static AttrConstraintDecl *create(Context &ctx, llvm::SMRange loc,
+ static AttrConstraintDecl *create(Context &ctx, SMRange loc,
Expr *typeExpr = nullptr);
/// Return the optional type the attribute is constrained to.
@@ -632,7 +632,7 @@ class AttrConstraintDecl
const Expr *getTypeExpr() const { return typeExpr; }
protected:
- AttrConstraintDecl(llvm::SMRange loc, Expr *typeExpr)
+ AttrConstraintDecl(SMRange loc, Expr *typeExpr)
: Base(loc), typeExpr(typeExpr) {}
/// An optional type that the attribute is constrained to.
@@ -647,7 +647,7 @@ class AttrConstraintDecl
class OpConstraintDecl
: public Node::NodeBase<OpConstraintDecl, CoreConstraintDecl> {
public:
- static OpConstraintDecl *create(Context &ctx, llvm::SMRange loc,
+ static OpConstraintDecl *create(Context &ctx, SMRange loc,
const OpNameDecl *nameDecl = nullptr);
/// Return the name of the operation, or None if there isn't one.
@@ -657,7 +657,7 @@ class OpConstraintDecl
const OpNameDecl *getNameDecl() const { return nameDecl; }
protected:
- explicit OpConstraintDecl(llvm::SMRange loc, const OpNameDecl *nameDecl)
+ explicit OpConstraintDecl(SMRange loc, const OpNameDecl *nameDecl)
: Base(loc), nameDecl(nameDecl) {}
/// The operation name of this constraint.
@@ -672,7 +672,7 @@ class OpConstraintDecl
class TypeConstraintDecl
: public Node::NodeBase<TypeConstraintDecl, CoreConstraintDecl> {
public:
- static TypeConstraintDecl *create(Context &ctx, llvm::SMRange loc);
+ static TypeConstraintDecl *create(Context &ctx, SMRange loc);
protected:
using Base::Base;
@@ -686,7 +686,7 @@ class TypeConstraintDecl
class TypeRangeConstraintDecl
: public Node::NodeBase<TypeRangeConstraintDecl, CoreConstraintDecl> {
public:
- static TypeRangeConstraintDecl *create(Context &ctx, llvm::SMRange loc);
+ static TypeRangeConstraintDecl *create(Context &ctx, SMRange loc);
protected:
using Base::Base;
@@ -700,7 +700,7 @@ class TypeRangeConstraintDecl
class ValueConstraintDecl
: public Node::NodeBase<ValueConstraintDecl, CoreConstraintDecl> {
public:
- static ValueConstraintDecl *create(Context &ctx, llvm::SMRange loc,
+ static ValueConstraintDecl *create(Context &ctx, SMRange loc,
Expr *typeExpr);
/// Return the optional type the value is constrained to.
@@ -708,7 +708,7 @@ class ValueConstraintDecl
const Expr *getTypeExpr() const { return typeExpr; }
protected:
- ValueConstraintDecl(llvm::SMRange loc, Expr *typeExpr)
+ ValueConstraintDecl(SMRange loc, Expr *typeExpr)
: Base(loc), typeExpr(typeExpr) {}
/// An optional type that the value is constrained to.
@@ -723,7 +723,7 @@ class ValueConstraintDecl
class ValueRangeConstraintDecl
: public Node::NodeBase<ValueRangeConstraintDecl, CoreConstraintDecl> {
public:
- static ValueRangeConstraintDecl *create(Context &ctx, llvm::SMRange loc,
+ static ValueRangeConstraintDecl *create(Context &ctx, SMRange loc,
Expr *typeExpr);
/// Return the optional type the value range is constrained to.
@@ -731,7 +731,7 @@ class ValueRangeConstraintDecl
const Expr *getTypeExpr() const { return typeExpr; }
protected:
- ValueRangeConstraintDecl(llvm::SMRange loc, Expr *typeExpr)
+ ValueRangeConstraintDecl(SMRange loc, Expr *typeExpr)
: Base(loc), typeExpr(typeExpr) {}
/// An optional type that the value range is constrained to.
@@ -771,7 +771,7 @@ class NamedAttributeDecl : public Node::NodeBase<NamedAttributeDecl, Decl> {
class OpNameDecl : public Node::NodeBase<OpNameDecl, Decl> {
public:
static OpNameDecl *create(Context &ctx, const Name &name);
- static OpNameDecl *create(Context &ctx, llvm::SMRange loc);
+ static OpNameDecl *create(Context &ctx, SMRange loc);
/// Return the name of this operation, or none if the name is unknown.
Optional<StringRef> getName() const {
@@ -781,7 +781,7 @@ class OpNameDecl : public Node::NodeBase<OpNameDecl, Decl> {
private:
explicit OpNameDecl(const Name &name) : Base(name.getLoc(), &name) {}
- explicit OpNameDecl(llvm::SMRange loc) : Base(loc) {}
+ explicit OpNameDecl(SMRange loc) : Base(loc) {}
};
//===----------------------------------------------------------------------===//
@@ -791,7 +791,7 @@ class OpNameDecl : public Node::NodeBase<OpNameDecl, Decl> {
/// This Decl represents a single Pattern.
class PatternDecl : public Node::NodeBase<PatternDecl, Decl> {
public:
- static PatternDecl *create(Context &ctx, llvm::SMRange location,
+ static PatternDecl *create(Context &ctx, SMRange location,
const Name *name, Optional<uint16_t> benefit,
bool hasBoundedRecursion,
const CompoundStmt *body);
@@ -811,7 +811,7 @@ class PatternDecl : public Node::NodeBase<PatternDecl, Decl> {
}
private:
- PatternDecl(llvm::SMRange loc, const Name *name, Optional<uint16_t> benefit,
+ PatternDecl(SMRange loc, const Name *name, Optional<uint16_t> benefit,
bool hasBoundedRecursion, const CompoundStmt *body)
: Base(loc, name), benefit(benefit),
hasBoundedRecursion(hasBoundedRecursion), patternBody(body) {}
@@ -884,7 +884,7 @@ class VariableDecl final
class Module final : public Node::NodeBase<Module, Node>,
private llvm::TrailingObjects<Module, Decl *> {
public:
- static Module *create(Context &ctx, llvm::SMLoc loc,
+ static Module *create(Context &ctx, SMLoc loc,
ArrayRef<Decl *> children);
/// Return the children of this module.
@@ -896,8 +896,8 @@ class Module final : public Node::NodeBase<Module, Node>,
}
private:
- Module(llvm::SMLoc loc, unsigned numChildren)
- : Base(llvm::SMRange{loc, loc}), numChildren(numChildren) {}
+ Module(SMLoc loc, unsigned numChildren)
+ : Base(SMRange{loc, loc}), numChildren(numChildren) {}
/// The number of decls held by this module.
unsigned numChildren;
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 121386a09ad72..958c5322e8e00 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -1384,7 +1384,7 @@ static ParseResult parseBound(bool isLower, OperationState &result,
}
// Get the attribute location.
- llvm::SMLoc attrLoc = p.getCurrentLocation();
+ SMLoc attrLoc = p.getCurrentLocation();
Attribute boundAttr;
if (p.parseAttribute(boundAttr, builder.getIndexType(), boundAttrName,
@@ -1458,7 +1458,7 @@ static ParseResult parseAffineForOp(OpAsmParser &parser,
AffineForOp::getStepAttrName(),
builder.getIntegerAttr(builder.getIndexType(), /*value=*/1));
} else {
- llvm::SMLoc stepLoc = parser.getCurrentLocation();
+ SMLoc stepLoc = parser.getCurrentLocation();
IntegerAttr stepAttr;
if (parser.parseAttribute(stepAttr, builder.getIndexType(),
AffineForOp::getStepAttrName().data(),
diff --git a/mlir/lib/Dialect/DLTI/DLTI.cpp b/mlir/lib/Dialect/DLTI/DLTI.cpp
index 1449a2c4691f0..cf1573ded67fd 100644
--- a/mlir/lib/Dialect/DLTI/DLTI.cpp
+++ b/mlir/lib/Dialect/DLTI/DLTI.cpp
@@ -71,7 +71,7 @@ DataLayoutEntryAttr DataLayoutEntryAttr::parse(AsmParser &parser) {
Type type = nullptr;
std::string identifier;
- llvm::SMLoc idLoc = parser.getCurrentLocation();
+ SMLoc idLoc = parser.getCurrentLocation();
OptionalParseResult parsedType = parser.parseOptionalType(type);
if (parsedType.hasValue() && failed(parsedType.getValue()))
return {};
diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index 3260443e81fed..ee49b8c77bbe6 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -170,7 +170,7 @@ Attribute emitc::OpaqueAttr::parse(AsmParser &parser, Type type) {
if (parser.parseLess())
return Attribute();
std::string value;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (parser.parseOptionalString(&value)) {
parser.emitError(loc) << "expected string";
return Attribute();
@@ -197,7 +197,7 @@ Type emitc::OpaqueType::parse(AsmParser &parser) {
if (parser.parseLess())
return Type();
std::string value;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (parser.parseOptionalString(&value) || value.empty()) {
parser.emitError(loc) << "expected non empty string";
return Type();
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index b048491f5d1db..b61bc21ab20d7 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -141,7 +141,7 @@ Type GPUDialect::parseType(DialectAsmParser &parser) const {
return AsyncTokenType::get(context);
if (keyword == "mma_matrix") {
- llvm::SMLoc beginLoc = parser.getNameLoc();
+ SMLoc beginLoc = parser.getNameLoc();
// Parse '<'.
if (parser.parseLess())
diff --git a/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp b/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
index d9209b9012dd5..3409fce67d810 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp
@@ -357,7 +357,7 @@ SerializeToHsacoPass::assembleIsa(const std::string &isa) {
llvm::SourceMgr srcMgr;
srcMgr.AddNewSourceBuffer(llvm::MemoryBuffer::getMemBuffer(isa),
- llvm::SMLoc());
+ SMLoc());
const llvm::MCTargetOptions mcOptions;
std::unique_ptr<llvm::MCRegisterInfo> mri(
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 440fc835e7cbb..30eec4369dd19 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -115,7 +115,7 @@ static ParseResult parseCmpOp(OpAsmParser &parser, OperationState &result) {
StringAttr predicateAttr;
OpAsmParser::OperandType lhs, rhs;
Type type;
- llvm::SMLoc predicateLoc, trailingTypeLoc;
+ SMLoc predicateLoc, trailingTypeLoc;
if (parser.getCurrentLocation(&predicateLoc) ||
parser.parseAttribute(predicateAttr, "predicate", result.attributes) ||
parser.parseOperand(lhs) || parser.parseComma() ||
@@ -194,7 +194,7 @@ static void printAllocaOp(OpAsmPrinter &p, AllocaOp &op) {
static ParseResult parseAllocaOp(OpAsmParser &parser, OperationState &result) {
OpAsmParser::OperandType arraySize;
Type type, elemType;
- llvm::SMLoc trailingTypeLoc;
+ SMLoc trailingTypeLoc;
if (parser.parseOperand(arraySize) || parser.parseKeyword("x") ||
parser.parseType(elemType) ||
parser.parseOptionalAttrDict(result.attributes) || parser.parseColon() ||
@@ -642,7 +642,7 @@ static void printLoadOp(OpAsmPrinter &p, LoadOp &op) {
// Extract the pointee type from the LLVM pointer type wrapped in MLIR. Return
// the resulting type wrapped in MLIR, or nullptr on error.
static Type getLoadStoreElementType(OpAsmParser &parser, Type type,
- llvm::SMLoc trailingTypeLoc) {
+ SMLoc trailingTypeLoc) {
auto llvmTy = type.dyn_cast<LLVM::LLVMPointerType>();
if (!llvmTy)
return parser.emitError(trailingTypeLoc, "expected LLVM pointer type"),
@@ -654,7 +654,7 @@ static Type getLoadStoreElementType(OpAsmParser &parser, Type type,
static ParseResult parseLoadOp(OpAsmParser &parser, OperationState &result) {
OpAsmParser::OperandType addr;
Type type;
- llvm::SMLoc trailingTypeLoc;
+ SMLoc trailingTypeLoc;
if (succeeded(parser.parseOptionalKeyword("volatile")))
result.addAttribute(kVolatileAttrName, parser.getBuilder().getUnitAttr());
@@ -706,7 +706,7 @@ static void printStoreOp(OpAsmPrinter &p, StoreOp &op) {
static ParseResult parseStoreOp(OpAsmParser &parser, OperationState &result) {
OpAsmParser::OperandType addr, value;
Type type;
- llvm::SMLoc trailingTypeLoc;
+ SMLoc trailingTypeLoc;
if (succeeded(parser.parseOptionalKeyword("volatile")))
result.addAttribute(kVolatileAttrName, parser.getBuilder().getUnitAttr());
@@ -790,7 +790,7 @@ static ParseResult parseInvokeOp(OpAsmParser &parser, OperationState &result) {
SmallVector<OpAsmParser::OperandType, 8> operands;
FunctionType funcType;
SymbolRefAttr funcAttr;
- llvm::SMLoc trailingTypeLoc;
+ SMLoc trailingTypeLoc;
Block *normalDest, *unwindDest;
SmallVector<Value, 4> normalOperands, unwindOperands;
Builder &builder = parser.getBuilder();
@@ -1081,7 +1081,7 @@ static ParseResult parseCallOp(OpAsmParser &parser, OperationState &result) {
SmallVector<OpAsmParser::OperandType, 8> operands;
Type type;
SymbolRefAttr funcAttr;
- llvm::SMLoc trailingTypeLoc;
+ SMLoc trailingTypeLoc;
// Parse an operand list that will, in practice, contain 0 or 1 operand. In
// case of an indirect call, there will be 1 operand before `(`. In case of a
@@ -1182,7 +1182,7 @@ static void printExtractElementOp(OpAsmPrinter &p, ExtractElementOp &op) {
// attribute-dict? `:` type
static ParseResult parseExtractElementOp(OpAsmParser &parser,
OperationState &result) {
- llvm::SMLoc loc;
+ SMLoc loc;
OpAsmParser::OperandType vector, position;
Type type, positionType;
if (parser.getCurrentLocation(&loc) || parser.parseOperand(vector) ||
@@ -1231,8 +1231,8 @@ static void printExtractValueOp(OpAsmPrinter &p, ExtractValueOp &op) {
static Type getInsertExtractValueElementType(OpAsmParser &parser,
Type containerType,
ArrayAttr positionAttr,
- llvm::SMLoc attributeLoc,
- llvm::SMLoc typeLoc) {
+ SMLoc attributeLoc,
+ SMLoc typeLoc) {
Type llvmType = containerType;
if (!isCompatibleType(containerType))
return parser.emitError(typeLoc, "expected LLVM IR Dialect type"), nullptr;
@@ -1322,7 +1322,7 @@ static ParseResult parseExtractValueOp(OpAsmParser &parser,
OpAsmParser::OperandType container;
Type containerType;
ArrayAttr positionAttr;
- llvm::SMLoc attributeLoc, trailingTypeLoc;
+ SMLoc attributeLoc, trailingTypeLoc;
if (parser.parseOperand(container) ||
parser.getCurrentLocation(&attributeLoc) ||
@@ -1396,7 +1396,7 @@ static void printInsertElementOp(OpAsmPrinter &p, InsertElementOp &op) {
// attribute-dict? `:` type
static ParseResult parseInsertElementOp(OpAsmParser &parser,
OperationState &result) {
- llvm::SMLoc loc;
+ SMLoc loc;
OpAsmParser::OperandType vector, value, position;
Type vectorType, positionType;
if (parser.getCurrentLocation(&loc) || parser.parseOperand(value) ||
@@ -1449,7 +1449,7 @@ static ParseResult parseInsertValueOp(OpAsmParser &parser,
OpAsmParser::OperandType container, value;
Type containerType;
ArrayAttr positionAttr;
- llvm::SMLoc attributeLoc, trailingTypeLoc;
+ SMLoc attributeLoc, trailingTypeLoc;
if (parser.parseOperand(value) || parser.parseComma() ||
parser.parseOperand(container) ||
@@ -1918,7 +1918,7 @@ static void printShuffleVectorOp(OpAsmPrinter &p, ShuffleVectorOp &op) {
// attribute-dict? `:` type
static ParseResult parseShuffleVectorOp(OpAsmParser &parser,
OperationState &result) {
- llvm::SMLoc loc;
+ SMLoc loc;
OpAsmParser::OperandType v1, v2;
ArrayAttr maskAttr;
Type typeV1, typeV2;
@@ -1985,7 +1985,7 @@ void LLVMFuncOp::build(OpBuilder &builder, OperationState &result,
// Returns a null type if any of the types provided are non-LLVM types, or if
// there is more than one output type.
static Type
-buildLLVMFunctionType(OpAsmParser &parser, llvm::SMLoc loc,
+buildLLVMFunctionType(OpAsmParser &parser, SMLoc loc,
ArrayRef<Type> inputs, ArrayRef<Type> outputs,
function_interface_impl::VariadicFlag variadicFlag) {
Builder &b = parser.getBuilder();
@@ -2216,7 +2216,7 @@ OpFoldResult LLVM::ConstantOp::fold(ArrayRef<Attribute>) { return getValue(); }
// state.
static ParseResult parseAtomicBinOp(OpAsmParser &parser, OperationState &result,
StringRef attrName) {
- llvm::SMLoc loc;
+ SMLoc loc;
StringRef keyword;
if (parser.getCurrentLocation(&loc) || parser.parseKeyword(&keyword))
return failure();
@@ -2243,7 +2243,7 @@ static ParseResult parseAtomicBinOp(OpAsmParser &parser, OperationState &result,
static ParseResult parseAtomicOrdering(OpAsmParser &parser,
OperationState &result,
StringRef attrName) {
- llvm::SMLoc loc;
+ SMLoc loc;
StringRef ordering;
if (parser.getCurrentLocation(&loc) || parser.parseKeyword(&ordering))
return failure();
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
index bca0a5800d919..1c91007897c09 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp
@@ -177,7 +177,7 @@ static ParseResult dispatchParse(AsmParser &parser, Type &type);
/// Parses an LLVM dialect function type.
/// llvm-type :: = `func<` llvm-type `(` llvm-type-list `...`? `)>`
static LLVMFunctionType parseFunctionType(AsmParser &parser) {
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
Type returnType;
if (parser.parseLess() || dispatchParse(parser, returnType) ||
parser.parseLParen())
@@ -216,7 +216,7 @@ static LLVMFunctionType parseFunctionType(AsmParser &parser) {
/// Parses an LLVM dialect pointer type.
/// llvm-type ::= `ptr<` llvm-type (`,` integer)? `>`
static LLVMPointerType parsePointerType(AsmParser &parser) {
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
Type elementType;
if (parser.parseLess() || dispatchParse(parser, elementType))
return LLVMPointerType();
@@ -235,9 +235,9 @@ static LLVMPointerType parsePointerType(AsmParser &parser) {
/// Supports both fixed and scalable vectors.
static Type parseVectorType(AsmParser &parser) {
SmallVector<int64_t, 2> dims;
- llvm::SMLoc dimPos, typePos;
+ SMLoc dimPos, typePos;
Type elementType;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (parser.parseLess() || parser.getCurrentLocation(&dimPos) ||
parser.parseDimensionList(dims, /*allowDynamic=*/true) ||
parser.getCurrentLocation(&typePos) ||
@@ -271,9 +271,9 @@ static Type parseVectorType(AsmParser &parser) {
/// llvm-type ::= `array<` integer `x` llvm-type `>`
static LLVMArrayType parseArrayType(AsmParser &parser) {
SmallVector<int64_t, 1> dims;
- llvm::SMLoc sizePos;
+ SMLoc sizePos;
Type elementType;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (parser.parseLess() || parser.getCurrentLocation(&sizePos) ||
parser.parseDimensionList(dims, /*allowDynamic=*/false) ||
dispatchParse(parser, elementType) || parser.parseGreater())
@@ -292,7 +292,7 @@ static LLVMArrayType parseArrayType(AsmParser &parser) {
static LLVMStructType trySetStructBody(LLVMStructType type,
ArrayRef<Type> subtypes, bool isPacked,
AsmParser &parser,
- llvm::SMLoc subtypesLoc) {
+ SMLoc subtypesLoc) {
for (Type t : subtypes) {
if (!LLVMStructType::isValidElementType(t)) {
parser.emitError(subtypesLoc)
@@ -352,7 +352,7 @@ static LLVMStructType parseStructType(AsmParser &parser) {
}
// Handle intentionally opaque structs.
- llvm::SMLoc kwLoc = parser.getCurrentLocation();
+ SMLoc kwLoc = parser.getCurrentLocation();
if (succeeded(parser.parseOptionalKeyword("opaque"))) {
if (!isIdentified)
return parser.emitError(kwLoc, "only identified structs can be opaque"),
@@ -388,7 +388,7 @@ static LLVMStructType parseStructType(AsmParser &parser) {
// Parse subtypes. For identified structs, put the identifier of the struct on
// the stack to support self-references in the recursive calls.
SmallVector<Type, 4> subtypes;
- llvm::SMLoc subtypesLoc = parser.getCurrentLocation();
+ SMLoc subtypesLoc = parser.getCurrentLocation();
do {
if (isIdentified)
knownStructNames.insert(name);
@@ -417,7 +417,7 @@ static LLVMStructType parseStructType(AsmParser &parser) {
/// prefix), and on failure fall back to parsing the short-hand version of the
/// LLVM dialect types without the `!llvm` prefix.
static Type dispatchParse(AsmParser &parser, bool allowAny = true) {
- llvm::SMLoc keyLoc = parser.getCurrentLocation();
+ SMLoc keyLoc = parser.getCurrentLocation();
// Try parsing any MLIR type.
Type type;
@@ -464,7 +464,7 @@ static ParseResult dispatchParse(AsmParser &parser, Type &type) {
/// Parses one of the LLVM dialect types.
Type mlir::LLVM::detail::parseType(DialectAsmParser &parser) {
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
Type type = dispatchParse(parser, /*allowAny=*/false);
if (!type)
return type;
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index b3067109b4365..d7c5c622b1a6d 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -1104,7 +1104,7 @@ static void print(OpAsmPrinter &p, linalg::YieldOp op) {
static ParseResult parseYieldOp(OpAsmParser &parser, OperationState &result) {
SmallVector<OpAsmParser::OperandType, 2> opInfo;
SmallVector<Type, 2> types;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
return failure(parser.parseOperandList(opInfo) ||
parser.parseOptionalAttrDict(result.attributes) ||
(!opInfo.empty() && parser.parseColonTypeList(types)) ||
@@ -1318,7 +1318,7 @@ static ParseResult parseTiledLoopOp(OpAsmParser &parser,
SmallVector<OpAsmParser::OperandType, 4> inputs, inputRegionArgs;
SmallVector<Type, 4> inputTypes;
if (succeeded(parser.parseOptionalKeyword("ins"))) {
- llvm::SMLoc inputsOperandsLoc = parser.getCurrentLocation();
+ SMLoc inputsOperandsLoc = parser.getCurrentLocation();
if (parser.parseAssignmentListWithTypes(inputRegionArgs, inputs,
inputTypes))
@@ -1333,7 +1333,7 @@ static ParseResult parseTiledLoopOp(OpAsmParser &parser,
SmallVector<OpAsmParser::OperandType, 4> outputs, outputRegionArgs;
SmallVector<Type, 4> outputTypes;
if (succeeded(parser.parseOptionalKeyword("outs"))) {
- llvm::SMLoc outputsOperandsLoc = parser.getCurrentLocation();
+ SMLoc outputsOperandsLoc = parser.getCurrentLocation();
if (parser.parseAssignmentListWithTypes(outputRegionArgs, outputs,
outputTypes))
@@ -1943,7 +1943,7 @@ static ParseResult
parseCommonStructuredOpParts(OpAsmParser &parser, OperationState &result,
SmallVectorImpl<Type> &inputTypes,
SmallVectorImpl<Type> &outputTypes) {
- llvm::SMLoc inputsOperandsLoc, outputsOperandsLoc;
+ SMLoc inputsOperandsLoc, outputsOperandsLoc;
SmallVector<OpAsmParser::OperandType, 4> inputsOperands, outputsOperands;
parser.parseOptionalAttrDict(result.attributes);
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index 0c29607d4601f..b2ad93a871def 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -2296,7 +2296,7 @@ static ParseResult parseViewOp(OpAsmParser &parser, OperationState &result) {
SmallVector<OpAsmParser::OperandType, 4> sizesInfo;
auto indexType = parser.getBuilder().getIndexType();
Type srcType, dstType;
- llvm::SMLoc offsetLoc;
+ SMLoc offsetLoc;
if (parser.parseOperand(srcInfo) || parser.getCurrentLocation(&offsetLoc) ||
parser.parseOperandList(offsetInfo, OpAsmParser::Delimiter::Square))
return failure();
diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index ebbebf6371434..46a2bf3019e08 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -573,7 +573,7 @@ static ParseResult parseClauseAttr(AsmParser &parser, OperationState &state,
StringRef attrName, StringRef name) {
using ClauseT = decltype(std::declval<ClauseAttr>().getValue());
StringRef enumStr;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (parser.parseLParen() || parser.parseKeyword(&enumStr) ||
parser.parseRParen())
return failure();
@@ -749,7 +749,7 @@ static ParseResult parseClauses(OpAsmParser &parser, OperationState &result,
clauseSegments[pos[allocateClause] + 1] = allocators.size();
} else if (clauseKeyword == "default") {
StringRef defval;
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (checkAllowed(defaultClause) || parser.parseLParen() ||
parser.parseKeyword(&defval) || parser.parseRParen())
return failure();
@@ -937,7 +937,7 @@ static ParseResult parseClauses(OpAsmParser &parser, OperationState &result,
"invalid schedule kind");
}
if (!modifiers.empty()) {
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (Optional<ScheduleModifier> mod =
symbolizeScheduleModifier(modifiers[0])) {
result.addAttribute(
diff --git a/mlir/lib/Dialect/PDL/IR/PDLTypes.cpp b/mlir/lib/Dialect/PDL/IR/PDLTypes.cpp
index c92251971d26e..13e19d4276ebe 100644
--- a/mlir/lib/Dialect/PDL/IR/PDLTypes.cpp
+++ b/mlir/lib/Dialect/PDL/IR/PDLTypes.cpp
@@ -69,7 +69,7 @@ Type RangeType::parse(AsmParser &parser) {
if (parser.parseLess())
return Type();
- llvm::SMLoc elementLoc = parser.getCurrentLocation();
+ SMLoc elementLoc = parser.getCurrentLocation();
Type elementType = parsePDLType(parser);
if (!elementType || parser.parseGreater())
return Type();
diff --git a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp
index 72d679054308c..818d328a9b65e 100644
--- a/mlir/lib/Dialect/Quant/IR/TypeParser.cpp
+++ b/mlir/lib/Dialect/Quant/IR/TypeParser.cpp
@@ -78,7 +78,7 @@ static ParseResult parseStorageRange(DialectAsmParser &parser,
}
// Explicit storage min and storage max.
- llvm::SMLoc minLoc = parser.getCurrentLocation(), maxLoc;
+ SMLoc minLoc = parser.getCurrentLocation(), maxLoc;
if (parser.parseInteger(storageTypeMin) || parser.parseColon() ||
parser.getCurrentLocation(&maxLoc) ||
parser.parseInteger(storageTypeMax) || parser.parseGreater())
@@ -252,7 +252,7 @@ static Type parseUniformType(DialectAsmParser &parser) {
}
// Parse scales/zeroPoints.
- llvm::SMLoc scaleZPLoc = parser.getCurrentLocation();
+ SMLoc scaleZPLoc = parser.getCurrentLocation();
do {
scales.resize(scales.size() + 1);
zeroPoints.resize(zeroPoints.size() + 1);
diff --git a/mlir/lib/Dialect/SCF/SCF.cpp b/mlir/lib/Dialect/SCF/SCF.cpp
index 807b0b6df78d8..edae94cc9e748 100644
--- a/mlir/lib/Dialect/SCF/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/SCF.cpp
@@ -2189,7 +2189,7 @@ static ParseResult parseWhileOp(OpAsmParser &parser, OperationState &result) {
return failure();
FunctionType functionType;
- llvm::SMLoc typeLoc = parser.getCurrentLocation();
+ SMLoc typeLoc = parser.getCurrentLocation();
if (failed(parser.parseColonType(functionType)))
return failure();
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
index e48ded448717e..96d919971e17d 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
@@ -155,7 +155,7 @@ Optional<unsigned> parseAndVerify<unsigned>(SPIRVDialect const &dialect,
static Type parseAndVerifyType(SPIRVDialect const &dialect,
DialectAsmParser &parser) {
Type type;
- llvm::SMLoc typeLoc = parser.getCurrentLocation();
+ SMLoc typeLoc = parser.getCurrentLocation();
if (parser.parseType(type))
return Type();
@@ -199,7 +199,7 @@ static Type parseAndVerifyType(SPIRVDialect const &dialect,
static Type parseAndVerifyMatrixType(SPIRVDialect const &dialect,
DialectAsmParser &parser) {
Type type;
- llvm::SMLoc typeLoc = parser.getCurrentLocation();
+ SMLoc typeLoc = parser.getCurrentLocation();
if (parser.parseType(type))
return Type();
@@ -235,7 +235,7 @@ static Type parseAndVerifyMatrixType(SPIRVDialect const &dialect,
static Type parseAndVerifySampledImageType(SPIRVDialect const &dialect,
DialectAsmParser &parser) {
Type type;
- llvm::SMLoc typeLoc = parser.getCurrentLocation();
+ SMLoc typeLoc = parser.getCurrentLocation();
if (parser.parseType(type))
return Type();
@@ -263,7 +263,7 @@ static LogicalResult parseOptionalArrayStride(const SPIRVDialect &dialect,
if (parser.parseKeyword("stride") || parser.parseEqual())
return failure();
- llvm::SMLoc strideLoc = parser.getCurrentLocation();
+ SMLoc strideLoc = parser.getCurrentLocation();
Optional<unsigned> optStride = parseAndVerify<unsigned>(dialect, parser);
if (!optStride)
return failure();
@@ -288,7 +288,7 @@ static Type parseArrayType(SPIRVDialect const &dialect,
return Type();
SmallVector<int64_t, 1> countDims;
- llvm::SMLoc countLoc = parser.getCurrentLocation();
+ SMLoc countLoc = parser.getCurrentLocation();
if (parser.parseDimensionList(countDims, /*allowDynamic=*/false))
return Type();
if (countDims.size() != 1) {
@@ -326,7 +326,7 @@ static Type parseCooperativeMatrixType(SPIRVDialect const &dialect,
return Type();
SmallVector<int64_t, 2> dims;
- llvm::SMLoc countLoc = parser.getCurrentLocation();
+ SMLoc countLoc = parser.getCurrentLocation();
if (parser.parseDimensionList(dims, /*allowDynamic=*/false))
return Type();
@@ -367,7 +367,7 @@ static Type parsePointerType(SPIRVDialect const &dialect,
return Type();
StringRef storageClassSpec;
- llvm::SMLoc storageClassLoc = parser.getCurrentLocation();
+ SMLoc storageClassLoc = parser.getCurrentLocation();
if (parser.parseComma() || parser.parseKeyword(&storageClassSpec))
return Type();
@@ -409,7 +409,7 @@ static Type parseMatrixType(SPIRVDialect const &dialect,
return Type();
SmallVector<int64_t, 1> countDims;
- llvm::SMLoc countLoc = parser.getCurrentLocation();
+ SMLoc countLoc = parser.getCurrentLocation();
if (parser.parseDimensionList(countDims, /*allowDynamic=*/false))
return Type();
if (countDims.size() != 1) {
@@ -442,7 +442,7 @@ template <typename ValTy>
static Optional<ValTy> parseAndVerify(SPIRVDialect const &dialect,
DialectAsmParser &parser) {
StringRef enumSpec;
- llvm::SMLoc enumLoc = parser.getCurrentLocation();
+ SMLoc enumLoc = parser.getCurrentLocation();
if (parser.parseKeyword(&enumSpec)) {
return llvm::None;
}
@@ -568,7 +568,7 @@ static ParseResult parseStructMemberDecorations(
SmallVectorImpl<StructType::MemberDecorationInfo> &memberDecorationInfo) {
// Check if the first element is offset.
- llvm::SMLoc offsetLoc = parser.getCurrentLocation();
+ SMLoc offsetLoc = parser.getCurrentLocation();
StructType::OffsetInfo offset = 0;
OptionalParseResult offsetParseResult = parser.parseOptionalInteger(offset);
if (offsetParseResult.hasValue()) {
@@ -875,7 +875,7 @@ void SPIRVDialect::printType(Type type, DialectAsmPrinter &os) const {
/// of the parsed keyword, and returns failure if any error occurs.
static ParseResult parseKeywordList(
DialectAsmParser &parser,
- function_ref<LogicalResult(llvm::SMLoc, StringRef)> processKeyword) {
+ function_ref<LogicalResult(SMLoc, StringRef)> processKeyword) {
if (parser.parseLSquare())
return failure();
@@ -992,10 +992,10 @@ static Attribute parseVerCapExtAttr(DialectAsmParser &parser) {
ArrayAttr capabilitiesAttr;
{
SmallVector<Attribute, 4> capabilities;
- llvm::SMLoc errorloc;
+ SMLoc errorloc;
StringRef errorKeyword;
- auto processCapability = [&](llvm::SMLoc loc, StringRef capability) {
+ auto processCapability = [&](SMLoc loc, StringRef capability) {
if (auto capSymbol = spirv::symbolizeCapability(capability)) {
capabilities.push_back(
builder.getI32IntegerAttr(static_cast<uint32_t>(*capSymbol)));
@@ -1015,10 +1015,10 @@ static Attribute parseVerCapExtAttr(DialectAsmParser &parser) {
ArrayAttr extensionsAttr;
{
SmallVector<Attribute, 1> extensions;
- llvm::SMLoc errorloc;
+ SMLoc errorloc;
StringRef errorKeyword;
- auto processExtension = [&](llvm::SMLoc loc, StringRef extension) {
+ auto processExtension = [&](SMLoc loc, StringRef extension) {
if (spirv::symbolizeExtension(extension)) {
extensions.push_back(builder.getStringAttr(extension));
return success();
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
index cf764eaa71c47..ff81086d5f573 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
@@ -695,7 +695,7 @@ static Type getElementType(Type type, Attribute indices, Location loc) {
}
static Type getElementType(Type type, Attribute indices, OpAsmParser &parser,
- llvm::SMLoc loc) {
+ SMLoc loc) {
auto errorFn = [&](StringRef err) -> InFlightDiagnostic {
return parser.emitError(loc, err);
};
@@ -721,7 +721,7 @@ static ParseResult parseAtomicUpdateOp(OpAsmParser &parser,
SmallVector<OpAsmParser::OperandType, 2> operandInfo;
OpAsmParser::OperandType ptrInfo, valueInfo;
Type type;
- llvm::SMLoc loc;
+ SMLoc loc;
if (parseEnumStrAttr(scope, parser, state, kMemoryScopeAttrName) ||
parseEnumStrAttr(memoryScope, parser, state, kSemanticsAttrName) ||
parser.parseOperandList(operandInfo, (hasValue ? 2 : 1)) ||
@@ -1508,7 +1508,7 @@ static ParseResult parseCompositeExtractOp(OpAsmParser &parser,
OpAsmParser::OperandType compositeInfo;
Attribute indicesAttr;
Type compositeType;
- llvm::SMLoc attrLocation;
+ SMLoc attrLocation;
if (parser.parseOperand(compositeInfo) ||
parser.getCurrentLocation(&attrLocation) ||
diff --git a/mlir/lib/Dialect/Vector/VectorOps.cpp b/mlir/lib/Dialect/Vector/VectorOps.cpp
index 2e22fc0495bf2..e1289d5e7fad7 100644
--- a/mlir/lib/Dialect/Vector/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/VectorOps.cpp
@@ -900,7 +900,7 @@ static void print(OpAsmPrinter &p, vector::ExtractOp op) {
}
static ParseResult parseExtractOp(OpAsmParser &parser, OperationState &result) {
- llvm::SMLoc attributeLoc, typeLoc;
+ SMLoc attributeLoc, typeLoc;
NamedAttrList attrs;
OpAsmParser::OperandType vector;
Type type;
@@ -2695,7 +2695,7 @@ static void print(OpAsmPrinter &p, TransferReadOp op) {
static ParseResult parseTransferReadOp(OpAsmParser &parser,
OperationState &result) {
auto &builder = parser.getBuilder();
- llvm::SMLoc typesLoc;
+ SMLoc typesLoc;
OpAsmParser::OperandType sourceInfo;
SmallVector<OpAsmParser::OperandType, 8> indexInfo;
OpAsmParser::OperandType paddingInfo;
@@ -3075,7 +3075,7 @@ void TransferWriteOp::build(OpBuilder &builder, OperationState &result,
static ParseResult parseTransferWriteOp(OpAsmParser &parser,
OperationState &result) {
auto &builder = parser.getBuilder();
- llvm::SMLoc typesLoc;
+ SMLoc typesLoc;
OpAsmParser::OperandType vectorInfo, sourceInfo;
SmallVector<OpAsmParser::OperandType, 8> indexInfo;
SmallVector<Type, 2> types;
diff --git a/mlir/lib/ExecutionEngine/JitRunner.cpp b/mlir/lib/ExecutionEngine/JitRunner.cpp
index 37072981a481c..af23d41c1bf77 100644
--- a/mlir/lib/ExecutionEngine/JitRunner.cpp
+++ b/mlir/lib/ExecutionEngine/JitRunner.cpp
@@ -121,7 +121,7 @@ static OwningModuleRef parseMLIRInput(StringRef inputFilename,
}
llvm::SourceMgr sourceMgr;
- sourceMgr.AddNewSourceBuffer(std::move(file), llvm::SMLoc());
+ sourceMgr.AddNewSourceBuffer(std::move(file), SMLoc());
return OwningModuleRef(parseSourceFile(sourceMgr, context));
}
diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp
index e4d58c66d9928..d9459ee4dd8e0 100644
--- a/mlir/lib/IR/Diagnostics.cpp
+++ b/mlir/lib/IR/Diagnostics.cpp
@@ -364,7 +364,7 @@ struct SourceMgrDiagnosticHandlerImpl {
// Otherwise, try to load the source file.
std::string ignored;
unsigned id =
- mgr.AddIncludeFile(std::string(filename), llvm::SMLoc(), ignored);
+ mgr.AddIncludeFile(std::string(filename), SMLoc(), ignored);
filenameToBufId[filename] = id;
return id;
}
@@ -449,7 +449,7 @@ void SourceMgrDiagnosticHandler::emitDiagnostic(Location loc, Twine message,
if (!loc.isa<UnknownLoc>())
strOS << loc << ": ";
strOS << message;
- return mgr.PrintMessage(os, llvm::SMLoc(), getDiagKind(kind), strOS.str());
+ return mgr.PrintMessage(os, SMLoc(), getDiagKind(kind), strOS.str());
}
// Otherwise if we are displaying the source line, try to convert the file
@@ -562,15 +562,15 @@ Optional<Location> SourceMgrDiagnosticHandler::findLocToShow(Location loc) {
/// Get a memory buffer for the given file, or the main file of the source
/// manager if one doesn't exist. This always returns non-null.
-llvm::SMLoc SourceMgrDiagnosticHandler::convertLocToSMLoc(FileLineColLoc loc) {
+SMLoc SourceMgrDiagnosticHandler::convertLocToSMLoc(FileLineColLoc loc) {
// The column and line may be zero to represent unknown column and/or unknown
/// line/column information.
if (loc.getLine() == 0 || loc.getColumn() == 0)
- return llvm::SMLoc();
+ return SMLoc();
unsigned bufferId = impl->getSourceMgrBufferIDForFile(mgr, loc.getFilename());
if (!bufferId)
- return llvm::SMLoc();
+ return SMLoc();
return mgr.FindLocForLineAndColumn(bufferId, loc.getLine(), loc.getColumn());
}
@@ -586,7 +586,7 @@ struct ExpectedDiag {
DiagnosticSeverity kind;
unsigned lineNo;
StringRef substring;
- llvm::SMLoc fileLoc;
+ SMLoc fileLoc;
bool matched;
};
@@ -669,7 +669,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
}
// Point to the start of expected-*.
- auto expectedStart = llvm::SMLoc::getFromPointer(matches[0].data());
+ auto expectedStart = SMLoc::getFromPointer(matches[0].data());
DiagnosticSeverity kind;
if (matches[1] == "error")
@@ -755,8 +755,8 @@ LogicalResult SourceMgrDiagnosticVerifierHandler::verify() {
for (auto &err : expectedDiagsPair.second) {
if (err.matched)
continue;
- llvm::SMRange range(err.fileLoc,
- llvm::SMLoc::getFromPointer(err.fileLoc.getPointer() +
+ SMRange range(err.fileLoc,
+ SMLoc::getFromPointer(err.fileLoc.getPointer() +
err.substring.size()));
mgr.PrintMessage(os, err.fileLoc, llvm::SourceMgr::DK_Error,
"expected " + getDiagKindStr(err.kind) + " \"" +
diff --git a/mlir/lib/IR/FunctionImplementation.cpp b/mlir/lib/IR/FunctionImplementation.cpp
index dd3b40db781b2..665ec18066f91 100644
--- a/mlir/lib/IR/FunctionImplementation.cpp
+++ b/mlir/lib/IR/FunctionImplementation.cpp
@@ -25,7 +25,7 @@ ParseResult mlir::function_interface_impl::parseFunctionArgumentList(
// types, or just be a type list. It isn't ok to sometimes have SSA ID's and
// sometimes not.
auto parseArgument = [&]() -> ParseResult {
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
// Parse argument name if present.
OpAsmParser::OperandType argument;
@@ -80,7 +80,7 @@ ParseResult mlir::function_interface_impl::parseFunctionArgumentList(
if (parseArgument())
return failure();
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (argTypes.size() == numTypedArguments &&
succeeded(parser.parseOptionalComma()))
return parser.emitError(
@@ -212,7 +212,7 @@ ParseResult mlir::function_interface_impl::parseFunctionOp(
return failure();
// Parse the function signature.
- llvm::SMLoc signatureLocation = parser.getCurrentLocation();
+ SMLoc signatureLocation = parser.getCurrentLocation();
bool isVariadic = false;
if (parseFunctionSignature(parser, allowVariadic, entryArgs, argTypes,
argAttrs, argLocations, isVariadic, resultTypes,
@@ -231,7 +231,7 @@ ParseResult mlir::function_interface_impl::parseFunctionOp(
// If function attributes are present, parse them.
NamedAttrList parsedAttributes;
- llvm::SMLoc attributeDictLocation = parser.getCurrentLocation();
+ SMLoc attributeDictLocation = parser.getCurrentLocation();
if (parser.parseOptionalAttrDictWithKeyword(parsedAttributes))
return failure();
@@ -256,7 +256,7 @@ ParseResult mlir::function_interface_impl::parseFunctionOp(
// Parse the optional function body. The printer will not print the body if
// its empty, so disallow parsing of empty body in the parser.
auto *body = result.addRegion();
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
OptionalParseResult parseResult = parser.parseOptionalRegion(
*body, entryArgs, entryArgs.empty() ? ArrayRef<Type>() : argTypes,
entryArgs.empty() ? ArrayRef<Location>() : argLocations,
diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index e06492292c1d2..1ca4d684475bd 100644
--- a/mlir/lib/IR/Operation.cpp
+++ b/mlir/lib/IR/Operation.cpp
@@ -1144,7 +1144,7 @@ ParseResult impl::parseOneResultSameOperandTypeOp(OpAsmParser &parser,
Type type;
// If the operand list is in-between parentheses, then we have a generic form.
// (see the fallback in `printOneResultOp`).
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
if (!parser.parseOptionalLParen()) {
if (parser.parseOperandList(ops) || parser.parseRParen() ||
parser.parseOptionalAttrDict(result.attributes) ||
diff --git a/mlir/lib/Parser/AffineParser.cpp b/mlir/lib/Parser/AffineParser.cpp
index 9bff88a7f1677..7d2dd692fc41d 100644
--- a/mlir/lib/Parser/AffineParser.cpp
+++ b/mlir/lib/Parser/AffineParser.cpp
@@ -17,7 +17,6 @@
using namespace mlir;
using namespace mlir::detail;
-using llvm::SMLoc;
namespace {
@@ -81,13 +80,13 @@ class AffineParser : public Parser {
AffineExpr parseSymbolSSAIdExpr();
AffineExpr getAffineBinaryOpExpr(AffineHighPrecOp op, AffineExpr lhs,
- AffineExpr rhs, llvm::SMLoc opLoc);
+ AffineExpr rhs, SMLoc opLoc);
AffineExpr getAffineBinaryOpExpr(AffineLowPrecOp op, AffineExpr lhs,
AffineExpr rhs);
AffineExpr parseAffineOperandExpr(AffineExpr lhs);
AffineExpr parseAffineLowPrecOpExpr(AffineExpr llhs, AffineLowPrecOp llhsOp);
AffineExpr parseAffineHighPrecOpExpr(AffineExpr llhs, AffineHighPrecOp llhsOp,
- llvm::SMLoc llhsOpLoc);
+ SMLoc llhsOpLoc);
AffineExpr parseAffineConstraint(bool *isEq);
private:
@@ -683,7 +682,7 @@ ParseResult Parser::parseAffineMapOrIntegerSetReference(AffineMap &map,
return AffineParser(state).parseAffineMapOrIntegerSetInline(map, set);
}
ParseResult Parser::parseAffineMapReference(AffineMap &map) {
- llvm::SMLoc curLoc = getToken().getLoc();
+ SMLoc curLoc = getToken().getLoc();
IntegerSet set;
if (parseAffineMapOrIntegerSetReference(map, set))
return failure();
@@ -692,7 +691,7 @@ ParseResult Parser::parseAffineMapReference(AffineMap &map) {
return success();
}
ParseResult Parser::parseIntegerSetReference(IntegerSet &set) {
- llvm::SMLoc curLoc = getToken().getLoc();
+ SMLoc curLoc = getToken().getLoc();
AffineMap map;
if (parseAffineMapOrIntegerSetReference(map, set))
return failure();
diff --git a/mlir/lib/Parser/AsmParserImpl.h b/mlir/lib/Parser/AsmParserImpl.h
index 2292060f35d44..81ed270395a08 100644
--- a/mlir/lib/Parser/AsmParserImpl.h
+++ b/mlir/lib/Parser/AsmParserImpl.h
@@ -25,12 +25,12 @@ namespace detail {
template <typename BaseT>
class AsmParserImpl : public BaseT {
public:
- AsmParserImpl(llvm::SMLoc nameLoc, Parser &parser)
+ AsmParserImpl(SMLoc nameLoc, Parser &parser)
: nameLoc(nameLoc), parser(parser) {}
~AsmParserImpl() override = default;
/// Return the location of the original name token.
- llvm::SMLoc getNameLoc() const override { return nameLoc; }
+ SMLoc getNameLoc() const override { return nameLoc; }
//===--------------------------------------------------------------------===//
// Utilities
@@ -40,7 +40,7 @@ class AsmParserImpl : public BaseT {
bool didEmitError() const { return emittedError; }
/// Emit a diagnostic at the specified location and return failure.
- InFlightDiagnostic emitError(llvm::SMLoc loc, const Twine &message) override {
+ InFlightDiagnostic emitError(SMLoc loc, const Twine &message) override {
emittedError = true;
return parser.emitError(loc, message);
}
@@ -51,12 +51,12 @@ class AsmParserImpl : public BaseT {
/// Get the location of the next token and store it into the argument. This
/// always succeeds.
- llvm::SMLoc getCurrentLocation() override {
+ SMLoc getCurrentLocation() override {
return parser.getToken().getLoc();
}
/// Re-encode the given source location as an MLIR location and return it.
- Location getEncodedSourceLoc(llvm::SMLoc loc) override {
+ Location getEncodedSourceLoc(SMLoc loc) override {
return parser.getEncodedSourceLocation(loc);
}
@@ -291,7 +291,7 @@ class AsmParserImpl : public BaseT {
ParseResult parseFloat(double &result) override {
bool isNegative = parser.consumeIf(Token::minus);
Token curTok = parser.getToken();
- llvm::SMLoc loc = curTok.getLoc();
+ SMLoc loc = curTok.getLoc();
// Check for a floating point value.
if (curTok.is(Token::floatliteral)) {
@@ -491,7 +491,7 @@ class AsmParserImpl : public BaseT {
protected:
/// The source location of the dialect symbol.
- llvm::SMLoc nameLoc;
+ SMLoc nameLoc;
/// The main parser.
Parser &parser;
diff --git a/mlir/lib/Parser/AsmParserState.cpp b/mlir/lib/Parser/AsmParserState.cpp
index c5c0c9cb9a2c7..2d95ddb4a72d3 100644
--- a/mlir/lib/Parser/AsmParserState.cpp
+++ b/mlir/lib/Parser/AsmParserState.cpp
@@ -19,7 +19,7 @@ using namespace mlir;
struct AsmParserState::Impl {
/// A map from a SymbolRefAttr to a range of uses.
using SymbolUseMap =
- DenseMap<Attribute, SmallVector<SmallVector<llvm::SMRange>, 0>>;
+ DenseMap<Attribute, SmallVector<SmallVector<SMRange>, 0>>;
struct PartialOpDef {
explicit PartialOpDef(const OperationName &opName) {
@@ -48,7 +48,7 @@ struct AsmParserState::Impl {
/// A set of value definitions that are placeholders for forward references.
/// This map should be empty if the parser finishes successfully.
- DenseMap<Value, SmallVector<llvm::SMLoc>> placeholderValueUses;
+ DenseMap<Value, SmallVector<SMLoc>> placeholderValueUses;
/// The symbol table operations within the IR.
SmallVector<std::pair<Operation *, std::unique_ptr<SymbolUseMap>>>
@@ -75,7 +75,7 @@ void AsmParserState::Impl::resolveSymbolUses() {
opAndUseMapIt.first, it.first.cast<SymbolRefAttr>(), symbolOps)))
continue;
- for (ArrayRef<llvm::SMRange> useRange : it.second) {
+ for (ArrayRef<SMRange> useRange : it.second) {
for (const auto &symIt : llvm::zip(symbolOps, useRange)) {
auto opIt = operationToIdx.find(std::get<0>(symIt));
if (opIt != operationToIdx.end())
@@ -121,9 +121,9 @@ auto AsmParserState::getOpDef(Operation *op) const
: &*impl->operations[it->second];
}
-llvm::SMRange AsmParserState::convertIdLocToRange(llvm::SMLoc loc) {
+SMRange AsmParserState::convertIdLocToRange(SMLoc loc) {
if (!loc.isValid())
- return llvm::SMRange();
+ return SMRange();
// Return if the given character is a valid identifier character.
auto isIdentifierChar = [](char c) {
@@ -133,7 +133,7 @@ llvm::SMRange AsmParserState::convertIdLocToRange(llvm::SMLoc loc) {
const char *curPtr = loc.getPointer();
while (*curPtr && isIdentifierChar(*(++curPtr)))
continue;
- return llvm::SMRange(loc, llvm::SMLoc::getFromPointer(curPtr));
+ return SMRange(loc, SMLoc::getFromPointer(curPtr));
}
//===----------------------------------------------------------------------===//
@@ -166,8 +166,8 @@ void AsmParserState::startOperationDefinition(const OperationName &opName) {
}
void AsmParserState::finalizeOperationDefinition(
- Operation *op, llvm::SMRange nameLoc, llvm::SMLoc endLoc,
- ArrayRef<std::pair<unsigned, llvm::SMLoc>> resultGroups) {
+ Operation *op, SMRange nameLoc, SMLoc endLoc,
+ ArrayRef<std::pair<unsigned, SMLoc>> resultGroups) {
assert(!impl->partialOperations.empty() &&
"expected valid partial operation definition");
Impl::PartialOpDef partialOpDef = impl->partialOperations.pop_back_val();
@@ -210,7 +210,7 @@ void AsmParserState::finalizeRegionDefinition() {
impl->symbolUseScopes.pop_back();
}
-void AsmParserState::addDefinition(Block *block, llvm::SMLoc location) {
+void AsmParserState::addDefinition(Block *block, SMLoc location) {
auto it = impl->blocksToIdx.find(block);
if (it == impl->blocksToIdx.end()) {
impl->blocksToIdx.try_emplace(block, impl->blocks.size());
@@ -225,7 +225,7 @@ void AsmParserState::addDefinition(Block *block, llvm::SMLoc location) {
}
void AsmParserState::addDefinition(BlockArgument blockArg,
- llvm::SMLoc location) {
+ SMLoc location) {
auto it = impl->blocksToIdx.find(blockArg.getOwner());
assert(it != impl->blocksToIdx.end() &&
"expected owner block to have an entry");
@@ -237,7 +237,7 @@ void AsmParserState::addDefinition(BlockArgument blockArg,
def.arguments[argIdx] = SMDefinition(convertIdLocToRange(location));
}
-void AsmParserState::addUses(Value value, ArrayRef<llvm::SMLoc> locations) {
+void AsmParserState::addUses(Value value, ArrayRef<SMLoc> locations) {
// Handle the case where the value is an operation result.
if (OpResult result = value.dyn_cast<OpResult>()) {
// Check to see if a definition for the parent operation has been recorded.
@@ -258,7 +258,7 @@ void AsmParserState::addUses(Value value, ArrayRef<llvm::SMLoc> locations) {
OperationDefinition &def = *impl->operations[existingIt->second];
for (auto &resultGroup : llvm::reverse(def.resultGroups)) {
if (resultNo >= resultGroup.startIndex) {
- for (llvm::SMLoc loc : locations)
+ for (SMLoc loc : locations)
resultGroup.definition.uses.push_back(convertIdLocToRange(loc));
return;
}
@@ -273,11 +273,11 @@ void AsmParserState::addUses(Value value, ArrayRef<llvm::SMLoc> locations) {
"expected valid block definition for block argument");
BlockDefinition &blockDef = *impl->blocks[existingIt->second];
SMDefinition &argDef = blockDef.arguments[arg.getArgNumber()];
- for (llvm::SMLoc loc : locations)
+ for (SMLoc loc : locations)
argDef.uses.emplace_back(convertIdLocToRange(loc));
}
-void AsmParserState::addUses(Block *block, ArrayRef<llvm::SMLoc> locations) {
+void AsmParserState::addUses(Block *block, ArrayRef<SMLoc> locations) {
auto it = impl->blocksToIdx.find(block);
if (it == impl->blocksToIdx.end()) {
it = impl->blocksToIdx.try_emplace(block, impl->blocks.size()).first;
@@ -285,12 +285,12 @@ void AsmParserState::addUses(Block *block, ArrayRef<llvm::SMLoc> locations) {
}
BlockDefinition &def = *impl->blocks[it->second];
- for (llvm::SMLoc loc : locations)
+ for (SMLoc loc : locations)
def.definition.uses.push_back(convertIdLocToRange(loc));
}
void AsmParserState::addUses(SymbolRefAttr refAttr,
- ArrayRef<llvm::SMRange> locations) {
+ ArrayRef<SMRange> locations) {
// Ignore this symbol if no scopes are active.
if (impl->symbolUseScopes.empty())
return;
diff --git a/mlir/lib/Parser/AttributeParser.cpp b/mlir/lib/Parser/AttributeParser.cpp
index 9807443c7066b..8e6e9d25f8237 100644
--- a/mlir/lib/Parser/AttributeParser.cpp
+++ b/mlir/lib/Parser/AttributeParser.cpp
@@ -154,7 +154,7 @@ Attribute Parser::parseAttribute(Type type) {
case Token::at_identifier: {
// When populating the parser state, this is a list of locations for all of
// the nested references.
- SmallVector<llvm::SMRange> referenceLocations;
+ SmallVector<SMRange> referenceLocations;
if (state.asmState)
referenceLocations.push_back(getToken().getLocRange());
@@ -372,7 +372,7 @@ static Optional<APInt> buildAttributeAPInt(Type type, bool isNegative,
Attribute Parser::parseDecOrHexAttr(Type type, bool isNegative) {
Token tok = getToken();
StringRef spelling = tok.getSpelling();
- llvm::SMLoc loc = tok.getLoc();
+ SMLoc loc = tok.getLoc();
consumeToken(Token::integer);
if (!type) {
@@ -439,24 +439,24 @@ class TensorLiteralParser {
/// Build a dense attribute instance with the parsed elements and the given
/// shaped type.
- DenseElementsAttr getAttr(llvm::SMLoc loc, ShapedType type);
+ DenseElementsAttr getAttr(SMLoc loc, ShapedType type);
ArrayRef<int64_t> getShape() const { return shape; }
private:
/// Get the parsed elements for an integer attribute.
- ParseResult getIntAttrElements(llvm::SMLoc loc, Type eltTy,
+ ParseResult getIntAttrElements(SMLoc loc, Type eltTy,
std::vector<APInt> &intValues);
/// Get the parsed elements for a float attribute.
- ParseResult getFloatAttrElements(llvm::SMLoc loc, FloatType eltTy,
+ ParseResult getFloatAttrElements(SMLoc loc, FloatType eltTy,
std::vector<APFloat> &floatValues);
/// Build a Dense String attribute for the given type.
- DenseElementsAttr getStringAttr(llvm::SMLoc loc, ShapedType type, Type eltTy);
+ DenseElementsAttr getStringAttr(SMLoc loc, ShapedType type, Type eltTy);
/// Build a Dense attribute with hex data for the given type.
- DenseElementsAttr getHexAttr(llvm::SMLoc loc, ShapedType type);
+ DenseElementsAttr getHexAttr(SMLoc loc, ShapedType type);
/// Parse a single element, returning failure if it isn't a valid element
/// literal. For example:
@@ -505,7 +505,7 @@ ParseResult TensorLiteralParser::parse(bool allowHex) {
/// Build a dense attribute instance with the parsed elements and the given
/// shaped type.
-DenseElementsAttr TensorLiteralParser::getAttr(llvm::SMLoc loc,
+DenseElementsAttr TensorLiteralParser::getAttr(SMLoc loc,
ShapedType type) {
Type eltType = type.getElementType();
@@ -571,7 +571,7 @@ DenseElementsAttr TensorLiteralParser::getAttr(llvm::SMLoc loc,
/// Build a Dense Integer attribute for the given type.
ParseResult
-TensorLiteralParser::getIntAttrElements(llvm::SMLoc loc, Type eltTy,
+TensorLiteralParser::getIntAttrElements(SMLoc loc, Type eltTy,
std::vector<APInt> &intValues) {
intValues.reserve(storage.size());
bool isUintType = eltTy.isUnsignedInteger();
@@ -615,7 +615,7 @@ TensorLiteralParser::getIntAttrElements(llvm::SMLoc loc, Type eltTy,
/// Build a Dense Float attribute for the given type.
ParseResult
-TensorLiteralParser::getFloatAttrElements(llvm::SMLoc loc, FloatType eltTy,
+TensorLiteralParser::getFloatAttrElements(SMLoc loc, FloatType eltTy,
std::vector<APFloat> &floatValues) {
floatValues.reserve(storage.size());
for (const auto &signAndToken : storage) {
@@ -656,7 +656,7 @@ TensorLiteralParser::getFloatAttrElements(llvm::SMLoc loc, FloatType eltTy,
}
/// Build a Dense String attribute for the given type.
-DenseElementsAttr TensorLiteralParser::getStringAttr(llvm::SMLoc loc,
+DenseElementsAttr TensorLiteralParser::getStringAttr(SMLoc loc,
ShapedType type,
Type eltTy) {
if (hexStorage.hasValue()) {
@@ -678,7 +678,7 @@ DenseElementsAttr TensorLiteralParser::getStringAttr(llvm::SMLoc loc,
}
/// Build a Dense attribute with hex data for the given type.
-DenseElementsAttr TensorLiteralParser::getHexAttr(llvm::SMLoc loc,
+DenseElementsAttr TensorLiteralParser::getHexAttr(SMLoc loc,
ShapedType type) {
Type elementType = type.getElementType();
if (!elementType.isIntOrIndexOrFloat() && !elementType.isa<ComplexType>()) {
@@ -833,7 +833,7 @@ Attribute Parser::parseDenseElementsAttr(Type attrType) {
/// Parse an opaque elements attribute.
Attribute Parser::parseOpaqueElementsAttr(Type attrType) {
- llvm::SMLoc loc = getToken().getLoc();
+ SMLoc loc = getToken().getLoc();
consumeToken(Token::kw_opaque);
if (parseToken(Token::less, "expected '<' after 'opaque'"))
return nullptr;
@@ -890,7 +890,7 @@ ShapedType Parser::parseElementsLiteralType(Type type) {
/// Parse a sparse elements attribute.
Attribute Parser::parseSparseElementsAttr(Type attrType) {
- llvm::SMLoc loc = getToken().getLoc();
+ SMLoc loc = getToken().getLoc();
consumeToken(Token::kw_sparse);
if (parseToken(Token::less, "Expected '<' after 'sparse'"))
return nullptr;
diff --git a/mlir/lib/Parser/DialectSymbolParser.cpp b/mlir/lib/Parser/DialectSymbolParser.cpp
index ded29d9d1f6b1..c72e720f4a7f5 100644
--- a/mlir/lib/Parser/DialectSymbolParser.cpp
+++ b/mlir/lib/Parser/DialectSymbolParser.cpp
@@ -20,7 +20,6 @@
using namespace mlir;
using namespace mlir::detail;
using llvm::MemoryBuffer;
-using llvm::SMLoc;
using llvm::SourceMgr;
namespace {
@@ -157,7 +156,7 @@ static Symbol parseExtendedSymbol(Parser &p, Token::Kind identifierTok,
return (p.emitError("expected string literal data in dialect symbol"),
nullptr);
symbolData = p.getToken().getStringValue();
- loc = llvm::SMLoc::getFromPointer(p.getToken().getLoc().getPointer() + 1);
+ loc = SMLoc::getFromPointer(p.getToken().getLoc().getPointer() + 1);
p.consumeToken(Token::string);
// Consume the '>'.
@@ -169,7 +168,7 @@ static Symbol parseExtendedSymbol(Parser &p, Token::Kind identifierTok,
auto dotHalves = identifier.split('.');
dialectName = dotHalves.first;
auto prettyName = dotHalves.second;
- loc = llvm::SMLoc::getFromPointer(prettyName.data());
+ loc = SMLoc::getFromPointer(prettyName.data());
// If the dialect's symbol is followed immediately by a <, then lex the body
// of it into prettyName.
@@ -183,7 +182,7 @@ static Symbol parseExtendedSymbol(Parser &p, Token::Kind identifierTok,
}
// Record the name location of the type remapped to the top level buffer.
- llvm::SMLoc locInTopLevelBuffer = p.remapLocationToTopLevelBuffer(loc);
+ SMLoc locInTopLevelBuffer = p.remapLocationToTopLevelBuffer(loc);
p.getState().symbols.nestedParserLocs.push_back(locInTopLevelBuffer);
// Call into the provided symbol construction function.
@@ -239,7 +238,7 @@ Attribute Parser::parseExtendedAttr(Type type) {
Attribute attr = parseExtendedSymbol<Attribute>(
*this, Token::hash_identifier, state.symbols.attributeAliasDefinitions,
[&](StringRef dialectName, StringRef symbolData,
- llvm::SMLoc loc) -> Attribute {
+ SMLoc loc) -> Attribute {
// Parse an optional trailing colon type.
Type attrType = type;
if (consumeIf(Token::colon) && !(attrType = parseType()))
@@ -282,7 +281,7 @@ Type Parser::parseExtendedType() {
return parseExtendedSymbol<Type>(
*this, Token::exclamation_identifier, state.symbols.typeAliasDefinitions,
[&](StringRef dialectName, StringRef symbolData,
- llvm::SMLoc loc) -> Type {
+ SMLoc loc) -> Type {
// If we found a registered dialect, then ask it to parse the type.
auto *dialect = state.context->getOrLoadDialect(dialectName);
diff --git a/mlir/lib/Parser/Lexer.cpp b/mlir/lib/Parser/Lexer.cpp
index 5a882d08594fb..8d48a60948a85 100644
--- a/mlir/lib/Parser/Lexer.cpp
+++ b/mlir/lib/Parser/Lexer.cpp
@@ -17,9 +17,8 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/SourceMgr.h"
-using namespace mlir;
-using llvm::SMLoc;
+using namespace mlir;
// Returns true if 'c' is an allowable punctuation character: [$._-]
// Returns false otherwise.
@@ -36,7 +35,7 @@ Lexer::Lexer(const llvm::SourceMgr &sourceMgr, MLIRContext *context)
/// Encode the specified source location information into an attribute for
/// attachment to the IR.
-Location Lexer::getEncodedSourceLocation(llvm::SMLoc loc) {
+Location Lexer::getEncodedSourceLocation(SMLoc loc) {
auto &sourceMgr = getSourceMgr();
unsigned mainFileID = sourceMgr.getMainFileID();
diff --git a/mlir/lib/Parser/Lexer.h b/mlir/lib/Parser/Lexer.h
index 8f24d08dfbe73..1df6ff82d3415 100644
--- a/mlir/lib/Parser/Lexer.h
+++ b/mlir/lib/Parser/Lexer.h
@@ -30,7 +30,7 @@ class Lexer {
/// Encode the specified source location information into a Location object
/// for attachment to the IR or error reporting.
- Location getEncodedSourceLocation(llvm::SMLoc loc);
+ Location getEncodedSourceLocation(SMLoc loc);
/// Change the position of the lexer cursor. The next token we lex will start
/// at the designated point in the input.
diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp
index ad7abbb9368a7..54e4e762d5640 100644
--- a/mlir/lib/Parser/Parser.cpp
+++ b/mlir/lib/Parser/Parser.cpp
@@ -29,7 +29,6 @@
using namespace mlir;
using namespace mlir::detail;
using llvm::MemoryBuffer;
-using llvm::SMLoc;
using llvm::SourceMgr;
//===----------------------------------------------------------------------===//
@@ -198,7 +197,7 @@ OptionalParseResult Parser::parseOptionalInteger(APInt &result) {
ParseResult Parser::parseFloatFromIntegerLiteral(
Optional<APFloat> &result, const Token &tok, bool isNegative,
const llvm::fltSemantics &semantics, size_t typeSizeInBits) {
- llvm::SMLoc loc = tok.getLoc();
+ SMLoc loc = tok.getLoc();
StringRef spelling = tok.getSpelling();
bool isHex = spelling.size() > 1 && spelling[1] == 'x';
if (!isHex) {
@@ -373,7 +372,7 @@ class OperationParser : public Parser {
/// Parse a region body into 'region'.
ParseResult
- parseRegionBody(Region ®ion, llvm::SMLoc startLoc,
+ parseRegionBody(Region ®ion, SMLoc startLoc,
ArrayRef<std::pair<SSAUseInfo, Type>> entryArguments,
ArrayRef<Location> argLocations, bool isIsolatedNameScope);
@@ -934,7 +933,7 @@ ParseResult OperationParser::parseOperation() {
// Add this operation to the assembly state if it was provided to populate.
if (state.asmState) {
unsigned resultIt = 0;
- SmallVector<std::pair<unsigned, llvm::SMLoc>> asmResultGroups;
+ SmallVector<std::pair<unsigned, SMLoc>> asmResultGroups;
asmResultGroups.reserve(resultIDs.size());
for (ResultRecord &record : resultIDs) {
asmResultGroups.emplace_back(resultIt, std::get<2>(record));
@@ -1281,7 +1280,7 @@ class CustomOpAsmParser : public AsmParserImpl<OpAsmParser> {
}
/// Emit a diagnostic at the specified location and return failure.
- InFlightDiagnostic emitError(llvm::SMLoc loc, const Twine &message) override {
+ InFlightDiagnostic emitError(SMLoc loc, const Twine &message) override {
return AsmParserImpl<OpAsmParser>::emitError(loc, "custom op '" + opName +
"' " + message);
}
@@ -1692,7 +1691,7 @@ FailureOr<OperationName> OperationParser::parseCustomOperationName() {
Operation *
OperationParser::parseCustomOperation(ArrayRef<ResultRecord> resultIDs) {
- llvm::SMLoc opLoc = getToken().getLoc();
+ SMLoc opLoc = getToken().getLoc();
FailureOr<OperationName> opNameInfo = parseCustomOperationName();
if (failed(opNameInfo))
@@ -1849,7 +1848,7 @@ ParseResult OperationParser::parseRegion(
}
ParseResult OperationParser::parseRegionBody(
- Region ®ion, llvm::SMLoc startLoc,
+ Region ®ion, SMLoc startLoc,
ArrayRef<std::pair<OperationParser::SSAUseInfo, Type>> entryArguments,
ArrayRef<Location> argLocations, bool isIsolatedNameScope) {
assert(argLocations.empty() || argLocations.size() == entryArguments.size());
@@ -2252,7 +2251,7 @@ LogicalResult mlir::parseSourceFile(llvm::StringRef filename,
"could not open input file " + filename);
// Load the MLIR source file.
- sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), llvm::SMLoc());
+ sourceMgr.AddNewSourceBuffer(std::move(*fileOrErr), SMLoc());
return parseSourceFile(sourceMgr, block, context, sourceFileLoc, asmState);
}
diff --git a/mlir/lib/Parser/Parser.h b/mlir/lib/Parser/Parser.h
index 8bdf248ea8e46..fb138d94cf3b2 100644
--- a/mlir/lib/Parser/Parser.h
+++ b/mlir/lib/Parser/Parser.h
@@ -71,11 +71,11 @@ class Parser {
InFlightDiagnostic emitError(const Twine &message = {}) {
return emitError(state.curToken.getLoc(), message);
}
- InFlightDiagnostic emitError(llvm::SMLoc loc, const Twine &message = {});
+ InFlightDiagnostic emitError(SMLoc loc, const Twine &message = {});
/// Encode the specified source location information into an attribute for
/// attachment to the IR.
- Location getEncodedSourceLocation(llvm::SMLoc loc) {
+ Location getEncodedSourceLocation(SMLoc loc) {
// If there are no active nested parsers, we can get the encoded source
// location directly.
if (state.parserDepth == 0)
@@ -88,7 +88,7 @@ class Parser {
/// Remaps the given SMLoc to the top level lexer of the parser. This is used
/// to adjust locations of potentially nested parsers to ensure that they can
/// be emitted properly as diagnostics.
- llvm::SMLoc remapLocationToTopLevelBuffer(llvm::SMLoc loc) {
+ SMLoc remapLocationToTopLevelBuffer(SMLoc loc) {
// If there are no active nested parsers, we can return location directly.
SymbolState &symbols = state.symbols;
if (state.parserDepth == 0)
@@ -101,7 +101,7 @@ class Parser {
size_t offset = loc.getPointer() - state.lex.getBufferBegin();
auto *rawLoc =
symbols.nestedParserLocs[state.parserDepth - 1].getPointer() + offset;
- return llvm::SMLoc::getFromPointer(rawLoc);
+ return SMLoc::getFromPointer(rawLoc);
}
//===--------------------------------------------------------------------===//
@@ -158,7 +158,7 @@ class Parser {
/// unlike `OpBuilder::getType`, this method does not implicitly insert a
/// context parameter.
template <typename T, typename... ParamsT>
- T getChecked(llvm::SMLoc loc, ParamsT &&...params) {
+ T getChecked(SMLoc loc, ParamsT &&...params) {
return T::getChecked([&] { return emitError(loc); },
std::forward<ParamsT>(params)...);
}
diff --git a/mlir/lib/Parser/ParserState.h b/mlir/lib/Parser/ParserState.h
index 5ab67548aaec7..33ad8f0090948 100644
--- a/mlir/lib/Parser/ParserState.h
+++ b/mlir/lib/Parser/ParserState.h
@@ -32,7 +32,7 @@ struct SymbolState {
/// active nested parsers. Given that some nested parsers, i.e. custom dialect
/// parsers, operate on a temporary memory buffer, this provides an anchor
/// point for emitting diagnostics.
- SmallVector<llvm::SMLoc, 1> nestedParserLocs;
+ SmallVector<SMLoc, 1> nestedParserLocs;
/// The top-level lexer that contains the original memory buffer provided by
/// the user. This is used by nested parsers to get a properly encoded source
diff --git a/mlir/lib/Parser/Token.cpp b/mlir/lib/Parser/Token.cpp
index 00bc7dbd6bd94..6cc167da5f955 100644
--- a/mlir/lib/Parser/Token.cpp
+++ b/mlir/lib/Parser/Token.cpp
@@ -12,9 +12,8 @@
#include "Token.h"
#include "llvm/ADT/StringExtras.h"
+
using namespace mlir;
-using llvm::SMLoc;
-using llvm::SMRange;
SMLoc Token::getLoc() const { return SMLoc::getFromPointer(spelling.data()); }
diff --git a/mlir/lib/Parser/Token.h b/mlir/lib/Parser/Token.h
index c086a0a194b92..be0924cb9d67a 100644
--- a/mlir/lib/Parser/Token.h
+++ b/mlir/lib/Parser/Token.h
@@ -102,9 +102,9 @@ class Token {
std::string getSymbolReference() const;
// Location processing.
- llvm::SMLoc getLoc() const;
- llvm::SMLoc getEndLoc() const;
- llvm::SMRange getLocRange() const;
+ SMLoc getLoc() const;
+ SMLoc getEndLoc() const;
+ SMRange getLocRange() const;
/// Given a punctuation or keyword token kind, return the spelling of the
/// token as a string. Warning: This will abort on markers, identifiers and
diff --git a/mlir/lib/Parser/TypeParser.cpp b/mlir/lib/Parser/TypeParser.cpp
index 5ff6e414b7da2..533ed6b4a5d49 100644
--- a/mlir/lib/Parser/TypeParser.cpp
+++ b/mlir/lib/Parser/TypeParser.cpp
@@ -116,7 +116,7 @@ Type Parser::parseComplexType() {
if (parseToken(Token::less, "expected '<' in complex type"))
return nullptr;
- llvm::SMLoc elementTypeLoc = getToken().getLoc();
+ SMLoc elementTypeLoc = getToken().getLoc();
auto elementType = parseType();
if (!elementType ||
parseToken(Token::greater, "expected '>' in complex type"))
@@ -190,7 +190,7 @@ ParseResult Parser::parseStridedLayout(int64_t &offset,
/// memory-space ::= integer-literal | attribute
///
Type Parser::parseMemRefType() {
- llvm::SMLoc loc = getToken().getLoc();
+ SMLoc loc = getToken().getLoc();
consumeToken(Token::kw_memref);
if (parseToken(Token::less, "expected '<' in memref type"))
diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp
index 58870a6ea93b7..5e23b9c6ffe8d 100644
--- a/mlir/lib/Pass/PassRegistry.cpp
+++ b/mlir/lib/Pass/PassRegistry.cpp
@@ -371,9 +371,9 @@ LogicalResult TextualPipeline::initialize(StringRef text,
pipelineMgr.AddNewSourceBuffer(
llvm::MemoryBuffer::getMemBuffer(text, "MLIR Textual PassPipeline Parser",
/*RequiresNullTerminator=*/false),
- llvm::SMLoc());
+ SMLoc());
auto errorHandler = [&](const char *rawLoc, Twine msg) {
- pipelineMgr.PrintMessage(errorStream, llvm::SMLoc::getFromPointer(rawLoc),
+ pipelineMgr.PrintMessage(errorStream, SMLoc::getFromPointer(rawLoc),
llvm::SourceMgr::DK_Error, msg);
return failure();
};
diff --git a/mlir/lib/Support/MlirOptMain.cpp b/mlir/lib/Support/MlirOptMain.cpp
index af4681f50ccbd..6fa9a6657adce 100644
--- a/mlir/lib/Support/MlirOptMain.cpp
+++ b/mlir/lib/Support/MlirOptMain.cpp
@@ -37,7 +37,6 @@
using namespace mlir;
using namespace llvm;
-using llvm::SMLoc;
/// Perform the actions on the input file indicated by the command line flags
/// within the specified context.
diff --git a/mlir/lib/Support/ToolUtilities.cpp b/mlir/lib/Support/ToolUtilities.cpp
index ca88fef96c0e2..7b52072a89767 100644
--- a/mlir/lib/Support/ToolUtilities.cpp
+++ b/mlir/lib/Support/ToolUtilities.cpp
@@ -37,7 +37,7 @@ mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer> originalBuffer,
// Add the original buffer to the source manager.
llvm::SourceMgr fileSourceMgr;
- fileSourceMgr.AddNewSourceBuffer(std::move(originalBuffer), llvm::SMLoc());
+ fileSourceMgr.AddNewSourceBuffer(std::move(originalBuffer), SMLoc());
// Flag near misses by iterating over all the sub-buffers found when splitting
// with the prefix of the splitMarker. Use a sliding window where we only add
@@ -60,7 +60,7 @@ mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer> originalBuffer,
prev = buffer.drop_front(checkLen);
} else {
// TODO: Consider making this a failure.
- auto splitLoc = llvm::SMLoc::getFromPointer(buffer.data());
+ auto splitLoc = SMLoc::getFromPointer(buffer.data());
fileSourceMgr.PrintMessage(llvm::errs(), splitLoc,
llvm::SourceMgr::DK_Warning,
"near miss with file split marker");
@@ -74,7 +74,7 @@ mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer> originalBuffer,
// Process each chunk in turn.
bool hadFailure = false;
for (auto &subBuffer : sourceBuffers) {
- auto splitLoc = llvm::SMLoc::getFromPointer(subBuffer.data());
+ auto splitLoc = SMLoc::getFromPointer(subBuffer.data());
unsigned splitLine = fileSourceMgr.getLineAndColumn(splitLoc).first;
auto subMemBuffer = llvm::MemoryBuffer::getMemBufferCopy(
subBuffer, Twine("within split at ") +
diff --git a/mlir/lib/TableGen/AttrOrTypeDef.cpp b/mlir/lib/TableGen/AttrOrTypeDef.cpp
index e874c8648d41c..c3a14bb5f1ddf 100644
--- a/mlir/lib/TableGen/AttrOrTypeDef.cpp
+++ b/mlir/lib/TableGen/AttrOrTypeDef.cpp
@@ -147,7 +147,7 @@ Optional<StringRef> AttrOrTypeDef::getExtraDecls() const {
return value.empty() ? Optional<StringRef>() : value;
}
-ArrayRef<llvm::SMLoc> AttrOrTypeDef::getLoc() const { return def->getLoc(); }
+ArrayRef<SMLoc> AttrOrTypeDef::getLoc() const { return def->getLoc(); }
bool AttrOrTypeDef::skipDefaultBuilders() const {
return def->getValueAsBit("skipDefaultBuilders");
diff --git a/mlir/lib/TableGen/Builder.cpp b/mlir/lib/TableGen/Builder.cpp
index 8210e8fe1a126..d25d09d7569f2 100644
--- a/mlir/lib/TableGen/Builder.cpp
+++ b/mlir/lib/TableGen/Builder.cpp
@@ -39,7 +39,7 @@ Optional<StringRef> Builder::Parameter::getDefaultValue() const {
// Builder
//===----------------------------------------------------------------------===//
-Builder::Builder(const llvm::Record *record, ArrayRef<llvm::SMLoc> loc)
+Builder::Builder(const llvm::Record *record, ArrayRef<SMLoc> loc)
: def(record) {
// Initialize the parameters of the builder.
const llvm::DagInit *dag = def->getValueAsDag("dagParams");
diff --git a/mlir/lib/TableGen/Operator.cpp b/mlir/lib/TableGen/Operator.cpp
index 6da1b7c1fe518..a77d17c56df71 100644
--- a/mlir/lib/TableGen/Operator.cpp
+++ b/mlir/lib/TableGen/Operator.cpp
@@ -612,7 +612,7 @@ auto Operator::getSameTypeAsResult(int index) const -> ArrayRef<ArgOrType> {
return resultTypeMapping[index];
}
-ArrayRef<llvm::SMLoc> Operator::getLoc() const { return def.getLoc(); }
+ArrayRef<SMLoc> Operator::getLoc() const { return def.getLoc(); }
bool Operator::hasDescription() const {
return def.getValue("description") != nullptr;
diff --git a/mlir/lib/TableGen/Predicate.cpp b/mlir/lib/TableGen/Predicate.cpp
index 3492c2f89077f..62f3fe1435336 100644
--- a/mlir/lib/TableGen/Predicate.cpp
+++ b/mlir/lib/TableGen/Predicate.cpp
@@ -47,7 +47,7 @@ bool Pred::isCombined() const {
return def && def->isSubClassOf("CombinedPred");
}
-ArrayRef<llvm::SMLoc> Pred::getLoc() const { return def->getLoc(); }
+ArrayRef<SMLoc> Pred::getLoc() const { return def->getLoc(); }
CPred::CPred(const llvm::Record *record) : Pred(record) {
assert(def->isSubClassOf("CPred") &&
diff --git a/mlir/lib/Tools/PDLL/AST/Nodes.cpp b/mlir/lib/Tools/PDLL/AST/Nodes.cpp
index 07d8bb2ea97c5..76f42f5329fd4 100644
--- a/mlir/lib/Tools/PDLL/AST/Nodes.cpp
+++ b/mlir/lib/Tools/PDLL/AST/Nodes.cpp
@@ -28,7 +28,7 @@ static StringRef copyStringWithNull(Context &ctx, StringRef str) {
// Name
//===----------------------------------------------------------------------===//
-const Name &Name::create(Context &ctx, StringRef name, llvm::SMRange location) {
+const Name &Name::create(Context &ctx, StringRef name, SMRange location) {
return *new (ctx.getAllocator().Allocate<Name>())
Name(copyStringWithNull(ctx, name), location);
}
@@ -54,7 +54,7 @@ Decl *DeclScope::lookup(StringRef name) {
// CompoundStmt
//===----------------------------------------------------------------------===//
-CompoundStmt *CompoundStmt::create(Context &ctx, llvm::SMRange loc,
+CompoundStmt *CompoundStmt::create(Context &ctx, SMRange loc,
ArrayRef<Stmt *> children) {
unsigned allocSize = CompoundStmt::totalSizeToAlloc<Stmt *>(children.size());
void *rawData = ctx.getAllocator().Allocate(allocSize, alignof(CompoundStmt));
@@ -69,7 +69,7 @@ CompoundStmt *CompoundStmt::create(Context &ctx, llvm::SMRange loc,
// LetStmt
//===----------------------------------------------------------------------===//
-LetStmt *LetStmt::create(Context &ctx, llvm::SMRange loc,
+LetStmt *LetStmt::create(Context &ctx, SMRange loc,
VariableDecl *varDecl) {
return new (ctx.getAllocator().Allocate<LetStmt>()) LetStmt(loc, varDecl);
}
@@ -81,14 +81,14 @@ LetStmt *LetStmt::create(Context &ctx, llvm::SMRange loc,
//===----------------------------------------------------------------------===//
// EraseStmt
-EraseStmt *EraseStmt::create(Context &ctx, llvm::SMRange loc, Expr *rootOp) {
+EraseStmt *EraseStmt::create(Context &ctx, SMRange loc, Expr *rootOp) {
return new (ctx.getAllocator().Allocate<EraseStmt>()) EraseStmt(loc, rootOp);
}
//===----------------------------------------------------------------------===//
// ReplaceStmt
-ReplaceStmt *ReplaceStmt::create(Context &ctx, llvm::SMRange loc, Expr *rootOp,
+ReplaceStmt *ReplaceStmt::create(Context &ctx, SMRange loc, Expr *rootOp,
ArrayRef<Expr *> replExprs) {
unsigned allocSize = ReplaceStmt::totalSizeToAlloc<Expr *>(replExprs.size());
void *rawData = ctx.getAllocator().Allocate(allocSize, alignof(ReplaceStmt));
@@ -102,7 +102,7 @@ ReplaceStmt *ReplaceStmt::create(Context &ctx, llvm::SMRange loc, Expr *rootOp,
//===----------------------------------------------------------------------===//
// RewriteStmt
-RewriteStmt *RewriteStmt::create(Context &ctx, llvm::SMRange loc, Expr *rootOp,
+RewriteStmt *RewriteStmt::create(Context &ctx, SMRange loc, Expr *rootOp,
CompoundStmt *rewriteBody) {
return new (ctx.getAllocator().Allocate<RewriteStmt>())
RewriteStmt(loc, rootOp, rewriteBody);
@@ -112,7 +112,7 @@ RewriteStmt *RewriteStmt::create(Context &ctx, llvm::SMRange loc, Expr *rootOp,
// AttributeExpr
//===----------------------------------------------------------------------===//
-AttributeExpr *AttributeExpr::create(Context &ctx, llvm::SMRange loc,
+AttributeExpr *AttributeExpr::create(Context &ctx, SMRange loc,
StringRef value) {
return new (ctx.getAllocator().Allocate<AttributeExpr>())
AttributeExpr(ctx, loc, copyStringWithNull(ctx, value));
@@ -122,7 +122,7 @@ AttributeExpr *AttributeExpr::create(Context &ctx, llvm::SMRange loc,
// DeclRefExpr
//===----------------------------------------------------------------------===//
-DeclRefExpr *DeclRefExpr::create(Context &ctx, llvm::SMRange loc, Decl *decl,
+DeclRefExpr *DeclRefExpr::create(Context &ctx, SMRange loc, Decl *decl,
Type type) {
return new (ctx.getAllocator().Allocate<DeclRefExpr>())
DeclRefExpr(loc, decl, type);
@@ -132,7 +132,7 @@ DeclRefExpr *DeclRefExpr::create(Context &ctx, llvm::SMRange loc, Decl *decl,
// MemberAccessExpr
//===----------------------------------------------------------------------===//
-MemberAccessExpr *MemberAccessExpr::create(Context &ctx, llvm::SMRange loc,
+MemberAccessExpr *MemberAccessExpr::create(Context &ctx, SMRange loc,
const Expr *parentExpr,
StringRef memberName, Type type) {
return new (ctx.getAllocator().Allocate<MemberAccessExpr>()) MemberAccessExpr(
@@ -144,7 +144,7 @@ MemberAccessExpr *MemberAccessExpr::create(Context &ctx, llvm::SMRange loc,
//===----------------------------------------------------------------------===//
OperationExpr *OperationExpr::create(
- Context &ctx, llvm::SMRange loc, const OpNameDecl *name,
+ Context &ctx, SMRange loc, const OpNameDecl *name,
ArrayRef<Expr *> operands, ArrayRef<Expr *> resultTypes,
ArrayRef<NamedAttributeDecl *> attributes) {
unsigned allocSize =
@@ -174,7 +174,7 @@ Optional<StringRef> OperationExpr::getName() const {
// TupleExpr
//===----------------------------------------------------------------------===//
-TupleExpr *TupleExpr::create(Context &ctx, llvm::SMRange loc,
+TupleExpr *TupleExpr::create(Context &ctx, SMRange loc,
ArrayRef<Expr *> elements,
ArrayRef<StringRef> names) {
unsigned allocSize = TupleExpr::totalSizeToAlloc<Expr *>(elements.size());
@@ -194,7 +194,7 @@ TupleExpr *TupleExpr::create(Context &ctx, llvm::SMRange loc,
// TypeExpr
//===----------------------------------------------------------------------===//
-TypeExpr *TypeExpr::create(Context &ctx, llvm::SMRange loc, StringRef value) {
+TypeExpr *TypeExpr::create(Context &ctx, SMRange loc, StringRef value) {
return new (ctx.getAllocator().Allocate<TypeExpr>())
TypeExpr(ctx, loc, copyStringWithNull(ctx, value));
}
@@ -203,7 +203,7 @@ TypeExpr *TypeExpr::create(Context &ctx, llvm::SMRange loc, StringRef value) {
// AttrConstraintDecl
//===----------------------------------------------------------------------===//
-AttrConstraintDecl *AttrConstraintDecl::create(Context &ctx, llvm::SMRange loc,
+AttrConstraintDecl *AttrConstraintDecl::create(Context &ctx, SMRange loc,
Expr *typeExpr) {
return new (ctx.getAllocator().Allocate<AttrConstraintDecl>())
AttrConstraintDecl(loc, typeExpr);
@@ -213,10 +213,10 @@ AttrConstraintDecl *AttrConstraintDecl::create(Context &ctx, llvm::SMRange loc,
// OpConstraintDecl
//===----------------------------------------------------------------------===//
-OpConstraintDecl *OpConstraintDecl::create(Context &ctx, llvm::SMRange loc,
+OpConstraintDecl *OpConstraintDecl::create(Context &ctx, SMRange loc,
const OpNameDecl *nameDecl) {
if (!nameDecl)
- nameDecl = OpNameDecl::create(ctx, llvm::SMRange());
+ nameDecl = OpNameDecl::create(ctx, SMRange());
return new (ctx.getAllocator().Allocate<OpConstraintDecl>())
OpConstraintDecl(loc, nameDecl);
@@ -231,7 +231,7 @@ Optional<StringRef> OpConstraintDecl::getName() const {
//===----------------------------------------------------------------------===//
TypeConstraintDecl *TypeConstraintDecl::create(Context &ctx,
- llvm::SMRange loc) {
+ SMRange loc) {
return new (ctx.getAllocator().Allocate<TypeConstraintDecl>())
TypeConstraintDecl(loc);
}
@@ -241,7 +241,7 @@ TypeConstraintDecl *TypeConstraintDecl::create(Context &ctx,
//===----------------------------------------------------------------------===//
TypeRangeConstraintDecl *TypeRangeConstraintDecl::create(Context &ctx,
- llvm::SMRange loc) {
+ SMRange loc) {
return new (ctx.getAllocator().Allocate<TypeRangeConstraintDecl>())
TypeRangeConstraintDecl(loc);
}
@@ -251,7 +251,7 @@ TypeRangeConstraintDecl *TypeRangeConstraintDecl::create(Context &ctx,
//===----------------------------------------------------------------------===//
ValueConstraintDecl *
-ValueConstraintDecl::create(Context &ctx, llvm::SMRange loc, Expr *typeExpr) {
+ValueConstraintDecl::create(Context &ctx, SMRange loc, Expr *typeExpr) {
return new (ctx.getAllocator().Allocate<ValueConstraintDecl>())
ValueConstraintDecl(loc, typeExpr);
}
@@ -261,7 +261,7 @@ ValueConstraintDecl::create(Context &ctx, llvm::SMRange loc, Expr *typeExpr) {
//===----------------------------------------------------------------------===//
ValueRangeConstraintDecl *ValueRangeConstraintDecl::create(Context &ctx,
- llvm::SMRange loc,
+ SMRange loc,
Expr *typeExpr) {
return new (ctx.getAllocator().Allocate<ValueRangeConstraintDecl>())
ValueRangeConstraintDecl(loc, typeExpr);
@@ -284,7 +284,7 @@ NamedAttributeDecl *NamedAttributeDecl::create(Context &ctx, const Name &name,
OpNameDecl *OpNameDecl::create(Context &ctx, const Name &name) {
return new (ctx.getAllocator().Allocate<OpNameDecl>()) OpNameDecl(name);
}
-OpNameDecl *OpNameDecl::create(Context &ctx, llvm::SMRange loc) {
+OpNameDecl *OpNameDecl::create(Context &ctx, SMRange loc) {
return new (ctx.getAllocator().Allocate<OpNameDecl>()) OpNameDecl(loc);
}
@@ -292,7 +292,7 @@ OpNameDecl *OpNameDecl::create(Context &ctx, llvm::SMRange loc) {
// PatternDecl
//===----------------------------------------------------------------------===//
-PatternDecl *PatternDecl::create(Context &ctx, llvm::SMRange loc,
+PatternDecl *PatternDecl::create(Context &ctx, SMRange loc,
const Name *name, Optional<uint16_t> benefit,
bool hasBoundedRecursion,
const CompoundStmt *body) {
@@ -322,7 +322,7 @@ VariableDecl *VariableDecl::create(Context &ctx, const Name &name, Type type,
// Module
//===----------------------------------------------------------------------===//
-Module *Module::create(Context &ctx, llvm::SMLoc loc,
+Module *Module::create(Context &ctx, SMLoc loc,
ArrayRef<Decl *> children) {
unsigned allocSize = Module::totalSizeToAlloc<Decl *>(children.size());
void *rawData = ctx.getAllocator().Allocate(allocSize, alignof(Module));
diff --git a/mlir/lib/Tools/PDLL/Parser/Lexer.cpp b/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
index e45781475f796..3db5cfbdfd645 100644
--- a/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
@@ -94,7 +94,7 @@ Lexer::~Lexer() {
LogicalResult Lexer::pushInclude(StringRef filename) {
std::string includedFile;
int bufferID = srcMgr.AddIncludeFile(
- filename.str(), llvm::SMLoc::getFromPointer(curPtr), includedFile);
+ filename.str(), SMLoc::getFromPointer(curPtr), includedFile);
if (!bufferID) return failure();
curBufferID = bufferID;
@@ -103,18 +103,18 @@ LogicalResult Lexer::pushInclude(StringRef filename) {
return success();
}
-Token Lexer::emitError(llvm::SMRange loc, const Twine &msg) {
+Token Lexer::emitError(SMRange loc, const Twine &msg) {
diagEngine.emitError(loc, msg);
return formToken(Token::error, loc.Start.getPointer());
}
-Token Lexer::emitErrorAndNote(llvm::SMRange loc, const Twine &msg,
- llvm::SMRange noteLoc, const Twine ¬e) {
+Token Lexer::emitErrorAndNote(SMRange loc, const Twine &msg,
+ SMRange noteLoc, const Twine ¬e) {
diagEngine.emitError(loc, msg)->attachNote(note, noteLoc);
return formToken(Token::error, loc.Start.getPointer());
}
Token Lexer::emitError(const char *loc, const Twine &msg) {
- return emitError(llvm::SMRange(llvm::SMLoc::getFromPointer(loc),
- llvm::SMLoc::getFromPointer(loc + 1)),
+ return emitError(SMRange(SMLoc::getFromPointer(loc),
+ SMLoc::getFromPointer(loc + 1)),
msg);
}
@@ -161,7 +161,7 @@ Token Lexer::lexToken() {
Token eof = formToken(Token::eof, tokStart);
// Check to see if we are in an included file.
- llvm::SMLoc parentIncludeLoc = srcMgr.getParentIncludeLoc(curBufferID);
+ SMLoc parentIncludeLoc = srcMgr.getParentIncludeLoc(curBufferID);
if (parentIncludeLoc.isValid()) {
curBufferID = srcMgr.FindBufferContainingLoc(parentIncludeLoc);
curBuffer = srcMgr.getMemoryBuffer(curBufferID)->getBuffer();
diff --git a/mlir/lib/Tools/PDLL/Parser/Lexer.h b/mlir/lib/Tools/PDLL/Parser/Lexer.h
index bf6f2a686fbee..4692f28ba877c 100644
--- a/mlir/lib/Tools/PDLL/Parser/Lexer.h
+++ b/mlir/lib/Tools/PDLL/Parser/Lexer.h
@@ -133,16 +133,16 @@ class Token {
bool is(Kind k) const { return kind == k; }
/// Return a location for the start of this token.
- llvm::SMLoc getStartLoc() const {
- return llvm::SMLoc::getFromPointer(spelling.data());
+ SMLoc getStartLoc() const {
+ return SMLoc::getFromPointer(spelling.data());
}
/// Return a location at the end of this token.
- llvm::SMLoc getEndLoc() const {
- return llvm::SMLoc::getFromPointer(spelling.data() + spelling.size());
+ SMLoc getEndLoc() const {
+ return SMLoc::getFromPointer(spelling.data() + spelling.size());
}
/// Return a location for the range of this token.
- llvm::SMRange getLoc() const {
- return llvm::SMRange(getStartLoc(), getEndLoc());
+ SMRange getLoc() const {
+ return SMRange(getStartLoc(), getEndLoc());
}
private:
@@ -182,10 +182,10 @@ class Lexer {
void resetPointer(const char *newPointer) { curPtr = newPointer; }
/// Emit an error to the lexer with the given location and message.
- Token emitError(llvm::SMRange loc, const Twine &msg);
+ Token emitError(SMRange loc, const Twine &msg);
Token emitError(const char *loc, const Twine &msg);
- Token emitErrorAndNote(llvm::SMRange loc, const Twine &msg,
- llvm::SMRange noteLoc, const Twine ¬e);
+ Token emitErrorAndNote(SMRange loc, const Twine &msg,
+ SMRange noteLoc, const Twine ¬e);
private:
Token formToken(Token::Kind kind, const char *tokStart) {
diff --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
index 4f98bfd08580f..a6c8ebbe76705 100644
--- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
@@ -116,11 +116,11 @@ class Parser {
/// Try to define a variable decl with the given components, returns the
/// variable on success.
FailureOr<ast::VariableDecl *>
- defineVariableDecl(StringRef name, llvm::SMRange nameLoc, ast::Type type,
+ defineVariableDecl(StringRef name, SMRange nameLoc, ast::Type type,
ast::Expr *initExpr,
ArrayRef<ast::ConstraintRef> constraints);
FailureOr<ast::VariableDecl *>
- defineVariableDecl(StringRef name, llvm::SMRange nameLoc, ast::Type type,
+ defineVariableDecl(StringRef name, SMRange nameLoc, ast::Type type,
ArrayRef<ast::ConstraintRef> constraints);
/// Parse the constraint reference list for a variable decl.
@@ -136,7 +136,7 @@ class Parser {
/// existing constraints that have already been parsed for the same entity
/// that will be constrained by this constraint.
FailureOr<ast::ConstraintRef>
- parseConstraint(Optional<llvm::SMRange> &typeConstraint,
+ parseConstraint(Optional<SMRange> &typeConstraint,
ArrayRef<ast::ConstraintRef> existingConstraints);
//===--------------------------------------------------------------------===//
@@ -146,7 +146,7 @@ class Parser {
/// Identifier expressions.
FailureOr<ast::Expr *> parseAttributeExpr();
- FailureOr<ast::Expr *> parseDeclRefExpr(StringRef name, llvm::SMRange loc);
+ FailureOr<ast::Expr *> parseDeclRefExpr(StringRef name, SMRange loc);
FailureOr<ast::Expr *> parseIdentifierExpr();
FailureOr<ast::Expr *> parseMemberAccessExpr(ast::Expr *parentExpr);
FailureOr<ast::OpNameDecl *> parseOperationName(bool allowEmptyName = false);
@@ -176,14 +176,14 @@ class Parser {
/// Try to create a pattern decl with the given components, returning the
/// Pattern on success.
FailureOr<ast::PatternDecl *>
- createPatternDecl(llvm::SMRange loc, const ast::Name *name,
+ createPatternDecl(SMRange loc, const ast::Name *name,
const ParsedPatternMetadata &metadata,
ast::CompoundStmt *body);
/// Try to create a variable decl with the given components, returning the
/// Variable on success.
FailureOr<ast::VariableDecl *>
- createVariableDecl(StringRef name, llvm::SMRange loc, ast::Expr *initializer,
+ createVariableDecl(StringRef name, SMRange loc, ast::Expr *initializer,
ArrayRef<ast::ConstraintRef> constraints);
/// Validate the constraints used to constraint a variable decl.
@@ -206,49 +206,49 @@ class Parser {
//===--------------------------------------------------------------------===//
// Exprs
- FailureOr<ast::DeclRefExpr *> createDeclRefExpr(llvm::SMRange loc,
+ FailureOr<ast::DeclRefExpr *> createDeclRefExpr(SMRange loc,
ast::Decl *decl);
FailureOr<ast::DeclRefExpr *>
- createInlineVariableExpr(ast::Type type, StringRef name, llvm::SMRange loc,
+ createInlineVariableExpr(ast::Type type, StringRef name, SMRange loc,
ArrayRef<ast::ConstraintRef> constraints);
FailureOr<ast::MemberAccessExpr *>
createMemberAccessExpr(ast::Expr *parentExpr, StringRef name,
- llvm::SMRange loc);
+ SMRange loc);
/// Validate the member access `name` into the given parent expression. On
/// success, this also returns the type of the member accessed.
FailureOr<ast::Type> validateMemberAccess(ast::Expr *parentExpr,
- StringRef name, llvm::SMRange loc);
+ StringRef name, SMRange loc);
FailureOr<ast::OperationExpr *>
- createOperationExpr(llvm::SMRange loc, const ast::OpNameDecl *name,
+ createOperationExpr(SMRange loc, const ast::OpNameDecl *name,
MutableArrayRef<ast::Expr *> operands,
MutableArrayRef<ast::NamedAttributeDecl *> attributes,
MutableArrayRef<ast::Expr *> results);
LogicalResult
- validateOperationOperands(llvm::SMRange loc, Optional<StringRef> name,
+ validateOperationOperands(SMRange loc, Optional<StringRef> name,
MutableArrayRef<ast::Expr *> operands);
- LogicalResult validateOperationResults(llvm::SMRange loc,
+ LogicalResult validateOperationResults(SMRange loc,
Optional<StringRef> name,
MutableArrayRef<ast::Expr *> results);
LogicalResult
- validateOperationOperandsOrResults(llvm::SMRange loc,
+ validateOperationOperandsOrResults(SMRange loc,
Optional<StringRef> name,
MutableArrayRef<ast::Expr *> values,
ast::Type singleTy, ast::Type rangeTy);
- FailureOr<ast::TupleExpr *> createTupleExpr(llvm::SMRange loc,
+ FailureOr<ast::TupleExpr *> createTupleExpr(SMRange loc,
ArrayRef<ast::Expr *> elements,
ArrayRef<StringRef> elementNames);
//===--------------------------------------------------------------------===//
// Stmts
- FailureOr<ast::EraseStmt *> createEraseStmt(llvm::SMRange loc,
+ FailureOr<ast::EraseStmt *> createEraseStmt(SMRange loc,
ast::Expr *rootOp);
FailureOr<ast::ReplaceStmt *>
- createReplaceStmt(llvm::SMRange loc, ast::Expr *rootOp,
+ createReplaceStmt(SMRange loc, ast::Expr *rootOp,
MutableArrayRef<ast::Expr *> replValues);
FailureOr<ast::RewriteStmt *>
- createRewriteStmt(llvm::SMRange loc, ast::Expr *rootOp,
+ createRewriteStmt(SMRange loc, ast::Expr *rootOp,
ast::CompoundStmt *rewriteBody);
//===--------------------------------------------------------------------===//
@@ -280,7 +280,7 @@ class Parser {
}
/// Reset the lexer to the location at the given position.
- void resetToken(llvm::SMRange tokLoc) {
+ void resetToken(SMRange tokLoc) {
lexer.resetPointer(tokLoc.Start.getPointer());
curToken = lexer.lexToken();
}
@@ -293,15 +293,15 @@ class Parser {
consumeToken();
return success();
}
- LogicalResult emitError(llvm::SMRange loc, const Twine &msg) {
+ LogicalResult emitError(SMRange loc, const Twine &msg) {
lexer.emitError(loc, msg);
return failure();
}
LogicalResult emitError(const Twine &msg) {
return emitError(curToken.getLoc(), msg);
}
- LogicalResult emitErrorAndNote(llvm::SMRange loc, const Twine &msg,
- llvm::SMRange noteLoc, const Twine ¬e) {
+ LogicalResult emitErrorAndNote(SMRange loc, const Twine &msg,
+ SMRange noteLoc, const Twine ¬e) {
lexer.emitErrorAndNote(loc, msg, noteLoc, note);
return failure();
}
@@ -333,7 +333,7 @@ class Parser {
} // namespace
FailureOr<ast::Module *> Parser::parseModule() {
- llvm::SMLoc moduleLoc = curToken.getStartLoc();
+ SMLoc moduleLoc = curToken.getStartLoc();
pushDeclScope();
// Parse the top-level decls of the module.
@@ -464,14 +464,14 @@ LogicalResult Parser::parseDirective(SmallVector<ast::Decl *> &decls) {
}
LogicalResult Parser::parseInclude(SmallVector<ast::Decl *> &decls) {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::directive);
// Parse the file being included.
if (!curToken.isString())
return emitError(loc,
"expected string file name after `include` directive");
- llvm::SMRange fileLoc = curToken.getLoc();
+ SMRange fileLoc = curToken.getLoc();
std::string filenameStr = curToken.getStringValue();
StringRef filename = filenameStr;
consumeToken();
@@ -548,7 +548,7 @@ FailureOr<ast::NamedAttributeDecl *> Parser::parseNamedAttributeDecl() {
}
FailureOr<ast::Decl *> Parser::parsePatternDecl() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_Pattern);
llvm::SaveAndRestore<ParserContext> saveCtx(parserContext,
ParserContext::PatternMatch);
@@ -598,14 +598,14 @@ FailureOr<ast::Decl *> Parser::parsePatternDecl() {
LogicalResult
Parser::parsePatternDeclMetadata(ParsedPatternMetadata &metadata) {
- Optional<llvm::SMRange> benefitLoc;
- Optional<llvm::SMRange> hasBoundedRecursionLoc;
+ Optional<SMRange> benefitLoc;
+ Optional<SMRange> hasBoundedRecursionLoc;
do {
if (curToken.isNot(Token::identifier))
return emitError("expected pattern metadata identifier");
StringRef metadataStr = curToken.getSpelling();
- llvm::SMRange metadataLoc = curToken.getLoc();
+ SMRange metadataLoc = curToken.getLoc();
consumeToken(Token::identifier);
// Parse the benefit metadata: benefit(<integer-value>)
@@ -677,7 +677,7 @@ LogicalResult Parser::checkDefineNamedDecl(const ast::Name &name) {
}
FailureOr<ast::VariableDecl *>
-Parser::defineVariableDecl(StringRef name, llvm::SMRange nameLoc,
+Parser::defineVariableDecl(StringRef name, SMRange nameLoc,
ast::Type type, ast::Expr *initExpr,
ArrayRef<ast::ConstraintRef> constraints) {
assert(curDeclScope && "defining variable outside of decl scope");
@@ -699,7 +699,7 @@ Parser::defineVariableDecl(StringRef name, llvm::SMRange nameLoc,
}
FailureOr<ast::VariableDecl *>
-Parser::defineVariableDecl(StringRef name, llvm::SMRange nameLoc,
+Parser::defineVariableDecl(StringRef name, SMRange nameLoc,
ast::Type type,
ArrayRef<ast::ConstraintRef> constraints) {
return defineVariableDecl(name, nameLoc, type, /*initExpr=*/nullptr,
@@ -708,7 +708,7 @@ Parser::defineVariableDecl(StringRef name, llvm::SMRange nameLoc,
LogicalResult Parser::parseVariableDeclConstraintList(
SmallVectorImpl<ast::ConstraintRef> &constraints) {
- Optional<llvm::SMRange> typeConstraint;
+ Optional<SMRange> typeConstraint;
auto parseSingleConstraint = [&] {
FailureOr<ast::ConstraintRef> constraint =
parseConstraint(typeConstraint, constraints);
@@ -730,7 +730,7 @@ LogicalResult Parser::parseVariableDeclConstraintList(
}
FailureOr<ast::ConstraintRef>
-Parser::parseConstraint(Optional<llvm::SMRange> &typeConstraint,
+Parser::parseConstraint(Optional<SMRange> &typeConstraint,
ArrayRef<ast::ConstraintRef> existingConstraints) {
auto parseTypeConstraint = [&](ast::Expr *&typeExpr) -> LogicalResult {
if (typeConstraint)
@@ -746,7 +746,7 @@ Parser::parseConstraint(Optional<llvm::SMRange> &typeConstraint,
return success();
};
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
switch (curToken.getKind()) {
case Token::kw_Attr: {
consumeToken(Token::kw_Attr);
@@ -871,7 +871,7 @@ FailureOr<ast::Expr *> Parser::parseExpr() {
}
FailureOr<ast::Expr *> Parser::parseAttributeExpr() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_attr);
// If we aren't followed by a `<`, the `attr` keyword is treated as a normal
@@ -893,7 +893,7 @@ FailureOr<ast::Expr *> Parser::parseAttributeExpr() {
}
FailureOr<ast::Expr *> Parser::parseDeclRefExpr(StringRef name,
- llvm::SMRange loc) {
+ SMRange loc) {
ast::Decl *decl = curDeclScope->lookup(name);
if (!decl)
return emitError(loc, "undefined reference to `" + name + "`");
@@ -903,7 +903,7 @@ FailureOr<ast::Expr *> Parser::parseDeclRefExpr(StringRef name,
FailureOr<ast::Expr *> Parser::parseIdentifierExpr() {
StringRef name = curToken.getSpelling();
- llvm::SMRange nameLoc = curToken.getLoc();
+ SMRange nameLoc = curToken.getLoc();
consumeToken();
// Check to see if this is a decl ref expression that defines a variable
@@ -922,7 +922,7 @@ FailureOr<ast::Expr *> Parser::parseIdentifierExpr() {
}
FailureOr<ast::Expr *> Parser::parseMemberAccessExpr(ast::Expr *parentExpr) {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::dot);
// Parse the member name.
@@ -937,12 +937,12 @@ FailureOr<ast::Expr *> Parser::parseMemberAccessExpr(ast::Expr *parentExpr) {
}
FailureOr<ast::OpNameDecl *> Parser::parseOperationName(bool allowEmptyName) {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
// Handle the case of an no operation name.
if (curToken.isNot(Token::identifier) && !curToken.isKeyword()) {
if (allowEmptyName)
- return ast::OpNameDecl::create(ctx, llvm::SMRange());
+ return ast::OpNameDecl::create(ctx, SMRange());
return emitError("expected dialect namespace");
}
StringRef name = curToken.getSpelling();
@@ -968,7 +968,7 @@ FailureOr<ast::OpNameDecl *> Parser::parseOperationName(bool allowEmptyName) {
FailureOr<ast::OpNameDecl *>
Parser::parseWrappedOperationName(bool allowEmptyName) {
if (!consumeIf(Token::less))
- return ast::OpNameDecl::create(ctx, llvm::SMRange());
+ return ast::OpNameDecl::create(ctx, SMRange());
FailureOr<ast::OpNameDecl *> opNameDecl = parseOperationName(allowEmptyName);
if (failed(opNameDecl))
@@ -980,7 +980,7 @@ Parser::parseWrappedOperationName(bool allowEmptyName) {
}
FailureOr<ast::Expr *> Parser::parseOperationExpr() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_op);
// If it isn't followed by a `<`, the `op` keyword is treated as a normal
@@ -1053,10 +1053,10 @@ FailureOr<ast::Expr *> Parser::parseOperationExpr() {
}
FailureOr<ast::Expr *> Parser::parseTupleExpr() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::l_paren);
- DenseMap<StringRef, llvm::SMRange> usedNames;
+ DenseMap<StringRef, SMRange> usedNames;
SmallVector<StringRef> elementNames;
SmallVector<ast::Expr *> elements;
if (curToken.isNot(Token::r_paren)) {
@@ -1105,7 +1105,7 @@ FailureOr<ast::Expr *> Parser::parseTupleExpr() {
}
FailureOr<ast::Expr *> Parser::parseTypeExpr() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_type);
// If we aren't followed by a `<`, the `type` keyword is treated as a normal
@@ -1127,7 +1127,7 @@ FailureOr<ast::Expr *> Parser::parseTypeExpr() {
FailureOr<ast::Expr *> Parser::parseUnderscoreExpr() {
StringRef name = curToken.getSpelling();
- llvm::SMRange nameLoc = curToken.getLoc();
+ SMRange nameLoc = curToken.getLoc();
consumeToken(Token::underscore);
// Underscore expressions require a constraint list.
@@ -1175,7 +1175,7 @@ FailureOr<ast::Stmt *> Parser::parseStmt(bool expectTerminalSemicolon) {
}
FailureOr<ast::CompoundStmt *> Parser::parseCompoundStmt() {
- llvm::SMLoc startLoc = curToken.getStartLoc();
+ SMLoc startLoc = curToken.getStartLoc();
consumeToken(Token::l_brace);
// Push a new block scope and parse any nested statements.
@@ -1190,14 +1190,14 @@ FailureOr<ast::CompoundStmt *> Parser::parseCompoundStmt() {
popDeclScope();
// Consume the end brace.
- llvm::SMRange location(startLoc, curToken.getEndLoc());
+ SMRange location(startLoc, curToken.getEndLoc());
consumeToken(Token::r_brace);
return ast::CompoundStmt::create(ctx, location, statements);
}
FailureOr<ast::EraseStmt *> Parser::parseEraseStmt() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_erase);
// Parse the root operation expression.
@@ -1209,11 +1209,11 @@ FailureOr<ast::EraseStmt *> Parser::parseEraseStmt() {
}
FailureOr<ast::LetStmt *> Parser::parseLetStmt() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_let);
// Parse the name of the new variable.
- llvm::SMRange varLoc = curToken.getLoc();
+ SMRange varLoc = curToken.getLoc();
if (curToken.isNot(Token::identifier) && !curToken.isDependentKeyword()) {
// `_` is a reserved variable name.
if (curToken.is(Token::underscore)) {
@@ -1269,7 +1269,7 @@ FailureOr<ast::LetStmt *> Parser::parseLetStmt() {
}
FailureOr<ast::ReplaceStmt *> Parser::parseReplaceStmt() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_replace);
// Parse the root operation expression.
@@ -1315,7 +1315,7 @@ FailureOr<ast::ReplaceStmt *> Parser::parseReplaceStmt() {
}
FailureOr<ast::RewriteStmt *> Parser::parseRewriteStmt() {
- llvm::SMRange loc = curToken.getLoc();
+ SMRange loc = curToken.getLoc();
consumeToken(Token::kw_rewrite);
// Parse the root operation.
@@ -1348,7 +1348,7 @@ FailureOr<ast::RewriteStmt *> Parser::parseRewriteStmt() {
// Decls
FailureOr<ast::PatternDecl *>
-Parser::createPatternDecl(llvm::SMRange loc, const ast::Name *name,
+Parser::createPatternDecl(SMRange loc, const ast::Name *name,
const ParsedPatternMetadata &metadata,
ast::CompoundStmt *body) {
return ast::PatternDecl::create(ctx, loc, name, metadata.benefit,
@@ -1356,7 +1356,7 @@ Parser::createPatternDecl(llvm::SMRange loc, const ast::Name *name,
}
FailureOr<ast::VariableDecl *>
-Parser::createVariableDecl(StringRef name, llvm::SMRange loc,
+Parser::createVariableDecl(StringRef name, SMRange loc,
ast::Expr *initializer,
ArrayRef<ast::ConstraintRef> constraints) {
// The type of the variable, which is expected to be inferred by either a
@@ -1473,7 +1473,7 @@ Parser::validateTypeRangeConstraintExpr(const ast::Expr *typeExpr) {
//===----------------------------------------------------------------------===//
// Exprs
-FailureOr<ast::DeclRefExpr *> Parser::createDeclRefExpr(llvm::SMRange loc,
+FailureOr<ast::DeclRefExpr *> Parser::createDeclRefExpr(SMRange loc,
ast::Decl *decl) {
// Check the type of decl being referenced.
ast::Type declType;
@@ -1488,7 +1488,7 @@ FailureOr<ast::DeclRefExpr *> Parser::createDeclRefExpr(llvm::SMRange loc,
FailureOr<ast::DeclRefExpr *>
Parser::createInlineVariableExpr(ast::Type type, StringRef name,
- llvm::SMRange loc,
+ SMRange loc,
ArrayRef<ast::ConstraintRef> constraints) {
FailureOr<ast::VariableDecl *> decl =
defineVariableDecl(name, loc, type, constraints);
@@ -1499,7 +1499,7 @@ Parser::createInlineVariableExpr(ast::Type type, StringRef name,
FailureOr<ast::MemberAccessExpr *>
Parser::createMemberAccessExpr(ast::Expr *parentExpr, StringRef name,
- llvm::SMRange loc) {
+ SMRange loc) {
// Validate the member name for the given parent expression.
FailureOr<ast::Type> memberType = validateMemberAccess(parentExpr, name, loc);
if (failed(memberType))
@@ -1510,7 +1510,7 @@ Parser::createMemberAccessExpr(ast::Expr *parentExpr, StringRef name,
FailureOr<ast::Type> Parser::validateMemberAccess(ast::Expr *parentExpr,
StringRef name,
- llvm::SMRange loc) {
+ SMRange loc) {
ast::Type parentType = parentExpr->getType();
if (parentType.isa<ast::OperationType>()) {
if (name == ast::AllResultsMemberAccessExpr::getMemberName())
@@ -1536,7 +1536,7 @@ FailureOr<ast::Type> Parser::validateMemberAccess(ast::Expr *parentExpr,
}
FailureOr<ast::OperationExpr *> Parser::createOperationExpr(
- llvm::SMRange loc, const ast::OpNameDecl *name,
+ SMRange loc, const ast::OpNameDecl *name,
MutableArrayRef<ast::Expr *> operands,
MutableArrayRef<ast::NamedAttributeDecl *> attributes,
MutableArrayRef<ast::Expr *> results) {
@@ -1566,21 +1566,21 @@ FailureOr<ast::OperationExpr *> Parser::createOperationExpr(
}
LogicalResult
-Parser::validateOperationOperands(llvm::SMRange loc, Optional<StringRef> name,
+Parser::validateOperationOperands(SMRange loc, Optional<StringRef> name,
MutableArrayRef<ast::Expr *> operands) {
return validateOperationOperandsOrResults(loc, name, operands, valueTy,
valueRangeTy);
}
LogicalResult
-Parser::validateOperationResults(llvm::SMRange loc, Optional<StringRef> name,
+Parser::validateOperationResults(SMRange loc, Optional<StringRef> name,
MutableArrayRef<ast::Expr *> results) {
return validateOperationOperandsOrResults(loc, name, results, typeTy,
typeRangeTy);
}
LogicalResult Parser::validateOperationOperandsOrResults(
- llvm::SMRange loc, Optional<StringRef> name,
+ SMRange loc, Optional<StringRef> name,
MutableArrayRef<ast::Expr *> values, ast::Type singleTy,
ast::Type rangeTy) {
// All operation types accept a single range parameter.
@@ -1619,7 +1619,7 @@ LogicalResult Parser::validateOperationOperandsOrResults(
}
FailureOr<ast::TupleExpr *>
-Parser::createTupleExpr(llvm::SMRange loc, ArrayRef<ast::Expr *> elements,
+Parser::createTupleExpr(SMRange loc, ArrayRef<ast::Expr *> elements,
ArrayRef<StringRef> elementNames) {
for (const ast::Expr *element : elements) {
ast::Type eleTy = element->getType();
@@ -1635,7 +1635,7 @@ Parser::createTupleExpr(llvm::SMRange loc, ArrayRef<ast::Expr *> elements,
//===----------------------------------------------------------------------===//
// Stmts
-FailureOr<ast::EraseStmt *> Parser::createEraseStmt(llvm::SMRange loc,
+FailureOr<ast::EraseStmt *> Parser::createEraseStmt(SMRange loc,
ast::Expr *rootOp) {
// Check that root is an Operation.
ast::Type rootType = rootOp->getType();
@@ -1646,7 +1646,7 @@ FailureOr<ast::EraseStmt *> Parser::createEraseStmt(llvm::SMRange loc,
}
FailureOr<ast::ReplaceStmt *>
-Parser::createReplaceStmt(llvm::SMRange loc, ast::Expr *rootOp,
+Parser::createReplaceStmt(SMRange loc, ast::Expr *rootOp,
MutableArrayRef<ast::Expr *> replValues) {
// Check that root is an Operation.
ast::Type rootType = rootOp->getType();
@@ -1681,7 +1681,7 @@ Parser::createReplaceStmt(llvm::SMRange loc, ast::Expr *rootOp,
}
FailureOr<ast::RewriteStmt *>
-Parser::createRewriteStmt(llvm::SMRange loc, ast::Expr *rootOp,
+Parser::createRewriteStmt(SMRange loc, ast::Expr *rootOp,
ast::CompoundStmt *rewriteBody) {
// Check that root is an Operation.
ast::Type rootType = rootOp->getType();
diff --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
index cc41eb2831faf..2488ede756ef9 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
+++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
@@ -17,7 +17,7 @@
using namespace mlir;
/// Returns a language server position for the given source location.
-static lsp::Position getPosFromLoc(llvm::SourceMgr &mgr, llvm::SMLoc loc) {
+static lsp::Position getPosFromLoc(llvm::SourceMgr &mgr, SMLoc loc) {
std::pair<unsigned, unsigned> lineAndCol = mgr.getLineAndColumn(loc);
lsp::Position pos;
pos.line = lineAndCol.first - 1;
@@ -26,19 +26,19 @@ static lsp::Position getPosFromLoc(llvm::SourceMgr &mgr, llvm::SMLoc loc) {
}
/// Returns a source location from the given language server position.
-static llvm::SMLoc getPosFromLoc(llvm::SourceMgr &mgr, lsp::Position pos) {
+static SMLoc getPosFromLoc(llvm::SourceMgr &mgr, lsp::Position pos) {
return mgr.FindLocForLineAndColumn(mgr.getMainFileID(), pos.line + 1,
pos.character);
}
/// Returns a language server range for the given source range.
-static lsp::Range getRangeFromLoc(llvm::SourceMgr &mgr, llvm::SMRange range) {
+static lsp::Range getRangeFromLoc(llvm::SourceMgr &mgr, SMRange range) {
return {getPosFromLoc(mgr, range.Start), getPosFromLoc(mgr, range.End)};
}
/// Returns a language server location from the given source range.
static lsp::Location getLocationFromLoc(llvm::SourceMgr &mgr,
- llvm::SMRange range,
+ SMRange range,
const lsp::URIForFile &uri) {
return lsp::Location{uri, getRangeFromLoc(mgr, range)};
}
@@ -75,13 +75,13 @@ getLocationFromLoc(llvm::SourceMgr &sourceMgr, Location loc,
Optional<lsp::Location> sourceLoc = getLocationFromLoc(fileLoc);
if (sourceLoc && (!uri || sourceLoc->uri == *uri)) {
location = *sourceLoc;
- llvm::SMLoc loc = sourceMgr.FindLocForLineAndColumn(
+ SMLoc loc = sourceMgr.FindLocForLineAndColumn(
sourceMgr.getMainFileID(), fileLoc.getLine(), fileLoc.getColumn());
// Use range of potential identifier starting at location, else length 1
// range.
location->range.end.character += 1;
- if (Optional<llvm::SMRange> range =
+ if (Optional<SMRange> range =
AsmParserState::convertIdLocToRange(loc)) {
auto lineCol = sourceMgr.getLineAndColumn(range->End);
location->range.end.character =
@@ -115,7 +115,7 @@ static void collectLocationsFromLoc(Location loc,
/// Returns true if the given range contains the given source location. Note
/// that this has slightly
diff erent behavior than SMRange because it is
/// inclusive of the end location.
-static bool contains(llvm::SMRange range, llvm::SMLoc loc) {
+static bool contains(SMRange range, SMLoc loc) {
return range.Start.getPointer() <= loc.getPointer() &&
loc.getPointer() <= range.End.getPointer();
}
@@ -123,8 +123,8 @@ static bool contains(llvm::SMRange range, llvm::SMLoc loc) {
/// Returns true if the given location is contained by the definition or one of
/// the uses of the given SMDefinition. If provided, `overlappedRange` is set to
/// the range within `def` that the provided `loc` overlapped with.
-static bool isDefOrUse(const AsmParserState::SMDefinition &def, llvm::SMLoc loc,
- llvm::SMRange *overlappedRange = nullptr) {
+static bool isDefOrUse(const AsmParserState::SMDefinition &def, SMLoc loc,
+ SMRange *overlappedRange = nullptr) {
// Check the main definition.
if (contains(def.loc, loc)) {
if (overlappedRange)
@@ -133,7 +133,7 @@ static bool isDefOrUse(const AsmParserState::SMDefinition &def, llvm::SMLoc loc,
}
// Check the uses.
- const auto *useIt = llvm::find_if(def.uses, [&](const llvm::SMRange &range) {
+ const auto *useIt = llvm::find_if(def.uses, [&](const SMRange &range) {
return contains(range, loc);
});
if (useIt != def.uses.end()) {
@@ -146,7 +146,7 @@ static bool isDefOrUse(const AsmParserState::SMDefinition &def, llvm::SMLoc loc,
/// Given a location pointing to a result, return the result number it refers
/// to or None if it refers to all of the results.
-static Optional<unsigned> getResultNumberFromLoc(llvm::SMLoc loc) {
+static Optional<unsigned> getResultNumberFromLoc(SMLoc loc) {
// Skip all of the identifier characters.
auto isIdentifierChar = [](char c) {
return isalnum(c) || c == '%' || c == '$' || c == '.' || c == '_' ||
@@ -173,7 +173,7 @@ static Optional<unsigned> getResultNumberFromLoc(llvm::SMLoc loc) {
/// Given a source location range, return the text covered by the given range.
/// If the range is invalid, returns None.
-static Optional<StringRef> getTextFromRange(llvm::SMRange range) {
+static Optional<StringRef> getTextFromRange(SMRange range) {
if (!range.isValid())
return None;
const char *startPtr = range.Start.getPointer();
@@ -188,7 +188,7 @@ static unsigned getBlockNumber(Block *block) {
/// Given a block and source location, print the source name of the block to the
/// given output stream.
static void printDefBlockName(raw_ostream &os, Block *block,
- llvm::SMRange loc = {}) {
+ SMRange loc = {}) {
// Try to extract a name from the source location.
Optional<StringRef> text = getTextFromRange(loc);
if (text && text->startswith("^")) {
@@ -285,16 +285,16 @@ struct MLIRDocument {
Optional<lsp::Hover> findHover(const lsp::URIForFile &uri,
const lsp::Position &hoverPos);
Optional<lsp::Hover>
- buildHoverForOperation(llvm::SMRange hoverRange,
+ buildHoverForOperation(SMRange hoverRange,
const AsmParserState::OperationDefinition &op);
- lsp::Hover buildHoverForOperationResult(llvm::SMRange hoverRange,
+ lsp::Hover buildHoverForOperationResult(SMRange hoverRange,
Operation *op, unsigned resultStart,
unsigned resultEnd,
- llvm::SMLoc posLoc);
- lsp::Hover buildHoverForBlock(llvm::SMRange hoverRange,
+ SMLoc posLoc);
+ lsp::Hover buildHoverForBlock(SMRange hoverRange,
const AsmParserState::BlockDefinition &block);
lsp::Hover
- buildHoverForBlockArgument(llvm::SMRange hoverRange, BlockArgument arg,
+ buildHoverForBlockArgument(SMRange hoverRange, BlockArgument arg,
const AsmParserState::BlockDefinition &block);
//===--------------------------------------------------------------------===//
@@ -335,7 +335,7 @@ MLIRDocument::MLIRDocument(MLIRContext &context, const lsp::URIForFile &uri,
return;
}
- sourceMgr.AddNewSourceBuffer(std::move(memBuffer), llvm::SMLoc());
+ sourceMgr.AddNewSourceBuffer(std::move(memBuffer), SMLoc());
if (failed(parseSourceFile(sourceMgr, &parsedIR, &context, nullptr,
&asmState))) {
// If parsing failed, clear out any of the current state.
@@ -352,7 +352,7 @@ MLIRDocument::MLIRDocument(MLIRContext &context, const lsp::URIForFile &uri,
void MLIRDocument::getLocationsOf(const lsp::URIForFile &uri,
const lsp::Position &defPos,
std::vector<lsp::Location> &locations) {
- llvm::SMLoc posLoc = getPosFromLoc(sourceMgr, defPos);
+ SMLoc posLoc = getPosFromLoc(sourceMgr, defPos);
// Functor used to check if an SM definition contains the position.
auto containsPosition = [&](const AsmParserState::SMDefinition &def) {
@@ -394,11 +394,11 @@ void MLIRDocument::findReferencesOf(const lsp::URIForFile &uri,
// definition to the reference list.
auto appendSMDef = [&](const AsmParserState::SMDefinition &def) {
references.push_back(getLocationFromLoc(sourceMgr, def.loc, uri));
- for (const llvm::SMRange &use : def.uses)
+ for (const SMRange &use : def.uses)
references.push_back(getLocationFromLoc(sourceMgr, use, uri));
};
- llvm::SMLoc posLoc = getPosFromLoc(sourceMgr, pos);
+ SMLoc posLoc = getPosFromLoc(sourceMgr, pos);
// Check all definitions related to operations.
for (const AsmParserState::OperationDefinition &op : asmState.getOpDefs()) {
@@ -439,8 +439,8 @@ void MLIRDocument::findReferencesOf(const lsp::URIForFile &uri,
Optional<lsp::Hover> MLIRDocument::findHover(const lsp::URIForFile &uri,
const lsp::Position &hoverPos) {
- llvm::SMLoc posLoc = getPosFromLoc(sourceMgr, hoverPos);
- llvm::SMRange hoverRange;
+ SMLoc posLoc = getPosFromLoc(sourceMgr, hoverPos);
+ SMRange hoverRange;
// Check for Hovers on operations and results.
for (const AsmParserState::OperationDefinition &op : asmState.getOpDefs()) {
@@ -485,7 +485,7 @@ Optional<lsp::Hover> MLIRDocument::findHover(const lsp::URIForFile &uri,
}
Optional<lsp::Hover> MLIRDocument::buildHoverForOperation(
- llvm::SMRange hoverRange, const AsmParserState::OperationDefinition &op) {
+ SMRange hoverRange, const AsmParserState::OperationDefinition &op) {
lsp::Hover hover(getRangeFromLoc(sourceMgr, hoverRange));
llvm::raw_string_ostream os(hover.contents.value);
@@ -517,11 +517,11 @@ Optional<lsp::Hover> MLIRDocument::buildHoverForOperation(
return hover;
}
-lsp::Hover MLIRDocument::buildHoverForOperationResult(llvm::SMRange hoverRange,
+lsp::Hover MLIRDocument::buildHoverForOperationResult(SMRange hoverRange,
Operation *op,
unsigned resultStart,
unsigned resultEnd,
- llvm::SMLoc posLoc) {
+ SMLoc posLoc) {
lsp::Hover hover(getRangeFromLoc(sourceMgr, hoverRange));
llvm::raw_string_ostream os(hover.contents.value);
@@ -553,7 +553,7 @@ lsp::Hover MLIRDocument::buildHoverForOperationResult(llvm::SMRange hoverRange,
}
lsp::Hover
-MLIRDocument::buildHoverForBlock(llvm::SMRange hoverRange,
+MLIRDocument::buildHoverForBlock(SMRange hoverRange,
const AsmParserState::BlockDefinition &block) {
lsp::Hover hover(getRangeFromLoc(sourceMgr, hoverRange));
llvm::raw_string_ostream os(hover.contents.value);
@@ -585,7 +585,7 @@ MLIRDocument::buildHoverForBlock(llvm::SMRange hoverRange,
}
lsp::Hover MLIRDocument::buildHoverForBlockArgument(
- llvm::SMRange hoverRange, BlockArgument arg,
+ SMRange hoverRange, BlockArgument arg,
const AsmParserState::BlockDefinition &block) {
lsp::Hover hover(getRangeFromLoc(sourceMgr, hoverRange));
llvm::raw_string_ostream os(hover.contents.value);
diff --git a/mlir/lib/Translation/Translation.cpp b/mlir/lib/Translation/Translation.cpp
index 43349a82c2639..5e989dbc00b52 100644
--- a/mlir/lib/Translation/Translation.cpp
+++ b/mlir/lib/Translation/Translation.cpp
@@ -181,7 +181,7 @@ LogicalResult mlir::mlirTranslateMain(int argc, char **argv,
MLIRContext context;
context.printOpOnDiagnostic(!verifyDiagnostics);
llvm::SourceMgr sourceMgr;
- sourceMgr.AddNewSourceBuffer(std::move(ownedBuffer), llvm::SMLoc());
+ sourceMgr.AddNewSourceBuffer(std::move(ownedBuffer), SMLoc());
if (!verifyDiagnostics) {
SourceMgrDiagnosticHandler sourceMgrHandler(sourceMgr, &context);
diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp
index d82f7af73decb..21db4e0a9d11a 100644
--- a/mlir/test/lib/Dialect/Test/TestDialect.cpp
+++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp
@@ -729,7 +729,7 @@ static void print(OpAsmPrinter &p, WrappingRegionOp op) {
static ParseResult parsePrettyPrintedRegionOp(OpAsmParser &parser,
OperationState &result) {
- llvm::SMLoc loc = parser.getCurrentLocation();
+ SMLoc loc = parser.getCurrentLocation();
Location currLocation = parser.getEncodedSourceLoc(loc);
// Parse the operands.
diff --git a/mlir/tools/mlir-pdll/mlir-pdll.cpp b/mlir/tools/mlir-pdll/mlir-pdll.cpp
index 9fb61aca42d8b..5600e66eafdb3 100644
--- a/mlir/tools/mlir-pdll/mlir-pdll.cpp
+++ b/mlir/tools/mlir-pdll/mlir-pdll.cpp
@@ -33,7 +33,7 @@ processBuffer(raw_ostream &os, std::unique_ptr<llvm::MemoryBuffer> chunkBuffer,
OutputType outputType, std::vector<std::string> &includeDirs) {
llvm::SourceMgr sourceMgr;
sourceMgr.setIncludeDirs(includeDirs);
- sourceMgr.AddNewSourceBuffer(std::move(chunkBuffer), llvm::SMLoc());
+ sourceMgr.AddNewSourceBuffer(std::move(chunkBuffer), SMLoc());
ast::Context astContext;
FailureOr<ast::Module *> module = parsePDLAST(astContext, sourceMgr);
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
index f0ac7d217d2c2..1a1f6b9976136 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
@@ -757,7 +757,7 @@ void mlir::tblgen::generateAttrOrTypeFormat(const AttrOrTypeDef &def,
llvm::SourceMgr mgr;
mgr.AddNewSourceBuffer(
llvm::MemoryBuffer::getMemBuffer(*def.getAssemblyFormat()),
- llvm::SMLoc());
+ SMLoc());
/// Parse the custom assembly format>
FormatParser fmtParser(mgr, def);
diff --git a/mlir/tools/mlir-tblgen/FormatGen.cpp b/mlir/tools/mlir-tblgen/FormatGen.cpp
index 16f026ab7ecd9..d656253c7551b 100644
--- a/mlir/tools/mlir-tblgen/FormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/FormatGen.cpp
@@ -18,20 +18,20 @@ using namespace mlir::tblgen;
// FormatToken
//===----------------------------------------------------------------------===//
-llvm::SMLoc FormatToken::getLoc() const {
- return llvm::SMLoc::getFromPointer(spelling.data());
+SMLoc FormatToken::getLoc() const {
+ return SMLoc::getFromPointer(spelling.data());
}
//===----------------------------------------------------------------------===//
// FormatLexer
//===----------------------------------------------------------------------===//
-FormatLexer::FormatLexer(llvm::SourceMgr &mgr, llvm::SMLoc loc)
+FormatLexer::FormatLexer(llvm::SourceMgr &mgr, SMLoc loc)
: mgr(mgr), loc(loc),
curBuffer(mgr.getMemoryBuffer(mgr.getMainFileID())->getBuffer()),
curPtr(curBuffer.begin()) {}
-FormatToken FormatLexer::emitError(llvm::SMLoc loc, const Twine &msg) {
+FormatToken FormatLexer::emitError(SMLoc loc, const Twine &msg) {
mgr.PrintMessage(loc, llvm::SourceMgr::DK_Error, msg);
llvm::SrcMgr.PrintMessage(this->loc, llvm::SourceMgr::DK_Note,
"in custom assembly format for this operation");
@@ -39,10 +39,10 @@ FormatToken FormatLexer::emitError(llvm::SMLoc loc, const Twine &msg) {
}
FormatToken FormatLexer::emitError(const char *loc, const Twine &msg) {
- return emitError(llvm::SMLoc::getFromPointer(loc), msg);
+ return emitError(SMLoc::getFromPointer(loc), msg);
}
-FormatToken FormatLexer::emitErrorAndNote(llvm::SMLoc loc, const Twine &msg,
+FormatToken FormatLexer::emitErrorAndNote(SMLoc loc, const Twine &msg,
const Twine ¬e) {
mgr.PrintMessage(loc, llvm::SourceMgr::DK_Error, msg);
llvm::SrcMgr.PrintMessage(this->loc, llvm::SourceMgr::DK_Note,
diff --git a/mlir/tools/mlir-tblgen/FormatGen.h b/mlir/tools/mlir-tblgen/FormatGen.h
index ae0d12ded2a39..4d290a9ee1f90 100644
--- a/mlir/tools/mlir-tblgen/FormatGen.h
+++ b/mlir/tools/mlir-tblgen/FormatGen.h
@@ -83,7 +83,7 @@ class FormatToken {
Kind getKind() const { return kind; }
/// Return a location for this token.
- llvm::SMLoc getLoc() const;
+ SMLoc getLoc() const;
/// Return if this token is a keyword.
bool isKeyword() const {
@@ -106,16 +106,16 @@ class FormatToken {
/// This class implements a simple lexer for operation assembly format strings.
class FormatLexer {
public:
- FormatLexer(llvm::SourceMgr &mgr, llvm::SMLoc loc);
+ FormatLexer(llvm::SourceMgr &mgr, SMLoc loc);
/// Lex the next token and return it.
FormatToken lexToken();
/// Emit an error to the lexer with the given location and message.
- FormatToken emitError(llvm::SMLoc loc, const Twine &msg);
+ FormatToken emitError(SMLoc loc, const Twine &msg);
FormatToken emitError(const char *loc, const Twine &msg);
- FormatToken emitErrorAndNote(llvm::SMLoc loc, const Twine &msg,
+ FormatToken emitErrorAndNote(SMLoc loc, const Twine &msg,
const Twine ¬e);
private:
@@ -135,7 +135,7 @@ class FormatLexer {
/// The source manager containing the format string.
llvm::SourceMgr &mgr;
/// Location of the format string.
- llvm::SMLoc loc;
+ SMLoc loc;
/// Buffer containing the format string.
StringRef curBuffer;
/// Current pointer in the buffer.
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 1f0a37e6330eb..0be172ef3fc81 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -2223,27 +2223,27 @@ class FormatParser {
std::vector<std::unique_ptr<Element>>::const_iterator>;
/// Verify the state of operation attributes within the format.
- LogicalResult verifyAttributes(llvm::SMLoc loc);
+ LogicalResult verifyAttributes(SMLoc loc);
/// Verify the attribute elements at the back of the given stack of iterators.
LogicalResult verifyAttributes(
- llvm::SMLoc loc,
+ SMLoc loc,
SmallVectorImpl<std::pair<ElementsIterT, ElementsIterT>> &iteratorStack);
/// Verify the state of operation operands within the format.
LogicalResult
- verifyOperands(llvm::SMLoc loc,
+ verifyOperands(SMLoc loc,
llvm::StringMap<TypeResolutionInstance> &variableTyResolver);
/// Verify the state of operation regions within the format.
- LogicalResult verifyRegions(llvm::SMLoc loc);
+ LogicalResult verifyRegions(SMLoc loc);
/// Verify the state of operation results within the format.
LogicalResult
- verifyResults(llvm::SMLoc loc,
+ verifyResults(SMLoc loc,
llvm::StringMap<TypeResolutionInstance> &variableTyResolver);
/// Verify the state of operation successors within the format.
- LogicalResult verifySuccessors(llvm::SMLoc loc);
+ LogicalResult verifySuccessors(SMLoc loc);
/// Given the values of an `AllTypesMatch` trait, check for inferable type
/// resolution.
@@ -2281,31 +2281,31 @@ class FormatParser {
std::vector<std::unique_ptr<Element>> &childElements,
Optional<unsigned> &anchorIdx);
LogicalResult verifyOptionalChildElement(Element *element,
- llvm::SMLoc childLoc, bool isAnchor);
+ SMLoc childLoc, bool isAnchor);
/// Parse the various
diff erent directives.
LogicalResult parseAttrDictDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context,
+ SMLoc loc, ParserContext context,
bool withKeyword);
LogicalResult parseCustomDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context);
+ SMLoc loc, ParserContext context);
LogicalResult parseCustomDirectiveParameter(
std::vector<std::unique_ptr<Element>> ¶meters);
LogicalResult parseFunctionalTypeDirective(std::unique_ptr<Element> &element,
FormatToken tok,
ParserContext context);
LogicalResult parseOperandsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context);
+ SMLoc loc, ParserContext context);
LogicalResult parseQualifiedDirective(std::unique_ptr<Element> &element,
FormatToken tok, ParserContext context);
LogicalResult parseReferenceDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context);
+ SMLoc loc, ParserContext context);
LogicalResult parseRegionsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context);
+ SMLoc loc, ParserContext context);
LogicalResult parseResultsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context);
+ SMLoc loc, ParserContext context);
LogicalResult parseSuccessorsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc,
+ SMLoc loc,
ParserContext context);
LogicalResult parseTypeDirective(std::unique_ptr<Element> &element,
FormatToken tok, ParserContext context);
@@ -2329,11 +2329,11 @@ class FormatParser {
consumeToken();
return ::mlir::success();
}
- LogicalResult emitError(llvm::SMLoc loc, const Twine &msg) {
+ LogicalResult emitError(SMLoc loc, const Twine &msg) {
lexer.emitError(loc, msg);
return ::mlir::failure();
}
- LogicalResult emitErrorAndNote(llvm::SMLoc loc, const Twine &msg,
+ LogicalResult emitErrorAndNote(SMLoc loc, const Twine &msg,
const Twine ¬e) {
lexer.emitErrorAndNote(loc, msg, note);
return ::mlir::failure();
@@ -2362,7 +2362,7 @@ class FormatParser {
} // namespace
LogicalResult FormatParser::parse() {
- llvm::SMLoc loc = curToken.getLoc();
+ SMLoc loc = curToken.getLoc();
// Parse each of the format elements into the main format.
while (curToken.getKind() != FormatToken::eof) {
@@ -2415,7 +2415,7 @@ LogicalResult FormatParser::parse() {
return ::mlir::success();
}
-LogicalResult FormatParser::verifyAttributes(llvm::SMLoc loc) {
+LogicalResult FormatParser::verifyAttributes(SMLoc loc) {
// Check that there are no `:` literals after an attribute without a constant
// type. The attribute grammar contains an optional trailing colon type, which
// can lead to unexpected and generally unintended behavior. Given that, it is
@@ -2441,7 +2441,7 @@ LogicalResult FormatParser::verifyAttributes(llvm::SMLoc loc) {
}
/// Verify the attribute elements at the back of the given stack of iterators.
LogicalResult FormatParser::verifyAttributes(
- llvm::SMLoc loc,
+ SMLoc loc,
SmallVectorImpl<std::pair<ElementsIterT, ElementsIterT>> &iteratorStack) {
auto &stackIt = iteratorStack.back();
ElementsIterT &it = stackIt.first, e = stackIt.second;
@@ -2497,7 +2497,7 @@ LogicalResult FormatParser::verifyAttributes(
}
LogicalResult FormatParser::verifyOperands(
- llvm::SMLoc loc,
+ SMLoc loc,
llvm::StringMap<TypeResolutionInstance> &variableTyResolver) {
// Check that all of the operands are within the format, and their types can
// be inferred.
@@ -2544,7 +2544,7 @@ LogicalResult FormatParser::verifyOperands(
return ::mlir::success();
}
-LogicalResult FormatParser::verifyRegions(llvm::SMLoc loc) {
+LogicalResult FormatParser::verifyRegions(SMLoc loc) {
// Check that all of the regions are within the format.
if (hasAllRegions)
return ::mlir::success();
@@ -2563,7 +2563,7 @@ LogicalResult FormatParser::verifyRegions(llvm::SMLoc loc) {
}
LogicalResult FormatParser::verifyResults(
- llvm::SMLoc loc,
+ SMLoc loc,
llvm::StringMap<TypeResolutionInstance> &variableTyResolver) {
// If we format all of the types together, there is nothing to check.
if (fmt.allResultTypes)
@@ -2611,7 +2611,7 @@ LogicalResult FormatParser::verifyResults(
return ::mlir::success();
}
-LogicalResult FormatParser::verifySuccessors(llvm::SMLoc loc) {
+LogicalResult FormatParser::verifySuccessors(SMLoc loc) {
// Check that all of the successors are within the format.
if (hasAllSuccessors)
return ::mlir::success();
@@ -2715,7 +2715,7 @@ LogicalResult FormatParser::parseVariable(std::unique_ptr<Element> &element,
consumeToken();
StringRef name = varTok.getSpelling().drop_front();
- llvm::SMLoc loc = varTok.getLoc();
+ SMLoc loc = varTok.getLoc();
// Check that the parsed argument is something actually registered on the
// op.
@@ -2861,7 +2861,7 @@ LogicalResult FormatParser::parseLiteral(std::unique_ptr<Element> &element,
LogicalResult FormatParser::parseOptional(std::unique_ptr<Element> &element,
ParserContext context) {
- llvm::SMLoc curLoc = curToken.getLoc();
+ SMLoc curLoc = curToken.getLoc();
if (context != TopLevelContext)
return emitError(curLoc, "optional groups can only be used as top-level "
"elements");
@@ -2884,7 +2884,7 @@ LogicalResult FormatParser::parseOptional(std::unique_ptr<Element> &element,
"of optional group")))
return failure();
do {
- llvm::SMLoc childLoc = curToken.getLoc();
+ SMLoc childLoc = curToken.getLoc();
elseElements.push_back({});
if (failed(parseElement(elseElements.back(), TopLevelContext)) ||
failed(verifyOptionalChildElement(elseElements.back().get(), childLoc,
@@ -2924,7 +2924,7 @@ LogicalResult FormatParser::parseOptional(std::unique_ptr<Element> &element,
LogicalResult FormatParser::parseOptionalChildElement(
std::vector<std::unique_ptr<Element>> &childElements,
Optional<unsigned> &anchorIdx) {
- llvm::SMLoc childLoc = curToken.getLoc();
+ SMLoc childLoc = curToken.getLoc();
childElements.push_back({});
if (failed(parseElement(childElements.back(), TopLevelContext)))
return ::mlir::failure();
@@ -2944,7 +2944,7 @@ LogicalResult FormatParser::parseOptionalChildElement(
}
LogicalResult FormatParser::verifyOptionalChildElement(Element *element,
- llvm::SMLoc childLoc,
+ SMLoc childLoc,
bool isAnchor) {
return TypeSwitch<Element *, LogicalResult>(element)
// All attributes can be within the optional group, but only optional
@@ -3004,7 +3004,7 @@ LogicalResult FormatParser::verifyOptionalChildElement(Element *element,
LogicalResult
FormatParser::parseAttrDictDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context,
+ SMLoc loc, ParserContext context,
bool withKeyword) {
if (context == TypeDirectiveContext)
return emitError(loc, "'attr-dict' directive can only be used as a "
@@ -3028,8 +3028,8 @@ FormatParser::parseAttrDictDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseCustomDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context) {
- llvm::SMLoc curLoc = curToken.getLoc();
+ SMLoc loc, ParserContext context) {
+ SMLoc curLoc = curToken.getLoc();
if (context != TopLevelContext)
return emitError(loc, "'custom' is only valid as a top-level directive");
@@ -3079,7 +3079,7 @@ FormatParser::parseCustomDirective(std::unique_ptr<Element> &element,
LogicalResult FormatParser::parseCustomDirectiveParameter(
std::vector<std::unique_ptr<Element>> ¶meters) {
- llvm::SMLoc childLoc = curToken.getLoc();
+ SMLoc childLoc = curToken.getLoc();
parameters.push_back({});
if (failed(parseElement(parameters.back(), CustomDirectiveContext)))
return ::mlir::failure();
@@ -3096,7 +3096,7 @@ LogicalResult FormatParser::parseCustomDirectiveParameter(
LogicalResult FormatParser::parseFunctionalTypeDirective(
std::unique_ptr<Element> &element, FormatToken tok, ParserContext context) {
- llvm::SMLoc loc = tok.getLoc();
+ SMLoc loc = tok.getLoc();
if (context != TopLevelContext)
return emitError(
loc, "'functional-type' is only valid as a top-level directive");
@@ -3119,7 +3119,7 @@ LogicalResult FormatParser::parseFunctionalTypeDirective(
LogicalResult
FormatParser::parseOperandsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context) {
+ SMLoc loc, ParserContext context) {
if (context == RefDirectiveContext) {
if (!fmt.allOperands)
return emitError(loc, "'ref' of 'operands' is not bound by a prior "
@@ -3136,7 +3136,7 @@ FormatParser::parseOperandsDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseReferenceDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context) {
+ SMLoc loc, ParserContext context) {
if (context != CustomDirectiveContext)
return emitError(loc, "'ref' is only valid within a `custom` directive");
@@ -3154,7 +3154,7 @@ FormatParser::parseReferenceDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseRegionsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context) {
+ SMLoc loc, ParserContext context) {
if (context == TypeDirectiveContext)
return emitError(loc, "'regions' is only valid as a top-level directive");
if (context == RefDirectiveContext) {
@@ -3174,7 +3174,7 @@ FormatParser::parseRegionsDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseResultsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context) {
+ SMLoc loc, ParserContext context) {
if (context != TypeDirectiveContext)
return emitError(loc, "'results' directive can can only be used as a child "
"to a 'type' directive");
@@ -3184,7 +3184,7 @@ FormatParser::parseResultsDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseSuccessorsDirective(std::unique_ptr<Element> &element,
- llvm::SMLoc loc, ParserContext context) {
+ SMLoc loc, ParserContext context) {
if (context == TypeDirectiveContext)
return emitError(loc,
"'successors' is only valid as a top-level directive");
@@ -3206,7 +3206,7 @@ FormatParser::parseSuccessorsDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseTypeDirective(std::unique_ptr<Element> &element,
FormatToken tok, ParserContext context) {
- llvm::SMLoc loc = tok.getLoc();
+ SMLoc loc = tok.getLoc();
if (context == TypeDirectiveContext)
return emitError(loc, "'type' cannot be used as a child of another `type`");
@@ -3247,7 +3247,7 @@ FormatParser::parseQualifiedDirective(std::unique_ptr<Element> &element,
LogicalResult
FormatParser::parseTypeDirectiveOperand(std::unique_ptr<Element> &element,
bool isRefChild) {
- llvm::SMLoc loc = curToken.getLoc();
+ SMLoc loc = curToken.getLoc();
if (failed(parseElement(element, TypeDirectiveContext)))
return ::mlir::failure();
if (isa<LiteralElement>(element.get()))
@@ -3306,7 +3306,7 @@ void mlir::tblgen::generateOpFormat(const Operator &constOp, OpClass &opClass) {
// Parse the format description.
llvm::SourceMgr mgr;
mgr.AddNewSourceBuffer(
- llvm::MemoryBuffer::getMemBuffer(op.getAssemblyFormat()), llvm::SMLoc());
+ llvm::MemoryBuffer::getMemBuffer(op.getAssemblyFormat()), SMLoc());
OperationFormat format(op);
if (failed(FormatParser(mgr, format, op).parse())) {
// Exit the process if format errors are treated as fatal.
diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 03892192995ab..4fcc880464c98 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -229,7 +229,7 @@ class PatternEmitter {
// Pattern instantiation location followed by the location of multiclass
// prototypes used. This is intended to be used as a whole to
// PrintFatalError() on errors.
- ArrayRef<llvm::SMLoc> loc;
+ ArrayRef<SMLoc> loc;
// Op's TableGen Record to wrapper object.
RecordOperatorMap *opMap;
diff --git a/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp b/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp
index 5da5ecc5bcf1d..4bdfa71d8bc49 100644
--- a/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp
+++ b/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp
@@ -3,6 +3,7 @@
#include "gtest/gtest.h"
#include <memory>
+using namespace mlir;
using namespace mlir::sparse_tensor;
namespace {
More information about the Mlir-commits
mailing list