[cfe-dev] Multiple root nodes for CallGraph?

Anna Zaks ganna at apple.com
Sun Oct 2 23:15:51 PDT 2011


Hi Arjun,

You could look at the Bugzilla enhancement requests and see if you can find something interesting. For example, here are several checker requests:

Bug 9510 - Warning for ctype.h misuse 
Bug 9544 - Static Analyzer should warn about usage of weak symbols without check
Bug 5067 - clang/C++: issue warning when iterators from different variables are compared

Keep in mind that the analyzer is currently limited to intra-procedural reasoning. (For example, some of the checks might have a high false positive rate due to that and should be avoided for now.) 

You can also send a proposal to the list with more details on what you want to check for.

Cheers,
Anna.
On Oct 1, 2011, at 8:50 AM, Arjun Singri wrote:

> Can you please give me some ideas for checkers to implement?
> 
> Thanks,
> Arjun
> 
> On Sat, Oct 1, 2011 at 12:13 AM, Anna Zaks <ganna at apple.com> wrote:
> Hi Arjun,
> 
> Currently, the clang static analyzer only performs intra-procedural analysis. I don't think that any other checkers in the analyzer use CallGraph, so you might need a bit of extra plumbing to construct one.
> 
> Also, I am not sure if the checker you are working on is going to be different from the compiler warning:
> 
> $ clang -Wall ~/tmp/example.c 
> /Users/zaks/tmp/example.c:5:12: warning: unused function 'xxx' [-Wunused-function]
> static int foo() {return 3;}
> 
> Cheers,
> Anna.
> On Sep 30, 2011, at 10:36 PM, Arjun Singri wrote:
> 
>> Hi,
>> 
>> Thank you for replying. I will keep that in mind when writing the checker. 
>> 
>> To use the CallGraph class I need to supply it an object of type "Program". The only way I can get a Program object is through the Indexer object which itself is obtained from AnalysisManager. But when the AnalysisManager object is constructed in Frontend/AnalysisConsumer.cpp:148, a value of zero is passed for the Indexer making the Indexer NULL. Why is this? Can I get a reference to the Program object any other way?
>> 
>> Thanks,
>> Arjun
>> 
>> On Fri, Sep 30, 2011 at 2:09 PM, Anna Zaks <ganna at apple.com> wrote:
>> Hi Arjun,
>> 
>> scan-build is a script that hijacks the build system to call the static analyzer. Currently, the analyzer can only reason about one translation unit at a time.
>> 
>> So there is no reason to have multiple roots to represent different main functions. In addition, your checker would/should only be applicable to functions with internal linkage.
>> 
>> Cheers,
>> Anna.
>> 
>> On Sep 30, 2011, at 12:58 PM, Arjun Singri wrote:
>> 
>> > Hi,
>> >
>> > I am currently trying to implement a checker that detects unused methods. I am making use of the CallGraph class for this. Every time CallGraph detects the "main" function, it designates it as the root node. Considering that scan-build accepts multiple files each having a main function, does it make sense to modify CallGraph to have mutlple root nodes?
>> >
>> > Thanks,
>> > Arjun
>> > _______________________________________________
>> > cfe-dev mailing list
>> > cfe-dev at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> 
>> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111002/a37e8820/attachment.html>


More information about the cfe-dev mailing list