================
@@ -19,11 +19,37 @@
#include "CIRGenCleanup.h"
#include "CIRGenFunction.h"
+#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/CIR/MissingFeatures.h"
using namespace clang;
using namespace clang::CIRGen;
+namespace {
+/// Return true if the expression tree contains an AbstractConditionalOperator
+/// (ternary ?:), which is the only construct whose CIR codegen calls
+/// ConditionalEvaluation::beginEvaluation() and thus causes cleanups to be
+/// deferred via pushFullExprCleanup. Logical &&/|| do NOT call
+/// beginEvaluation(); their branch-local cleanups are handled by LexicalScope.
+class ConditionalEvaluationFinder
----------------
andykaylor wrote:
No, it doesn't. Is there a cheaper way to do this?
This is necessary in CIR because we need to create the cleanup scope before we
start emitting the expression (so that the expression can be emitted to the
cleanup scope body region) but I ran into problems in the case where there
ended up not being any actual conditional cleanups pushed within the scope. I'm
not sure that's still a problem now that I added the canonicalization for
cleanup scopes. I'll revisit this and see if I can create the cleanup scope
unconditionally.
https://github.com/llvm/llvm-project/pull/191479
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits