Skip to content

Commit ce70d4b

Browse files
authored
[mlir][emitc] Refactor getEmittedExpression (NFC) (#168361)
This method returns the current expression being emitted, but is only used testing whether an expression is being emitted or not. This patch therefore replaces it with a boolean isEmittingExpression() method.
1 parent 1abb055 commit ce70d4b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mlir/lib/Target/Cpp/TranslateToCpp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ struct CppEmitter {
253253
return !fileId.empty() && file.getId() == fileId;
254254
}
255255

256-
/// Get expression currently being emitted.
257-
ExpressionOp getEmittedExpression() { return emittedExpression; }
256+
/// Is expression currently being emitted.
257+
bool isEmittingExpression() { return emittedExpression; }
258258

259259
/// Determine whether given value is part of the expression potentially being
260260
/// emitted.
@@ -1717,7 +1717,7 @@ LogicalResult CppEmitter::emitGlobalVariable(GlobalOp op) {
17171717

17181718
LogicalResult CppEmitter::emitAssignPrefix(Operation &op) {
17191719
// If op is being emitted as part of an expression, bail out.
1720-
if (getEmittedExpression())
1720+
if (isEmittingExpression())
17211721
return success();
17221722

17231723
switch (op.getNumResults()) {
@@ -1799,7 +1799,7 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
17991799
if (hasDeferredEmission(&op))
18001800
return success();
18011801

1802-
if (getEmittedExpression() ||
1802+
if (isEmittingExpression() ||
18031803
(isa<emitc::ExpressionOp>(op) &&
18041804
shouldBeInlined(cast<emitc::ExpressionOp>(op))))
18051805
return success();

0 commit comments

Comments
 (0)