<br><br><div class="gmail_quote">On Sat Nov 15 2014 at 1:41:51 PM Vanush Vaswani <<a href="mailto:vanush@gmail.com">vanush@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can you use this in the context of libTooling?<br></blockquote><div><br></div><div>Yep. Look at clang-tidy to see how you can hook up static analyzer checks to a clang tool (clang-tidy is written on top of libtooling).</div><div><br></div><div>The simples thing for now is probably make your check either a static analyzer check directly and use clang-tidy as a driver to run it, or implement a clang-tidy check (where you have access to the CFG, just like clang's diagnostics, but not to the path sensitive analysis).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Sat, Nov 15, 2014 at 4:58 AM, Ted Kremenek <<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>> wrote:<br>
> There's already an analysis, LiveVariables.cpp, that does this.  It works on<br>
> top of the CFG, and does a reverse dataflow analysis (using a worklist<br>
> algorithm) to compute liveness information for variables.  This liveness<br>
> information is currently consumed by the static analyzer to prune out<br>
> redundant information from the path state.<br>
><br>
> On Nov 14, 2014, at 9:21 AM, Madhur Amilkanthwar <<a href="mailto:madhur13490@gmail.com" target="_blank">madhur13490@gmail.com</a>><br>
> wrote:<br>
><br>
> So assume that I want to find all live variables at the end of the block.<br>
> Then how easy it is to do the job?<br>
><br>
> On Nov 14, 2014 2:25 PM, "Manuel Klimek" <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:<br>
>><br>
>> You basically have the static analyzer's CFG and Clang's AST. With the AST<br>
>> you can do limited data flow analysis (as long as you don't need path or<br>
>> control flow sensitivity), with the CFG you can do anything you want (at<br>
>> least in C) given enough computing power :P<br>
>><br>
>> AST access is well-integrated in libtooling, CFG access less so (I haven't<br>
>> written a tool that uses the CFG, but given that the CFG is used for Clang's<br>
>> diagnostics, I'd imagine it's not too hard to use from a libTooling based<br>
>> tool).<br>
>><br>
>> Looping in Anna & Jordan for more info on what's possible with the CFG /<br>
>> static analyzer.<br>
>><br>
>> Cheers,<br>
>> /Manuel<br>
>><br>
>> On Fri Nov 14 2014 at 6:56:10 AM Vanush Vaswani <<a href="mailto:vanush@gmail.com" target="_blank">vanush@gmail.com</a>> wrote:<br>
>>><br>
>>> What API's are available for Dataflow Analysis in Clang? I want to create<br>
>>> a<br>
>>> standalone tool (using libTooling) to analyse C source code.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> View this message in context:<br>
>>> <a href="http://clang-developers.42468.n3.nabble.com/Data-flow-analysis-in-Clang-tp4042447.html" target="_blank">http://clang-developers.42468.<u></u>n3.nabble.com/Data-flow-<u></u>analysis-in-Clang-tp4042447.<u></u>html</a><br>
>>> Sent from the Clang Developers mailing list archive at Nabble.com.<br>
>>> ______________________________<u></u>_________________<br>
>>> cfe-dev mailing list<br>
>>> <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
>><br>
>><br>
>> ______________________________<u></u>_________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
>><br>
> ______________________________<u></u>_________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
><br>
><br>
><br>
> ______________________________<u></u>_________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
><br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div>