Skip to content

Commit b86febc

Browse files
committed
pass mutated bools by reference
1 parent c448711 commit b86febc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ void PolynomialAttr::print(AsmPrinter &p) const {
2828
/// variable name. Sets shouldParseMore to true if the monomial is followed by
2929
/// a '+'.
3030
ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
31-
llvm::StringRef &variable, bool *isConstantTerm,
32-
bool *shouldParseMore) {
31+
llvm::StringRef &variable, bool &isConstantTerm,
32+
bool &shouldParseMore) {
3333
APInt parsedCoeff(apintBitWidth, 1);
3434
auto parsedCoeffResult = parser.parseOptionalInteger(parsedCoeff);
3535
monomial.coefficient = parsedCoeff;
3636

37-
*isConstantTerm = false;
38-
*shouldParseMore = false;
37+
isConstantTerm = false;
38+
shouldParseMore = false;
3939

4040
// A + indicates it's a constant term with more to go, as in `1 + x`.
4141
if (succeeded(parser.parseOptionalPlus())) {
@@ -45,8 +45,8 @@ ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
4545
return failure();
4646
}
4747
monomial.exponent = APInt(apintBitWidth, 0);
48-
*isConstantTerm = true;
49-
*shouldParseMore = true;
48+
isConstantTerm = true;
49+
shouldParseMore = true;
5050
return success();
5151
}
5252

@@ -59,7 +59,7 @@ ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
5959
}
6060

6161
monomial.exponent = APInt(apintBitWidth, 0);
62-
*isConstantTerm = true;
62+
isConstantTerm = true;
6363
return success();
6464
}
6565

@@ -86,7 +86,7 @@ ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
8686
}
8787

8888
if (succeeded(parser.parseOptionalPlus())) {
89-
*shouldParseMore = true;
89+
shouldParseMore = true;
9090
}
9191
return success();
9292
}
@@ -105,7 +105,7 @@ Attribute PolynomialAttr::parse(AsmParser &parser, Type type) {
105105
bool isConstantTerm;
106106
bool shouldParseMore;
107107
if (failed(parseMonomial(parser, parsedMonomial, parsedVariableRef,
108-
&isConstantTerm, &shouldParseMore))) {
108+
isConstantTerm, shouldParseMore))) {
109109
parser.emitError(parser.getCurrentLocation(), "expected a monomial");
110110
return {};
111111
}

0 commit comments

Comments
 (0)