================
@@ -518,6 +518,164 @@ class CIRLoopOpInterfaceFlattening
exit);
}
+ // Return the cleanup-kind attribute or a null attribute if the loop has no
+ // cleanups.
+ static cir::CleanupKindAttr getLoopCleanupKind(cir::LoopOpInterface op) {
----------------
andykaylor wrote:
> Ah, right, it takes expression there.... what about with a statement
> expression?
>
> ```
> do { }
> while(({S s{}; (bool)s;} ));
> ```
>
> See here: https://godbolt.org/z/4eraGfxW6
>
> That seems to match what I was talking about?
I think that's basically the same as the temporary case. I don't think we could
force it into the condition-cleanup pattern even if we wanted to. That will
become more apparent in my next PR when you see how I place the codegen for the
variable cleanup. In order to handle the weird case we talked about before
where a while condition contains a statement expression which itself contains a
while loop, I had to strictly limit the cleanup capture in the condition to the
condition variable itself. In the case of a do..while loop all we get from the
AST is the condition expression. We don't want all cleanups in that expression
going to the loop cleanup region, so we can't capture any of them.
https://github.com/llvm/llvm-project/pull/210472
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits