[cfe-commits] r131614 - in /cfe/trunk: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp test/Analysis/misc-ps.m
Ted Kremenek
kremenek at apple.com
Wed May 18 17:56:54 PDT 2011
Author: kremenek
Date: Wed May 18 19:56:53 2011
New Revision: 131614
URL: http://llvm.org/viewvc/llvm-project?rev=131614&view=rev
Log:
Teach static analyzer to analyze Objective-C methods in category implementations.
Modified:
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
cfe/trunk/test/Analysis/misc-ps.m
Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=131614&r1=131613&r2=131614&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Wed May 18 19:56:53 2011
@@ -200,18 +200,20 @@
}
break;
}
-
+
+ case Decl::ObjCCategoryImpl:
case Decl::ObjCImplementation: {
- ObjCImplementationDecl* ID = cast<ObjCImplementationDecl>(*I);
+ ObjCImplDecl* ID = cast<ObjCImplDecl>(*I);
HandleCode(ID);
- for (ObjCImplementationDecl::method_iterator MI = ID->meth_begin(),
+ for (ObjCContainerDecl::method_iterator MI = ID->meth_begin(),
ME = ID->meth_end(); MI != ME; ++MI) {
checkerMgr->runCheckersOnASTDecl(*MI, *Mgr, BR);
if ((*MI)->isThisDeclarationADefinition()) {
if (!Opts.AnalyzeSpecificFunction.empty() &&
- Opts.AnalyzeSpecificFunction != (*MI)->getSelector().getAsString())
+ Opts.AnalyzeSpecificFunction !=
+ (*MI)->getSelector().getAsString())
break;
DisplayFunction(*MI);
HandleCode(*MI);
Modified: cfe/trunk/test/Analysis/misc-ps.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps.m?rev=131614&r1=131613&r2=131614&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps.m (original)
+++ cfe/trunk/test/Analysis/misc-ps.m Wed May 18 19:56:53 2011
@@ -1312,3 +1312,17 @@
}
}
+// Analyze methods in @implementation (category)
+ at interface RDar9465344
+ at end
+
+ at implementation RDar9465344 (MyCategory)
+- (void) testcategoryImpl {
+ int *p = 0x0;
+ *p = 0xDEADBEEF; // expected-warning {{null}}
+}
+ at end
+
+ at implementation RDar9465344
+ at end
+
More information about the cfe-commits
mailing list