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

Michael Han Michael.Han at autodesk.com
Wed Mar 9 00:24:01 PST 2011


You can also have a look at r125503 and r125636, where the new checker registration mechanism is introduced which can serve as samples on how to add or modify checkers.

Michael.

From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of ??
Sent: Wednesday, March 09, 2011 11:21 AM
To: Vu Le
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] Clang Static Analyzer: Checking absence of method definition

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<mailto: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<mailto: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<mailto: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<mailto: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/b0246f2f/attachment.html>


More information about the cfe-dev mailing list