================
@@ -1306,19 +1306,35 @@ class ScalarExprEmitter : public
StmtVisitor<ScalarExprEmitter, mlir::Value> {
CIRGenFunction::ConditionalEvaluation eval(cgf);
mlir::Value lhsCondV = cgf.evaluateExprAsBool(e->getLHS());
+ bool hasCleanupScopeParent =
+ mlir::isa<cir::CleanupScopeOp>(builder.getBlock()->getParentOp());
+
auto resOp = cir::TernaryOp::create(
builder, loc, lhsCondV, /*trueBuilder=*/
[&](mlir::OpBuilder &b, mlir::Location loc) {
CIRGenFunction::LexicalScope lexScope{cgf, loc,
b.getInsertionBlock()};
cgf.curLexScope->setAsTernary();
+
+ mlir::Value cleanupScopeTmpAlloca;
+ if (hasCleanupScopeParent) {
+ cleanupScopeTmpAlloca = builder.createAlloca(
+ loc, builder.getPointerTo(builder.getBoolTy()),
+ builder.getBoolTy(), "cleanup.scope.tmp",
+ clang::CharUnits::One());
+ }
+
mlir::Value res = cgf.evaluateExprAsBool(e->getRHS());
+
+ if (hasCleanupScopeParent)
----------------
AmrDeveloper wrote:
I realized that requiresCleanups is not implemented yet, I will add it
Thanks
https://github.com/llvm/llvm-project/pull/183143
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits