[cfe-dev] Several questions about UncheckedReturn statistic Checker

章磊 ioripolo at gmail.com
Mon Dec 6 17:59:00 PST 2010


Hi clang,

I'm trying to find out how to implement this statistic checker. IMO, there
could be several steps.

   1. Add a ConjuredSymbol to all the CallExpr in PostVisitCallExpr, set the
   state to Unchecked.
   2. In VisitBranchCondition, if a callexpr is checked, set the state to
   checked.
   3. After all the decl was analyzed, do the first part(in a
   translationunit) of statistic count (and/or check) in
   AnalysisConsumer::HandleTranslationUnit.
   4. Implement a script to do the whole project's statistic check.

This patch try to do the first two steps.

I register the checker in RegisterExperimentalChecks, but a new action seems
more appropriate. Statistic checkers are some different from the checkers in
RegisterExperimentalChecks.

In order to generate ExplodedNode but not a blockedge, i add a new
"generateNode" function in GRBranchNodeBuilder. I think this function is not
quite right. I use poststmt as the ProgramPoint, maybe we need a new
ProgramPoint here?

Beacause this is a really experimental checker and not all the steps are
finished, i can't give a testcase to show what i did.

More comments inline.

-- 
Best regards!

Lei Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101207/0d5454df/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UncheckedReturn.patch
Type: text/x-patch
Size: 10067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101207/0d5454df/attachment.bin>


More information about the cfe-dev mailing list