<div dir="ltr"><div style="font-size:12.8px">Hi,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I'm currently trying to implement a clang analyzer check</div><div style="font-size:12.8px">to detect dangling pointers to a local (that went out of scope), like in:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>void pointer_leaves_scope(bool bb) {<br></div><div>    int* p;</div><div>    {<br></div><div>        int i = 0;</div><div>        p = &i;</div><div>    } // need to get a callback here</div><div>    *p = 1; // should produce warning: i went out-of-scope</div><div>}</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I first though that <span style="font-size:12.8px">checkDeadSymbols(..)</span><span style="font-size:12.8px"> will be called when i goes out of scope,</span></div><div style="font-size:12.8px"><span style="font-size:12.8px">but it does not. Seems that I don't understand what </span><span style="font-size:12.8px">checkDeadSymbols is supposed to do.</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">I </span><span style="font-size:12.8px">also</span><span style="font-size:12.8px"> </span><span style="font-size:12.8px">tried checkPostStmt(</span><span style="font-size:12.8px">CompoundStmt*,..), </span><span style="font-size:12.8px">but that is not called either.</span></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Now I'm looking how to implement this callback (could be named <span style="font-size:12.8px">checkSymbolLeavesScope).</span></div><div style="font-size:12.8px"><span style="font-size:12.8px">Or something like </span><span style="font-size:12.8px">checkEndFunction() </span><span style="font-size:12.8px">but for all local scopes.</span></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Could anyone please give me some hints where to add this to the analyzer core?</div><div style="font-size:12.8px">I'm I missing something obvious?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Matthias</div></div>