================
@@ -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
----------------
bcardosolopes wrote:

If this isn't needed then perfect, but this might be the right trade-off for 
CIR's structured model.

The concern about AST visitor overhead is valid but doesn't seem that expensive 
to me - the visitor short-circuits on first find and skips 
lambda/block/stmt-expr boundaries, so the cost should be negligible for most 
expressions? Any specific exploding example you have in mind?

https://github.com/llvm/llvm-project/pull/191479
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to