[cfe-dev] C++ analysis with Clang?
Jim Goodnow II
Jim at TheGoodnows.net
Mon Jun 4 16:06:04 PDT 2012
On 6/4/2012 2:57 PM, Anna Zaks wrote:
> On Jun 1, 2012, at 6:36 PM, Karl Mazurak wrote:
>> Hi all -
>> Our group is considering using Clang for some program analysis,
>> primarily aimed at bug-hunting. We're targeting C++, which I understand
>> means the static analyzer isn't an option just yet,
>> but it looks like
>> there's still plenty there that could be useful - so much that I'm not
>> sure what to start experimenting with.
>> The plugin tutorial uses a PluginASTAction and links to an example with
>> a RecursiveASTVisitor, but of course we'd like to avoid reinventing the
>> wheel (at coding time or at run time) as much as possible. For
>> instance, are CFGs pre-constructed somewhere?
> CFG is part of Analyzes library and is used by both clang and the
> You can use ViewCFG and DumpCFG checkers to see how C++ statements are
> modeled (and what the deficiencies are):
> *clang -cc1 -analyze -analyzer-checker=debug.ViewCFG test.c*
>> Does the dataflow
>> framework in Analysis/FlowSensitive work with C++?
> The analyzer's C++ support is work in progress. You can run the
> analyzer's path sensitive checkers on C++ code, however, it does not
> reason about many C++ concepts.
Actually, except for some of the new c++11 concepts like lambdas, most
are currently handled and the analyzer can already be very useful for
>> Is this Sema of any
>> use outside the path-sensitive analyzer?
> You can write a non-path-sensitive checkers, which visit different AST
> nodes (AST does have full C++ support). See AST Visitors in
>> And is there anything in Clang
>> that could be useful in aggregating results together in whole program
> The static analyzer does not currently support whole program analysis.
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu <mailto:cfe-dev at cs.uiuc.edu>
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev