<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Hi,<br></div>
<div> </div>
<div>checkASTDecl is probably not what you want, because it is not meant to be used for data-flow analysis (and that's why it doesn't give you a CheckerContext). checkEndOfTranslationUnit is similar.<br></div>
<div> </div>
<div>Probably what's best for you is checkPreCall. CallEvent and its derived classes (you'll probably want to look at these in the header file directly, because the generated doxygen documentation doesn't contain several classes that are clearly meant to be exposed to the user) contains all the information you'll ever want about the call.<br></div>
<div> </div>
<div>The only catch is that I do not know if checkPreCall is called at the beginning of the analysis - i.e. when the analyzer begins analyzing the program. This should be fairly simple to check though.<br></div>
<div>Unless configured otherwise, Clang SA will start an analysis at every simple function in every TU (as far as I know) - it doesn't look for main(), partly because it can't do inter-TU analysis yet -- and that would also be useless for e.g. libraries, or functions that are only ever called through indirection...<br></div>
<div> </div>
<div>Another thought: for efficiency reasons, you'll probably want to delay initializing as long as possible. I mean, there's no point in setting up state for a function parameter if it's never used (on a particular code path), right? So my approach would be to only start assigning information when there's actually something you need to store.<br></div>
<div> </div>
<div>Similarly, you can use checkPostCall for clean-up, but you should also consider using checkDeadSymbols to aggressively free up resources (e.g. state associated with the dead values).<br></div>
<div> </div>
<div>Hope this helps, and good luck!<br></div>
<div> </div>
<div><div>-- <br></div>
<div>  Gábor Kozár<br></div>
<div>  kozargabor@fastmail.fm<br></div>
<div> </div>
</div>
<div> </div>
<div> </div>
<div>On Tue, Sep 3, 2013, at 21:13, Aemon Cannon wrote:<br></div>
<blockquote type="cite"><div dir="ltr"><span class="font" style="font-family:arial, sans-serif"><span class="size" style="font-size:13px">I'm working on my first Clang checker, and I would would like to setup initial state for the symbols referred to by a function's parameters. This is an</span></span><i style="font-family:arial,sans-serif;font-size:13px"></i><span class="font" style="font-family:arial, sans-serif"><span class="size" style="font-size:13px">intraprodedural analysis, and I want a clean slate for the analysis of each function body, with some initial conditions determined by annotations in the comments.</span></span><div style="font-family:arial,sans-serif;font-size:13px"> </div>
<div style="font-family:arial,sans-serif;font-size:13px">I'm not sure which Checker callback is appropriate for this. checkASTDecl<FunctionDecl> seems promising, but I don't get a CheckerContext in that callback.<br></div>
<div style="font-family:arial,sans-serif;font-size:13px"> </div>
<div style="font-family:arial,sans-serif;font-size:13px">Any thoughts?<br></div>
<div style="font-family:arial,sans-serif;font-size:13px"> </div>
<div style="font-family:arial,sans-serif;font-size:13px">

Thanks,<br></div>
<div style="font-family:arial,sans-serif;font-size:13px">Aemon<br></div>
</div>
<div><u>_______________________________________________</u><br></div>
<div>cfe-dev mailing list<br></div>
<div><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br></div>
<div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></div>
</blockquote></body>
</html>