[cfe-dev] Missing ReturnStmt?
Anna Zaks
ganna at apple.com
Mon Feb 6 09:41:54 PST 2012
On Feb 6, 2012, at 1:55 AM, Zong wrote:
> Dear All,
>
> I have a very simple clang analyzer checker code snippet like below,
>
> --------------------------------------------------
> using namespace clang;
> using namespace ento;
>
> namespace {
> class myChecker: public Checker< check::PreStmt<Stmt> > {
> public:
> void checkPreStmt(const Stmt *S, CheckerContext &Ctx) const ;
>
> };
> }
>
> void myChecker::checkPreStmt(const Stmt *S, CheckerContext &Ctx) const {
> S->dumpAll();
> }
> --------------------------------------------------
>
> This analyzer was then fed with the test code:
>
> int main()
> {
> int *b;
> int *c;
> *c=b;
> return 0;
> }
>
> Why can't I observe a "ReturnStmt"?
> If I change "*c=b" with something other (e.g., b=c), then "ReturnStmt" appears. I just can! 't figure out the reason. Would someone please help me ? Thanks!
>
What is the command line you use to execute this?
Could it be because '*c=b' causes "Dereference of undefined pointer value" error (in another checker)? Most analyzer errors are defined as sinks - it means that we stop analyzing the path after such error is caught. (This example also produces a compiler warning - you are casting 'int *' to 'int'.)
Anna.
> Best,
> Z
>
>
> _______________________________________________
> 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/20120206/d7150c8f/attachment.html>
More information about the cfe-dev
mailing list