[PATCH] [analyzer] Refactor conditional expression evaluating code

Pavel Labath labath at google.com
Wed Aug 14 12:06:24 PDT 2013


EvaluateLogicalExpression is called only for the topmost logical operator.
I need the values to survive until then, so I mark them as live.

I marked the non-leaf expressions as live, because the destructor branch
can depend on any sub-expression, not just leaves. E.g. for an expression
like (a || b) && A(), the destructor for A will have (a || b) as a
terminator, but this value was never stored in the state before. Therefore,
I compute these values in EvaluateLogicalExpression and store them in the
state. I didn't try to figure out which values will be really needed, so I
just stored all of them (not really all, only those that were actually
computed on this path).

 Now that I think about it, I think it should be possible to just mark the
leaves -- the relevant non-leaf expressions should be marked as live when
we visit the corresponding terminator.

I am not sure which part are you having doubts about. Could you describe it
more verbosely?



On 14 August 2013 20:44, Jordan Rose <jordan_rose at apple.com> wrote:

>
>   I see that, but since you still need to record the explicit choice for
> each BinaryOperator in the state, why do you need the leaves?
>
>   (Sorry, I didn't remember that some leaves could be Unknown, which makes
> everything fall apart.)
>
> http://llvm-reviews.chandlerc.com/D1340
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130814/06fae181/attachment.html>


More information about the cfe-commits mailing list