[Mlir-commits] [mlir] [mlir][emitc] Don't emit extra semicolon after bracket (PR #122464)

Matthias Gehre llvmlistbot at llvm.org
Mon Jan 13 04:23:30 PST 2025


mgehre-amd wrote:

Thanks, this moves the code in the right direction!

I think we should eventually get rid of the `trailingSemicolon` parameter of the `emitOperation` function; I still find it confusion.
What might help if we eventually split this function into `emitStatement` and `emitExpression`.
Statements are terminated with a semicolon (except for special op types like `VerbatimOp), where expressions don't have that.
We can then replace all calls to `emitOperation(op, /*trailingSemicolon*/=true)` by `emitStatement(op)` and all calls to `emitExpression(op, /*trailingSemicolon*/=true)`.
`emitStatement` would contain the dispatch for all statement-ops like `IfOp`, `VerbatimOp` etc, and otherwise call `emitExpression()` followed by emitting a `semicolon`. `emitExpression` would contain the dispatch for all expression ops like `AddOp`, `TernaryOp` etc.
But this is for another PR.



https://github.com/llvm/llvm-project/pull/122464


More information about the Mlir-commits mailing list