<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 16, 2015, at 8:00 AM, Alexander Droste <<a href="mailto:alexander.ra.droste@googlemail.com" class="">alexander.ra.droste@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Hi everyone,<br class=""><br class="">I'm trying to track a stack variable using the static analyzer<br class="">by getting a symbol from function args.<br class=""><br class="">In checkPostCall I do:<br class=""><br class="">if (callEvent.getCalleeIdentifier() == IdentInfoTrackMem) {<br class="">    // ...<br class="">    auto s = callEvent.getArgSVal(0).getAsSymbol();<br class="">    if (s == nullptr) {<br class="">        std::cout << "nullptr" << std::endl;<br class="">    }<br class="">}<br class=""><br class="">// this is function used to track the var<br class="">void trackMem(int *i) {<br class="">    *i = 0;<br class="">    printf("%i\n", *i);<br class="">}<br class=""><br class=""><br class="">The strange thing is that it workes fine when the variable passed to<br class="">trackMem is previously allocated with malloc. But when passing<br class="">a pointer to a stack variable to trackMem callEvent.getArgSVal(0).getAsSymbol() always evaluates to nullptr.<br class=""></div></blockquote><div><br class=""></div><div>The address of a stack variable is not a symbol. Take a look at this section of the Checker Developer Manual and examine the SVal that represents the 0-th argument.</div><div><br class=""></div><a href="http://clang-analyzer.llvm.org/checker_dev_manual.html#values" class="">http://clang-analyzer.llvm.org/checker_dev_manual.html#values</a></div><div><br class=""><blockquote type="cite" class=""><div class=""><br class="">_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@cs.uiuc.edu" class="">cfe-dev@cs.uiuc.edu</a><br class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br class=""></div></blockquote></div><br class=""></body></html>