Hi All,<div>I was going through Malloc checker in clang Static analyzer. I had a few doubts-</div><div><br></div><div>1) How is a symbol marked as dead( How does clang static analyzer detect that a symbol is dead) ?</div><div>
E.g.</div><div><br></div><div>char* myMalloc()</div><div>{</div><div>  char* p = (char*) malloc(sizeof(char));  </div><div>  return p;</div><div>}</div><div><br></div><div>int main()</div><div>{</div><div>  char* q = myMalloc();</div>
<div>  return 0;  </div><div>}</div><div><br></div><div>In the above example symbol assigned for p in myMalloc is alive till main(caller) exits right?</div><div><br></div><div><br></div><div>2) In case of IPA how are symbol propagated form one function to another in case it is passed as a parameter.</div>
<div>E.g.</div><div><br></div><div>void myFree(char* p)</div><div>{</div><div>   free(p);</div><div>}</div><div><br></div><div>int main()</div><div>{</div><div><br></div><div>  char* q = (char*) malloc(sizeof(char));</div>
<div>  myFree(q);</div><div>  free(q);</div><div>}</div><div><br></div><div>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?</div>
<div><br></div><div><br></div><div>Thanks</div><div>Karthik</div><div>  </div><div><br></div>