[flang-commits] [flang] 890afad - Fix Flang build after MLIR API changes around `generatedTypeParser`
Mehdi Amini via flang-commits
flang-commits at lists.llvm.org
Tue Mar 9 15:19:42 PST 2021
Author: Mehdi Amini
Date: 2021-03-09T23:19:30Z
New Revision: 890afad954d60aa91a27fa5ef0689e1d53aad7b4
URL: https://github.com/llvm/llvm-project/commit/890afad954d60aa91a27fa5ef0689e1d53aad7b4
DIFF: https://github.com/llvm/llvm-project/commit/890afad954d60aa91a27fa5ef0689e1d53aad7b4.diff
LOG: Fix Flang build after MLIR API changes around `generatedTypeParser`
Added:
Modified:
flang/lib/Optimizer/Dialect/FIRType.cpp
mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp
index eb347a963120..873f589e8a4b 100644
--- a/flang/lib/Optimizer/Dialect/FIRType.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRType.cpp
@@ -112,10 +112,16 @@ RecordType verifyDerived(mlir::DialectAsmParser &parser, RecordType derivedTy,
mlir::Type fir::parseFirType(FIROpsDialect *dialect,
mlir::DialectAsmParser &parser) {
- llvm::StringRef typeNameLit;
- if (mlir::failed(parser.parseKeyword(&typeNameLit)))
+ mlir::StringRef typeTag;
+ if (parser.parseKeyword(&typeTag))
return {};
- return generatedTypeParser(dialect->getContext(), parser, typeNameLit);
+ mlir::Type genType;
+ auto parseResult = generatedTypeParser(parser.getBuilder().getContext(),
+ parser, typeTag, genType);
+ if (parseResult.hasValue())
+ return genType;
+ parser.emitError(parser.getNameLoc(), "unknown fir type: ") << typeTag;
+ return {};
}
namespace fir {
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
index bfac87ffed70..2c3caaeeea25 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
@@ -412,7 +412,7 @@ void DefGenerator::emitTypeDefList(ArrayRef<AttrOrTypeDef> defs) {
/// {0}: The name of the base value type, e.g. Attribute or Type.
/// {1}: Additional parser parameters.
static const char *const defParserDispatchStartStr = R"(
-static OptionalParseResult generated{0}Parser(::mlir::MLIRContext *context,
+static ::mlir::OptionalParseResult generated{0}Parser(::mlir::MLIRContext *context,
::mlir::DialectAsmParser &parser,
::llvm::StringRef mnemonic{1},
::mlir::{0} &value) {{
@@ -813,12 +813,12 @@ void DefGenerator::emitParsePrintDispatch(ArrayRef<AttrOrTypeDef> defs) {
// If the def has no parameters and no parser code, just invoke a normal
// `get`.
if (def.getNumParameters() == 0 && !def.getParserCode()) {
- os << "get(context);\n return success(!!value);\n }\n";
+ os << "get(context);\n return ::mlir::success(!!value);\n }\n";
continue;
}
os << "parse(context, parser" << (isAttrGenerator ? ", type" : "")
- << ");\n return success(!!value);\n }\n";
+ << ");\n return ::mlir::success(!!value);\n }\n";
}
}
os << " return {};\n";
More information about the flang-commits
mailing list