[clang] [CIR] Upstream CastOp and scalar conversions (PR #130690)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 11 13:16:06 PDT 2025


================
@@ -36,6 +36,18 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
                     bool ira = false)
       : cgf(cgf), builder(builder), ignoreResultAssign(ira) {}
 
+  //===--------------------------------------------------------------------===//
+  //                               Utilities
+  //===--------------------------------------------------------------------===//
+
+  bool TestAndClearIgnoreResultAssign() {
----------------
andykaylor wrote:

So, maybe replace calls to this with `std::exchange(ignoreResultAssign, false)`? That's just as long, but maybe a bit clearer.

I notice there are several places (in the incubator and the classic codegen) that call this function and then don't use the result. I'm not sure why they're doing that rather than just `ignoreResultAssign = false;`.

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


More information about the cfe-commits mailing list