[cfe-dev] clang static analyzer checker dev - function argument processing
Jordan Rose
jordan_rose at apple.com
Fri Jan 3 09:00:16 PST 2014
Hi, Dave. getArgExpr() is indeed what you want if you're trying to determine how a particular argument is spelled. This gives you back the Expr that represents the argument, which in this case will be a BinaryOperator containing two DeclRefExprs. However, it seems unlikely that that's what you really want to do:
FundFlags flags = FlagA | FlagB;
fund(..., flags, ...);
fund(..., FlagA | (condition ? FlagB : 0), ...);
All of these seem like useful cases that nonetheless are syntactically very different from what you started with.
The analyzer doesn't preserve how constant values are constructed so that it can treat (A | B) and (B | A), for example, as the same path. What are you actually trying to check for?
Jordan
On Jan 1, 2014, at 11:01 , Dave Tian <dave.jing.tian at gmail.com> wrote:
> Hi there,
>
> I am looking for help on checker development for clang static analyzer.
> Say there is a function with an argument to be an (int mode), which supports the flag OR settings, like ‘FlagA | Flag B’. Then this function could be called in this way - fund(…., FlagA | FlagB, ….). My general question is that is there a way to extract the raw expression (FlagA | Flag B) of this argument in this function in the CallEvent? I need to examine the raw value of the flags instead of the symbolic value. It looks like Call.getArgExpr() may help but I am not sure how to do that. Would you give some hints on this?
>
> Thanks,
> Dave Tian
> dave.jing.tian at gmail.com
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list