[cfe-commits] r57240 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp
Ted Kremenek
kremenek at apple.com
Tue Oct 7 09:49:19 PDT 2008
On Oct 7, 2008, at 3:06 AM, Zhongxing Xu wrote:
> if (!memcmp(s, "panic", 5)) Builder->BuildSinks = true;
> + else if (!memcmp(s, "error", 5)) {
> + Expr* Arg = *CE->arg_begin();
> + if (IntegerLiteral* IL = dyn_cast<IntegerLiteral>(Arg))
> + if (IL->getValue() != 0)
> + Builder->BuildSinks = true;
> + }
> break;
Hi Zhongxing,
I think this code will crash if error() isn't passed any arguments.
It should check to see if error() has the number of arguments that you
expect.
Also, is there a reason you check the AST node for an IntegerLiteral
instead of just consulting the value of 'CE' that is in the state?
You'll get far more accurate information by looking at the semantics
of the argument instead of its syntax.
For example, checking for an integer literal will miss the following
cases:
error(1 - 1);
error((1)); // note the '()'
x = 1;
error(x);
I think just doing GetRVal(St, CE) should do the trick.
Ted
More information about the cfe-commits
mailing list