On Mar 14, 2013, at 18:15 , Anna Zaks <[email protected]> wrote:

> +  // Peel off the ternary operator.
> +  if (const ConditionalOperator *CO = dyn_cast<ConditionalOperator>(S)) {
> +    ProgramStateRef State = N->getState();
> +    SVal CondVal = State->getSVal(CO->getCond(), N->getLocationContext());
> +    if (State->isNull(CondVal).isConstrainedTrue()) {
> +      S = CO->getTrueExpr();
> +    } else {
> +      assert(State->isNull(CondVal).isConstrainedFalse());
> +      S =  CO->getFalseExpr();
> +    }
> +  }

I'm not sure this is good enough; we don't know that the CO->getCond() is still 
live if the ternary operator is, say, inside of a cast (which would make the 
assertion fire). The "right" way to do this is to back up along the graph until 
we (a) get to the ternary operator node, or (b) get to the block edge that 
tells us which path was chosen.

Jordan
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to