[cfe-dev] Missing ReturnStmt?

Zong zong_y365 at 163.com
Mon Feb 6 08:53:18 PST 2012


Hi Ted,
The dummy example just triggers a warning, I am afraid it shouldn't stop the analyzer, should it?

Best,
Z



At 2012-02-07 00:14:02,"Ted Kremenek" <kremenek at apple.com> wrote:
The analyzer stops analyzing a path when it hits a fail stop bug (because analyzing the rest of the path would be meaningless).  In this case, *c = b triggers a warning from the analyzer where 'c' is used uninitialized.


On Feb 6, 2012, at 1:55 AM, Zong <zong_y365 at 163.com> 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!

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/96cc9dea/attachment.html>


More information about the cfe-dev mailing list