[cfe-commits] [PATCH] VisitInitListExpr

Ted Kremenek kremenek at apple.com
Wed Oct 29 21:11:59 PDT 2008


On Oct 29, 2008, at 8:58 PM, Zhongxing Xu wrote:

> <Not certain if we need E->IngoreParens()->getInit().
>
> Perhaps. We'd better have a consistent Parenthesis handle scheme.  
> The current one looks ad hoc (or I haven't get it from the code?).

I realized that it's actually not needed.   Visit() just ignores  
ParenExprs and visits the subexpression, and GetSVal also ignores  
ParenExprs and looks at their children.

> +
> +  if (Loc::IsLocType(T) || T->isIntegerType()) {
> +    // FIXME: to be implemented.
> +    MakeNode(Dst, E, Pred, state);
> +    return;
> +  }
>
> Is this possible?  Can InitListExpr have one of these types?
>
> There is one example in test/Analysis/stack-addr-ps.c. In the last  
> function.

Right!  It seems to me that in this case the InitListExpr will contain  
only 1 scalar value, and we should just return the SVal for that.  So  
something like this:

if (Loc::isLocType(T) || T->isIntegerType()) {
   assert (E->getNumInits() == 1);
   NodeSet Tmp;
   Expr* Init = E->getInit(0);
   Visit(Tmp, Init, Pred, state);
   for (NodeSet::iterator I=Tmp.begin(), EI=Tmp.end(); I!+EI; ++I)
    MakeNode(Dst, E, *I, SetSVal(state, Ex, GetSVal(state, Init)));
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20081029/6829ff6a/attachment.html>


More information about the cfe-commits mailing list