[Mlir-commits] [mlir] 15b089c - [mlir] Make `printAlias` hooks public (NFC) (#78833)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jan 19 23:23:46 PST 2024
Author: Jeff Niu
Date: 2024-01-19T23:23:41-08:00
New Revision: 15b089cb023eaf7f80bcd5cd0e0e5fdd2fa2cbd0
URL: https://github.com/llvm/llvm-project/commit/15b089cb023eaf7f80bcd5cd0e0e5fdd2fa2cbd0
DIFF: https://github.com/llvm/llvm-project/commit/15b089cb023eaf7f80bcd5cd0e0e5fdd2fa2cbd0.diff
LOG: [mlir] Make `printAlias` hooks public (NFC) (#78833)
These are very useful when writing custom parsers and printers for
aggregate types or attributes that might want to print aliases.
Added:
Modified:
mlir/include/mlir/IR/OpImplementation.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpImplementation.h
index 86ed14e7ca8439e..5333d7446df5cab 100644
--- a/mlir/include/mlir/IR/OpImplementation.h
+++ b/mlir/include/mlir/IR/OpImplementation.h
@@ -180,6 +180,14 @@ class AsmPrinter {
/// provide a valid type for the attribute.
virtual void printAttributeWithoutType(Attribute attr);
+ /// Print the alias for the given attribute, return failure if no alias could
+ /// be printed.
+ virtual LogicalResult printAlias(Attribute attr);
+
+ /// Print the alias for the given type, return failure if no alias could
+ /// be printed.
+ virtual LogicalResult printAlias(Type type);
+
/// Print the given string as a keyword, or a quoted and escaped string if it
/// has any special or non-printable characters in it.
virtual void printKeywordOrString(StringRef keyword);
@@ -295,14 +303,6 @@ class AsmPrinter {
AsmPrinter(const AsmPrinter &) = delete;
void operator=(const AsmPrinter &) = delete;
- /// Print the alias for the given attribute, return failure if no alias could
- /// be printed.
- virtual LogicalResult printAlias(Attribute attr);
-
- /// Print the alias for the given type, return failure if no alias could
- /// be printed.
- virtual LogicalResult printAlias(Type type);
-
/// The internal implementation of the printer.
Impl *impl{nullptr};
};
@@ -1597,9 +1597,9 @@ class OpAsmParser : public AsmParser {
//===--------------------------------------------------------------------===//
struct Argument {
- UnresolvedOperand ssaName; // SourceLoc, SSA name, result #.
- Type type; // Type.
- DictionaryAttr attrs; // Attributes if present.
+ UnresolvedOperand ssaName; // SourceLoc, SSA name, result #.
+ Type type; // Type.
+ DictionaryAttr attrs; // Attributes if present.
std::optional<Location> sourceLoc; // Source location specifier if present.
};
More information about the Mlir-commits
mailing list