================ @@ -642,12 +798,97 @@ class CIRGenFunction : public CIRGenTypeCache { void emitNullabilityCheck(LValue lhs, mlir::Value rhs, clang::SourceLocation loc); + /// An object to manage conditionally-evaluated expressions. + class ConditionalEvaluation { + mlir::OpBuilder::InsertPoint insertPt; + + public: + ConditionalEvaluation(CIRGenFunction &cgf) + : insertPt(cgf.builder.saveInsertionPoint()) {} + ConditionalEvaluation(mlir::OpBuilder::InsertPoint ip) : insertPt(ip) {} + + void begin(CIRGenFunction &cgf) { ---------------- andykaylor wrote:
If we saved a reference to `cgf` in the constructor, we wouldn't need to pass it to `begin()` and `end()` https://github.com/llvm/llvm-project/pull/138156 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits