@@ -136,7 +136,7 @@ mlir::Type fir::parseFirType(FIROpsDialect *dialect,
136136 auto parseResult = generatedTypeParser (parser, &typeTag, genType);
137137 if (parseResult.has_value ())
138138 return genType;
139- parser.emitError (parser.getNameLoc (), " unknown fir type: " ) << typeTag;
139+ parser.emitError (parser.getCurrentLocation (), " unknown fir type: " ) << typeTag;
140140 return {};
141141}
142142
@@ -770,12 +770,13 @@ fir::BoxType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
770770
771771mlir::Type fir::BoxType::parse (mlir::AsmParser &parser) {
772772 mlir::Type ty;
773- bool isVolatile;
773+ bool isVolatile = false ;
774+ auto loc = parser.getCurrentLocation ();
774775 if (parser.parseLess () || parser.parseType (ty) ||
775776 parseOptionalCommaAndKeyword (parser, getVolatileKeyword (), isVolatile) ||
776777 parser.parseGreater ())
777778 return {};
778- return get ( ty, isVolatile);
779+ return parser. getChecked <BoxType>(loc, parser. getContext (), ty, isVolatile);
779780}
780781
781782void fir::BoxType::print (mlir::AsmPrinter &printer) const {
@@ -1098,12 +1099,13 @@ unsigned fir::RecordType::getFieldIndex(llvm::StringRef ident) {
10981099// `ref` `<` type (`, volatile` $volatile^)? `>`
10991100mlir::Type fir::ReferenceType::parse (mlir::AsmParser &parser) {
11001101 mlir::Type ty;
1101- bool isVolatile;
1102+ bool isVolatile = false ;
1103+ auto loc = parser.getCurrentLocation ();
11021104 if (parser.parseLess () || parser.parseType (ty) ||
11031105 parseOptionalCommaAndKeyword (parser, getVolatileKeyword (), isVolatile) ||
11041106 parser.parseGreater ())
11051107 return {};
1106- return get ( ty, isVolatile);
1108+ return parser. getChecked <ReferenceType>(loc, parser. getContext (), ty, isVolatile);
11071109}
11081110
11091111void fir::ReferenceType::print (mlir::AsmPrinter &printer) const {
0 commit comments