[cfe-dev] How can I get the analysis information of UnaryOperator in Clang Static Analyzer

Jordan Rose jordan_rose at apple.com
Fri Sep 27 18:00:12 PDT 2013


Fixed in r191532.

Jordan


On Sep 24, 2013, at 9:37 , Jordan Rose <jordan_rose at apple.com> wrote:

> Hi, Arthur. Looks like we're forgetting in Core to give checkers a chance for some of the unary operators. I'll see if I can get to that soon; alternately, patches welcome!
> 
> Jordan
> 
> 
> On Sep 24, 2013, at 1:15 , Arthur Yoo <phjy007 at gmail.com> wrote:
> 
>> Hi all,
>> 
>> It seems that the Clang Static Analyzer may miss the analysis information of UnaryOperator. For example:
>> 
>> void func(int s) {
>> 
>>     s++;
>> 
>>     ++s;
>> 
>> }
>> 
>> The example may be quite ridiculous…
>> 
>> My checker contains a method: void checkPostStmt(const Stmt *DS, CheckerContext &C).
>> 
>> I thought that it can capture any kind of Stmt.  Since UnaryOperator is a subclass of Expr and Expr is a subclass of Stmt, I thought my checker can give me the analysis information of "s++" and "++s". However, it returned nothing. 
>> 
>> What' more, I have tried to add another checkPostStmt() method in my checker. The declaration
>> 
>> of this method is void checkPostStmt(const UnaryOperator *Op, CheckerContext &C). The result is same with the previous one, it returned nothing.
>> 
>> In fact, I want to use Clang Static Analyzer to capture all kinds of UnaryOperator, including 's++/++s/s--/--'(IncrementOp/DecrementOp). *p(pointer dereference) and so on. So how can I get the analysis information of UnaryOperator in Clang Static Analyzer?
>> 
>> Thanks a lot.
>> 
>> 
>> 
>> -- 
>> Best regards,
>> Arthur Yoo
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130927/5ca24944/attachment.html>


More information about the cfe-dev mailing list