<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi, Gabor. Objects that live on the stack don't have symbols; the properties of a stack object's region is entirely known and doesn't need to be symbolic. It's a VarRegion, not a SymbolicRegion.</div><div><br></div><div>The good news is that regions are also uniqued, and so if you're just looking to identify an object, using the region as the key is often reasonable as well, possibly with a call to stripCasts().</div><div><br></div><div>Additionally, symbol death is not <i>quite</i> the same as local variable death. If the value of a local variable is symbolic, and that value gets copied somewhere else, the symbol won't die when the local variable does. (Symbol information is basically garbage collected—each cleanup starts by crawling through all the live regions and values to see what's still accessible.) Local variables have very well-defined scope rules, so all of their control is in the CFG.</div><div><br></div><div>Rather than using the 'this' region and checkEndFunction, why not use checkPostCall and CXXDestructorCall's getCXXThisVal? (What are you actually trying to do?)</div><div><br></div><div>Jordan</div><div><br></div><br><div><div>On Jul 13, 2013, at 10:30 , Gábor Kozár <<a href="mailto:kozargabor@gmail.com">kozargabor@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>Hi,<br><br><br></div><div>I'm using the Clang Static Analyzer from Clang 3.3. I want to check object's state when they die. I tried using checkDeadSymbols, but according to the SymbolReaper, the objects of interest never die. This is my test code:<br>
<br></div><div>struct Foo<br>{<br></div><div> int* x;<br></div><div> Foo() { x = new int(10); }<br></div><div>};<br><br></div><div>int main(int argc, const char** argv)<br>{<br></div><div> Foo f;<br></div><div>
return 0;<br></div><div>}<br><br></div><div>The int* does die, but f does not. (I cannot check this directly: I just made the SymbolReaper print all symbols are regions that died, using the dead_begin(), etc. and region_begin() etc. methods). Why is this, and how can I work around it?<br>
<br></div><div>Even when there is a user-made destructor, which I can get using checkEndFunction, I'm unable to get back the symbol that represents 'f'. I spent like an hour digging through clang::ento's reference, and this was my best tip:<br>
<br>const CXXThisRegion* thisRegion = context.getStoreManager().getRegionManager().getCXXThisRegion(<br> dtor->getThisType(context.getASTContext()),<br> context.getLocationContext());<br><br></div>
<div>Unfortunately, this gives something that doesn't seem to have anything to do with 'f'. How can I get the symbol representing 'f', using only the CheckerContext and the const CXXDestructorDecl* I can obtain from the LocationContext?<br>
<br></div><div>I'm really stuck, and any help would be greatly appreciated. Thank you!<br><br>Gabor<br></div></div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>