[Mlir-commits] [mlir] [mlir][emitc] Refactor getEmittedExpression (NFC) (PR #168361)
Gil Rapaport
llvmlistbot at llvm.org
Mon Nov 24 00:49:35 PST 2025
https://github.com/aniragil updated https://github.com/llvm/llvm-project/pull/168361
>From cb8fef4eb7b8bd6c41653ca122b87c641a6f5068 Mon Sep 17 00:00:00 2001
From: Gil Rapaport <gil.rapaport at mobileye.com>
Date: Mon, 17 Nov 2025 12:45:17 +0200
Subject: [PATCH] [mlir][emitc] Refactor getEmittedExpression (NFC)
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.
---
mlir/lib/Target/Cpp/TranslateToCpp.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index 56f81b0bea9e2..bcce0a5145221 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -253,8 +253,8 @@ struct CppEmitter {
return !fileId.empty() && file.getId() == fileId;
}
- /// Get expression currently being emitted.
- ExpressionOp getEmittedExpression() { return emittedExpression; }
+ /// Is expression currently being emitted.
+ bool isEmittingExpression() { return emittedExpression; }
/// Determine whether given value is part of the expression potentially being
/// emitted.
@@ -1717,7 +1717,7 @@ LogicalResult CppEmitter::emitGlobalVariable(GlobalOp op) {
LogicalResult CppEmitter::emitAssignPrefix(Operation &op) {
// If op is being emitted as part of an expression, bail out.
- if (getEmittedExpression())
+ if (isEmittingExpression())
return success();
switch (op.getNumResults()) {
@@ -1799,7 +1799,7 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
if (hasDeferredEmission(&op))
return success();
- if (getEmittedExpression() ||
+ if (isEmittingExpression() ||
(isa<emitc::ExpressionOp>(op) &&
shouldBeInlined(cast<emitc::ExpressionOp>(op))))
return success();
More information about the Mlir-commits
mailing list