================
@@ -918,6 +912,35 @@ LValue CIRGenFunction::emitLValue(const Expr *e) {
case Expr::CXXOperatorCallExprClass:
case Expr::UserDefinedLiteralClass:
return emitCallExprLValue(cast<CallExpr>(e));
+ case Expr::ExprWithCleanupsClass: {
+ const auto *cleanups = cast<ExprWithCleanups>(e);
+ LValue lv;
+
+ mlir::Location scopeLoc = getLoc(e->getSourceRange());
+ [[maybe_unused]] auto scope = cir::ScopeOp::create(
+ builder, scopeLoc, /*scopeBuilder=*/
+ [&](mlir::OpBuilder &b, mlir::Location loc) {
+ CIRGenFunction::LexicalScope lexScope{*this, loc,
+ builder.getInsertionBlock()};
+
+ lv = emitLValue(cleanups->getSubExpr());
+ if (lv.isSimple()) {
+ // Defend against branches out of gnu statement expressions
+ // surrounded by cleanups.
+ Address addr = lv.getAddress();
+ mlir::Value v = addr.getPointer();
+ assert(!cir::MissingFeatures::addressIsKnownNonNull());
+ assert(!cir::MissingFeatures::opTBAA());
+ assert(!cir::MissingFeatures::objCGC());
+ lv = LValue::makeAddr(addr.withPointer(v), lv.getType(),
+ lv.getBaseInfo());
+ }
----------------
erichkeane wrote:
Can we explain the 'else' here? It is odd to me that 'simple' is the only
thing that would require work.
https://github.com/llvm/llvm-project/pull/167938
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits