[cfe-dev] Static Analyzer : Query regarding how symbols are marked as dead

Karthik Bhat blitz.opensource at gmail.com
Mon Mar 11 01:09:14 PDT 2013


Hi All,
I was going through Malloc checker in clang Static analyzer. I had a few
doubts-

1) How is a symbol marked as dead( How does clang static analyzer detect
that a symbol is dead) ?
E.g.

char* myMalloc()
{
  char* p = (char*) malloc(sizeof(char));
  return p;
}

int main()
{
  char* q = myMalloc();
  return 0;
}

In the above example symbol assigned for p in myMalloc is alive till
main(caller) exits right?


2) In case of IPA how are symbol propagated form one function to another in
case it is passed as a parameter.
E.g.

void myFree(char* p)
{
   free(p);
}

int main()
{

  char* q = (char*) malloc(sizeof(char));
  myFree(q);
  free(q);
}

In the above example is it true that the parameter p in myFree is assigned
the same symbol as that of q being passed to the function? If yes could
someone guide me were this assignment of symbol happens?


Thanks
Karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130311/58f0d4c4/attachment.html>


More information about the cfe-dev mailing list