@@ -138,17 +138,13 @@ void IntAttr::print(AsmPrinter &printer) const {
138138
139139LogicalResult IntAttr::verify (function_ref<InFlightDiagnostic()> emitError,
140140 Type type, APInt value) {
141- if (!mlir::isa<IntType>(type)) {
142- emitError () << " expected 'simple.int' type" ;
143- return failure ();
144- }
141+ if (!mlir::isa<IntType>(type))
142+ return emitError () << " expected 'simple.int' type" ;
145143
146144 auto intType = mlir::cast<IntType>(type);
147- if (value.getBitWidth () != intType.getWidth ()) {
148- emitError () << " type and value bitwidth mismatch: " << intType.getWidth ()
149- << " != " << value.getBitWidth ();
150- return failure ();
151- }
145+ if (value.getBitWidth () != intType.getWidth ())
146+ return emitError () << " type and value bitwidth mismatch: "
147+ << intType.getWidth () << " != " << value.getBitWidth ();
152148
153149 return success ();
154150}
@@ -182,10 +178,8 @@ FPAttr FPAttr::getZero(Type type) {
182178LogicalResult FPAttr::verify (function_ref<InFlightDiagnostic()> emitError,
183179 CIRFPTypeInterface fpType, APFloat value) {
184180 if (APFloat::SemanticsToEnum (fpType.getFloatSemantics ()) !=
185- APFloat::SemanticsToEnum (value.getSemantics ())) {
186- emitError () << " floating-point semantics mismatch" ;
187- return failure ();
188- }
181+ APFloat::SemanticsToEnum (value.getSemantics ()))
182+ return emitError () << " floating-point semantics mismatch" ;
189183
190184 return success ();
191185}
@@ -195,22 +189,21 @@ LogicalResult FPAttr::verify(function_ref<InFlightDiagnostic()> emitError,
195189// ===----------------------------------------------------------------------===//
196190
197191LogicalResult
198- ConstArrayAttr::verify (function_ref<::mlir:: InFlightDiagnostic()> emitError,
199- Type type, Attribute elts, int trailingZerosNum) {
192+ ConstArrayAttr::verify (function_ref<InFlightDiagnostic()> emitError, Type type ,
193+ Attribute elts, int trailingZerosNum) {
200194
201- if (!(mlir::isa<ArrayAttr>(elts) || mlir::isa< StringAttr>(elts)))
195+ if (!(mlir::isa<ArrayAttr, StringAttr>(elts)))
202196 return emitError () << " constant array expects ArrayAttr or StringAttr" ;
203197
204198 if (auto strAttr = mlir::dyn_cast<StringAttr>(elts)) {
205199 const auto arrayTy = mlir::cast<ArrayType>(type);
206200 const auto intTy = mlir::dyn_cast<IntType>(arrayTy.getElementType ());
207201
208202 // TODO: add CIR type for char.
209- if (!intTy || intTy.getWidth () != 8 ) {
210- emitError () << " constant array element for string literals expects "
211- " !cir.int<u, 8> element type" ;
212- return failure ();
213- }
203+ if (!intTy || intTy.getWidth () != 8 )
204+ return emitError ()
205+ << " constant array element for string literals expects "
206+ " !cir.int<u, 8> element type" ;
214207 return success ();
215208 }
216209
@@ -303,22 +296,20 @@ void ConstArrayAttr::print(AsmPrinter &printer) const {
303296// CIR ConstVectorAttr
304297// ===----------------------------------------------------------------------===//
305298
306- LogicalResult cir::ConstVectorAttr::verify (
307- function_ref<::mlir:: InFlightDiagnostic()> emitError, Type type ,
308- ArrayAttr elts) {
299+ LogicalResult
300+ cir::ConstVectorAttr::verify (function_ref< InFlightDiagnostic()> emitError,
301+ Type type, ArrayAttr elts) {
309302
310- if (!mlir::isa<cir::VectorType>(type)) {
303+ if (!mlir::isa<cir::VectorType>(type))
311304 return emitError () << " type of cir::ConstVectorAttr is not a "
312305 " cir::VectorType: "
313306 << type;
314- }
315307
316308 const auto vecType = mlir::cast<cir::VectorType>(type);
317309
318- if (vecType.getSize () != elts.size ()) {
310+ if (vecType.getSize () != elts.size ())
319311 return emitError ()
320312 << " number of constant elements should match vector size" ;
321- }
322313
323314 // Check if the types of the elements match
324315 LogicalResult elementTypeCheck = success ();
0 commit comments