[cfe-dev] Proposal for statistic UncheckedReturnValue checker

章磊 ioripolo at gmail.com
Sun Oct 24 19:37:07 PDT 2010


Hi clang,

Now in UncheckedReturnValue checker we check whether some functions drop
privileges successfully. It's the most critical case of
UncheckedReturnValue. But it seems that UncheckedReturnValue checker should
check many other cases. For example, the return values of "malloc",
"pthread_mutex_lock".

And there may be another aspect that UncheckedReturnValue checker should
check. In user defined function, there are some that their return value
should always be checked, but we can't figure out whether a return value
should be checked without user specification. So here is a proposal for
statistic UncheckedReturnValue checker: when most(e.g. 85%) return values of
a function are checked, this checker flags the unchecked return values as
defects.

For the second part, IMO we may need some thing like a simple symbol table
to store how may return values of a function are checked and also the
reference loc(is there any structure i can use, or i should store this in
GDM? ). And then do the check and bug report in VisitEndAnalysis.

How does these sounds?

-- 
Best regards!

Lei Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101025/e99afc18/attachment.html>


More information about the cfe-dev mailing list