forked from OSchip/llvm-project
Teach static analyzer to analyze Objective-C methods in category implementations.
llvm-svn: 131614
This commit is contained in:
parent
316b460309
commit
5f06955aa0
|
@ -200,18 +200,20 @@ void AnalysisConsumer::HandleDeclContext(ASTContext &C, DeclContext *dc) {
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1312,3 +1312,17 @@ void radar9414427() {
|
|||
}
|
||||
}
|
||||
|
||||
// Analyze methods in @implementation (category)
|
||||
@interface RDar9465344
|
||||
@end
|
||||
|
||||
@implementation RDar9465344 (MyCategory)
|
||||
- (void) testcategoryImpl {
|
||||
int *p = 0x0;
|
||||
*p = 0xDEADBEEF; // expected-warning {{null}}
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation RDar9465344
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue