@@ -30,13 +30,6 @@ ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
30
30
llvm::StringRef &variable, bool *isConstantTerm) {
31
31
APInt parsedCoeff (apintBitWidth, 1 );
32
32
auto result = parser.parseOptionalInteger (parsedCoeff);
33
- if (result.has_value ()) {
34
- if (failed (*result)) {
35
- parser.emitError (parser.getCurrentLocation (),
36
- " invalid integer coefficient" );
37
- return failure ();
38
- }
39
- }
40
33
41
34
// Variable name
42
35
result = parser.parseOptionalKeyword (&variable);
@@ -118,13 +111,14 @@ Attribute PolynomialAttr::parse(AsmParser &parser, Type type) {
118
111
if (failed (parser.parseOptionalPlus ())) {
119
112
if (succeeded (parser.parseGreater ())) {
120
113
break ;
121
- } else {
122
- parser.emitError (
123
- parser.getCurrentLocation (),
124
- " expected + and more monomials, or > to end polynomial attribute" );
125
- return {};
126
114
}
127
- } else if (succeeded (parser.parseOptionalGreater ())) {
115
+ parser.emitError (
116
+ parser.getCurrentLocation (),
117
+ " expected + and more monomials, or > to end polynomial attribute" );
118
+ return {};
119
+ }
120
+
121
+ if (succeeded (parser.parseOptionalGreater ())) {
128
122
parser.emitError (
129
123
parser.getCurrentLocation (),
130
124
" expected another monomial after +, but found > ending attribute" );
@@ -175,8 +169,7 @@ Attribute RingAttr::parse(AsmParser &parser, Type type) {
175
169
IntegerType iType = llvm::dyn_cast<IntegerType>(typeAttr.getValue ());
176
170
if (!iType) {
177
171
parser.emitError (parser.getCurrentLocation (),
178
- " invalid coefficient modulus, coefficientType must "
179
- " specify an integer type" );
172
+ " coefficientType must specify an integer type" );
180
173
return {};
181
174
}
182
175
APInt coefficientModulus (iType.getWidth (), 0 );
0 commit comments