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

Arthur Yoo phjy007 at gmail.com
Tue Sep 24 01:15:27 PDT 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130924/e5ddf4fc/attachment.html>


More information about the cfe-dev mailing list