Skip to content

Commit e2c8cc2

Browse files
committed
cleanup minor attribute suggestions
1 parent 115b17e commit e2c8cc2

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

mlir/lib/Dialect/Polynomial/IR/Polynomial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ unsigned Polynomial::getDegree() const {
9494
} // namespace polynomial
9595
} // namespace mlir
9696

97-
MLIR_DEFINE_EXPLICIT_TYPE_ID(mlir::polynomial::detail::PolynomialStorage);
97+
MLIR_DEFINE_EXPLICIT_TYPE_ID(mlir::polynomial::detail::PolynomialStorage)

mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@ ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
3030
llvm::StringRef &variable, bool *isConstantTerm) {
3131
APInt parsedCoeff(apintBitWidth, 1);
3232
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-
}
4033

4134
// Variable name
4235
result = parser.parseOptionalKeyword(&variable);
@@ -118,13 +111,14 @@ Attribute PolynomialAttr::parse(AsmParser &parser, Type type) {
118111
if (failed(parser.parseOptionalPlus())) {
119112
if (succeeded(parser.parseGreater())) {
120113
break;
121-
} else {
122-
parser.emitError(
123-
parser.getCurrentLocation(),
124-
"expected + and more monomials, or > to end polynomial attribute");
125-
return {};
126114
}
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())) {
128122
parser.emitError(
129123
parser.getCurrentLocation(),
130124
"expected another monomial after +, but found > ending attribute");
@@ -175,8 +169,7 @@ Attribute RingAttr::parse(AsmParser &parser, Type type) {
175169
IntegerType iType = llvm::dyn_cast<IntegerType>(typeAttr.getValue());
176170
if (!iType) {
177171
parser.emitError(parser.getCurrentLocation(),
178-
"invalid coefficient modulus, coefficientType must "
179-
"specify an integer type");
172+
"coefficientType must specify an integer type");
180173
return {};
181174
}
182175
APInt coefficientModulus(iType.getWidth(), 0);

0 commit comments

Comments
 (0)