[cfe-dev] Clang Static Analyzer: Checking absence of method definition

章磊 ioripolo at gmail.com
Tue Mar 8 19:20:42 PST 2011


Hi Vu LE,

You should add you checker in clang/lib/StaticAnalyzer/Checkers/Checkers.td,
and implement a function to register it as the error says.

2011/3/9 Vu Le <minhvule at gmail.com>

> Hi Ted,
> Thank you for your fast response.
>
> I add a new file UnhandledMemoryWarningChecker.cpp under Checker.
> Rebuilding Clang generates this error
> *UnhandledMemoryWarningChecker.cpp:59: error: ‘void
> clang::ento::registerUnhandledMemoryWarningChecker(clang::ento::CheckerManager&)’
> should have been declared inside ‘clang::ento’*
>
> I couldn't find the documentation for adding a new Checker.
> What are the steps to define a new checker?
>
> Thanks again.
> Vu
>
> On Mon, Mar 7, 2011 at 7:20 PM, Ted Kremenek <kremenek at apple.com> wrote:
>
>> Take a look at CheckObjCDealloc.cpp, which warns about incomplete -dealloc
>> implementations.  Diagnostics still need a source location, but they can
>> refer to the location of the @interface or @implementation (for example).
>>
>> On Mar 7, 2011, at 4:28 PM, Vu Le wrote:
>>
>> Hi all,
>>
>> I want to write a checker that checks whether a handler method,
>> for example "didReceiveMemoryWarning", has been implemented.
>>
>> Based on what I read from the source code, most checkers find
>> violations in a specific location. Is there a way to check
>> the absence of implementing handler?
>>
>> Thanks.
>> Vu Le
>>  _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>


-- 
Best regards!

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


More information about the cfe-dev mailing list