[clang] [CIR] Upstream support for emitting ignored statements (PR #130869)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 10:21:30 PDT 2025
================
@@ -55,10 +55,154 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s,
if (mlir::succeeded(emitSimpleStmt(s, useCurrentScope)))
return mlir::success();
- // Only a subset of simple statements are supported at the moment. When more
- // kinds of statements are supported, a
- // switch (s->getStmtClass()) {
- // will be added here.
+ switch (s->getStmtClass()) {
+
+#define STMT(Type, Base)
+#define ABSTRACT_STMT(Op)
+#define EXPR(Type, Base) case Stmt::Type##Class:
+#include "clang/AST/StmtNodes.inc"
+ {
+ // Remember the block we came in on.
+ mlir::Block *incoming = builder.getInsertionBlock();
+ assert(incoming && "expression emission must have an insertion point");
+
+ emitIgnoredExpr(cast<Expr>(s));
----------------
erichkeane wrote:
OH, wait, I see it now. The point is that this is an expression that _IS_ ignored, meaning we're not doing anything with the result. So this is appropriate for any expression where its return value/result/etc isn't dealt with.
https://github.com/llvm/llvm-project/pull/130869
More information about the cfe-commits
mailing list