diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp index 87f9899aa7879..31dacaee23fb0 100644 --- a/flang/lib/Optimizer/Dialect/FIROps.cpp +++ b/flang/lib/Optimizer/Dialect/FIROps.cpp @@ -1774,12 +1774,13 @@ llvm::LogicalResult fir::CoordinateOp::verify() { return emitOpError("too many operands for len_param_index case"); } if (eleTy != index.getOnType()) - emitOpError( + return emitOpError( "len_param_index type not compatible with reference type"); return mlir::success(); } else if (auto index = mlir::dyn_cast(defOp)) { if (eleTy != index.getOnType()) - emitOpError("field_index type not compatible with reference type"); + return emitOpError( + "field_index type not compatible with reference type"); if (auto recTy = mlir::dyn_cast(eleTy)) { eleTy = recTy.getType(index.getFieldName()); continue; @@ -3406,26 +3407,30 @@ llvm::LogicalResult fir::SaveResultOp::verify() { auto eleTy = resultType; if (auto seqTy = mlir::dyn_cast(resultType)) { if (seqTy.getDimension() != shapeTyRank) - emitOpError("shape operand must be provided and have the value rank " - "when the value is a fir.array"); + return emitOpError( + "shape operand must be provided and have the value rank " + "when the value is a fir.array"); eleTy = seqTy.getEleTy(); } else { if (shapeTyRank != 0) - emitOpError( + return emitOpError( "shape operand should only be provided if the value is a fir.array"); } if (auto recTy = mlir::dyn_cast(eleTy)) { if (recTy.getNumLenParams() != getTypeparams().size()) - emitOpError("length parameters number must match with the value type " - "length parameters"); + return emitOpError( + "length parameters number must match with the value type " + "length parameters"); } else if (auto charTy = mlir::dyn_cast(eleTy)) { if (getTypeparams().size() > 1) - emitOpError("no more than one length parameter must be provided for " - "character value"); + return emitOpError( + "no more than one length parameter must be provided for " + "character value"); } else { if (!getTypeparams().empty()) - emitOpError("length parameters must not be provided for this value type"); + return emitOpError( + "length parameters must not be provided for this value type"); } return mlir::success(); diff --git a/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp b/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp index f16072a90dfae..925276e1f86c4 100644 --- a/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp +++ b/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp @@ -53,8 +53,9 @@ fir::FortranVariableOpInterface::verifyDeclareLikeOpImpl(mlir::Value memref) { shapeRank = shapeShiftType.getRank(); } else { if (!sourceIsBoxValue) - emitOpError("of array entity with a raw address base must have a " - "shape operand that is a shape or shapeshift"); + return emitOpError( + "of array entity with a raw address base must have a " + "shape operand that is a shape or shapeshift"); shapeRank = mlir::cast(shape.getType()).getRank(); } @@ -62,8 +63,9 @@ fir::FortranVariableOpInterface::verifyDeclareLikeOpImpl(mlir::Value memref) { if (!rank || *rank != shapeRank) return emitOpError("has conflicting shape and base operand ranks"); } else if (!sourceIsBox) { - emitOpError("of array entity with a raw address base must have a shape " - "operand that is a shape or shapeshift"); + return emitOpError( + "of array entity with a raw address base must have a shape " + "operand that is a shape or shapeshift"); } } return mlir::success();