diff --git a/flang/include/flang/Optimizer/Dialect/FIRTypes.td b/flang/include/flang/Optimizer/Dialect/FIRTypes.td --- a/flang/include/flang/Optimizer/Dialect/FIRTypes.td +++ b/flang/include/flang/Optimizer/Dialect/FIRTypes.td @@ -75,25 +75,24 @@ to) whether the entity is an array, its size, or what type it has. }]; - let parameters = (ins "mlir::Type":$eleTy, "mlir::AffineMapAttr":$map); + let parameters = (ins "mlir::Type":$eleTy); let skipDefaultBuilders = 1; let builders = [ TypeBuilderWithInferredContext<(ins - "mlir::Type":$eleTy, - CArg<"mlir::AffineMapAttr", "{}">:$map), [{ - return Base::get(eleTy.getContext(), eleTy, map); + "mlir::Type":$eleTy), [{ + return Base::get(eleTy.getContext(), eleTy); }]>, ]; let extraClassDeclaration = [{ mlir::Type getElementType() const { return getEleTy(); } - mlir::AffineMapAttr getLayoutMap() const { return getMap(); } }]; let genVerifyDecl = 1; - let hasCustomAssemblyFormat = 1; + + let assemblyFormat = "`<` $eleTy `>`"; } def fir_CharacterType : FIR_Type<"Character", "char"> { diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp --- a/flang/lib/Optimizer/Dialect/FIRType.cpp +++ b/flang/lib/Optimizer/Dialect/FIRType.cpp @@ -377,35 +377,9 @@ // BoxType //===----------------------------------------------------------------------===// -// `box` `<` type (',' affine-map)? `>` -mlir::Type fir::BoxType::parse(mlir::AsmParser &parser) { - mlir::Type ofTy; - if (parser.parseLess() || parser.parseType(ofTy)) - return {}; - - mlir::AffineMapAttr map; - if (!parser.parseOptionalComma()) { - if (parser.parseAttribute(map)) { - parser.emitError(parser.getCurrentLocation(), "expected affine map"); - return {}; - } - } - if (parser.parseGreater()) - return {}; - return get(ofTy, map); -} - -void fir::BoxType::print(mlir::AsmPrinter &printer) const { - printer << "<" << getEleTy(); - if (auto map = getLayoutMap()) { - printer << ", " << map; - } - printer << '>'; -} - mlir::LogicalResult fir::BoxType::verify(llvm::function_ref emitError, - mlir::Type eleTy, mlir::AffineMapAttr map) { + mlir::Type eleTy) { // TODO return mlir::success(); } diff --git a/flang/test/Fir/invalid-types.fir b/flang/test/Fir/invalid-types.fir --- a/flang/test/Fir/invalid-types.fir +++ b/flang/test/Fir/invalid-types.fir @@ -6,13 +6,8 @@ // ----- -// expected-error@+2 {{expected attribute value}} -// expected-error@+1 {{expected affine map}} -func.func private @box1() -> !fir.box, > - -// ----- - -// expected-error@+1 {{expected non-function type}} +// expected-error@+2 {{expected non-function type}} +// expected-error@+1 {{failed to parse fir_BoxType parameter 'eleTy' which is to be a `mlir::Type`}} func.func private @box1() -> !fir.box<> // -----