2008-07-03 12:29:21 +08:00
|
|
|
//==- CheckObjCDealloc.cpp - Check ObjC -dealloc implementation --*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-07-12 04:53:14 +08:00
|
|
|
// This file defines a CheckObjCDealloc, a checker that
|
|
|
|
// analyzes an Objective-C class's implementation to determine if it
|
|
|
|
// correctly implements -dealloc.
|
2008-07-03 12:29:21 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-02-18 05:39:33 +08:00
|
|
|
#include "ClangSACheckers.h"
|
2012-12-01 23:09:41 +08:00
|
|
|
#include "clang/AST/Attr.h"
|
2008-07-03 12:29:21 +08:00
|
|
|
#include "clang/AST/DeclObjC.h"
|
2012-12-01 23:09:41 +08:00
|
|
|
#include "clang/AST/Expr.h"
|
|
|
|
#include "clang/AST/ExprObjC.h"
|
2008-07-03 22:35:01 +08:00
|
|
|
#include "clang/Basic/LangOptions.h"
|
2012-12-04 17:13:33 +08:00
|
|
|
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
|
|
|
|
#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
|
|
|
|
#include "clang/StaticAnalyzer/Core/Checker.h"
|
|
|
|
#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
|
2008-10-29 12:30:28 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2008-07-03 12:29:21 +08:00
|
|
|
|
|
|
|
using namespace clang;
|
2010-12-23 15:20:52 +08:00
|
|
|
using namespace ento;
|
2008-07-03 12:29:21 +08:00
|
|
|
|
2011-08-13 07:37:29 +08:00
|
|
|
static bool scan_ivar_release(Stmt *S, ObjCIvarDecl *ID,
|
|
|
|
const ObjCPropertyDecl *PD,
|
2009-09-09 23:08:12 +08:00
|
|
|
Selector Release,
|
2008-10-30 23:13:43 +08:00
|
|
|
IdentifierInfo* SelfII,
|
2011-08-13 07:37:29 +08:00
|
|
|
ASTContext &Ctx) {
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-30 23:13:43 +08:00
|
|
|
// [mMyIvar release]
|
2011-08-13 07:37:29 +08:00
|
|
|
if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
|
2008-10-29 12:30:28 +08:00
|
|
|
if (ME->getSelector() == Release)
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
if (ME->getInstanceReceiver())
|
2011-08-13 07:37:29 +08:00
|
|
|
if (Expr *Receiver = ME->getInstanceReceiver()->IgnoreParenCasts())
|
|
|
|
if (ObjCIvarRefExpr *E = dyn_cast<ObjCIvarRefExpr>(Receiver))
|
2008-10-30 23:13:43 +08:00
|
|
|
if (E->getDecl() == ID)
|
|
|
|
return true;
|
2008-10-29 12:30:28 +08:00
|
|
|
|
2008-10-30 23:13:43 +08:00
|
|
|
// [self setMyIvar:nil];
|
2011-08-13 07:37:29 +08:00
|
|
|
if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
|
Overhaul the AST representation of Objective-C message send
expressions, to improve source-location information, clarify the
actual receiver of the message, and pave the way for proper C++
support. The ObjCMessageExpr node represents four different kinds of
message sends in a single AST node:
1) Send to a object instance described by an expression (e.g., [x method:5])
2) Send to a class described by the class name (e.g., [NSString method:5])
3) Send to a superclass class (e.g, [super method:5] in class method)
4) Send to a superclass instance (e.g., [super method:5] in instance method)
Previously these four cases where tangled together. Now, they have
more distinct representations. Specific changes:
1) Unchanged; the object instance is represented by an Expr*.
2) Previously stored the ObjCInterfaceDecl* referring to the class
receiving the message. Now stores a TypeSourceInfo* so that we know
how the class was spelled. This both maintains typedef information
and opens the door for more complicated C++ types (e.g., dependent
types). There was an alternative, unused representation of these
sends by naming the class via an IdentifierInfo *. In practice, we
either had an ObjCInterfaceDecl *, from which we would get the
IdentifierInfo *, or we fell into the case below...
3) Previously represented by a class message whose IdentifierInfo *
referred to "super". Sema and CodeGen would use isStr("super") to
determine if they had a send to super. Now represented as a
"class super" send, where we have both the location of the "super"
keyword and the ObjCInterfaceDecl* of the superclass we're
targetting (statically).
4) Previously represented by an instance message whose receiver is a
an ObjCSuperExpr, which Sema and CodeGen would check for via
isa<ObjCSuperExpr>(). Now represented as an "instance super" send,
where we have both the location of the "super" keyword and the
ObjCInterfaceDecl* of the superclass we're targetting
(statically). Note that ObjCSuperExpr only has one remaining use in
the AST, which is for "super.prop" references.
The new representation of ObjCMessageExpr is 2 pointers smaller than
the old one, since it combines more storage. It also eliminates a leak
when we loaded message-send expressions from a precompiled header. The
representation also feels much cleaner to me; comments welcome!
This patch attempts to maintain the same semantics we previously had
with Objective-C message sends. In several places, there are massive
changes that boil down to simply replacing a nested-if structure such
as:
if (message has a receiver expression) {
// instance message
if (isa<ObjCSuperExpr>(...)) {
// send to super
} else {
// send to an object
}
} else {
// class message
if (name->isStr("super")) {
// class send to super
} else {
// send to class
}
}
with a switch
switch (E->getReceiverKind()) {
case ObjCMessageExpr::SuperInstance: ...
case ObjCMessageExpr::Instance: ...
case ObjCMessageExpr::SuperClass: ...
case ObjCMessageExpr::Class:...
}
There are quite a few places (particularly in the checkers) where
send-to-super is effectively ignored. I've placed FIXMEs in most of
them, and attempted to address send-to-super in a reasonable way. This
could use some review.
llvm-svn: 101972
2010-04-21 08:45:42 +08:00
|
|
|
if (ME->getInstanceReceiver())
|
2011-08-13 07:37:29 +08:00
|
|
|
if (Expr *Receiver = ME->getInstanceReceiver()->IgnoreParenCasts())
|
|
|
|
if (DeclRefExpr *E = dyn_cast<DeclRefExpr>(Receiver))
|
2008-10-30 23:13:43 +08:00
|
|
|
if (E->getDecl()->getIdentifier() == SelfII)
|
|
|
|
if (ME->getMethodDecl() == PD->getSetterMethodDecl() &&
|
|
|
|
ME->getNumArgs() == 1 &&
|
2009-09-25 12:25:58 +08:00
|
|
|
ME->getArg(0)->isNullPointerConstant(Ctx,
|
|
|
|
Expr::NPC_ValueDependentIsNull))
|
2008-10-30 23:13:43 +08:00
|
|
|
return true;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-30 23:13:43 +08:00
|
|
|
// self.myIvar = nil;
|
|
|
|
if (BinaryOperator* BO = dyn_cast<BinaryOperator>(S))
|
|
|
|
if (BO->isAssignmentOp())
|
2011-08-13 07:37:29 +08:00
|
|
|
if (ObjCPropertyRefExpr *PRE =
|
2010-12-02 09:19:52 +08:00
|
|
|
dyn_cast<ObjCPropertyRefExpr>(BO->getLHS()->IgnoreParenCasts()))
|
|
|
|
if (PRE->isExplicitProperty() && PRE->getExplicitProperty() == PD)
|
2009-09-25 12:25:58 +08:00
|
|
|
if (BO->getRHS()->isNullPointerConstant(Ctx,
|
|
|
|
Expr::NPC_ValueDependentIsNull)) {
|
2008-12-09 05:44:15 +08:00
|
|
|
// This is only a 'release' if the property kind is not
|
|
|
|
// 'assign'.
|
2012-09-11 05:20:09 +08:00
|
|
|
return PD->getSetterKind() != ObjCPropertyDecl::Assign;
|
2008-12-09 05:44:15 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
// Recurse to children.
|
|
|
|
for (Stmt::child_iterator I = S->child_begin(), E= S->child_end(); I!=E; ++I)
|
2008-10-30 23:13:43 +08:00
|
|
|
if (*I && scan_ivar_release(*I, ID, PD, Release, SelfII, Ctx))
|
2008-10-29 12:30:28 +08:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-12 05:49:21 +08:00
|
|
|
static void checkObjCDealloc(const CheckerBase *Checker,
|
|
|
|
const ObjCImplementationDecl *D,
|
|
|
|
const LangOptions &LOpts, BugReporter &BR) {
|
2008-07-03 12:29:21 +08:00
|
|
|
|
2011-09-14 01:21:33 +08:00
|
|
|
assert (LOpts.getGC() != LangOptions::GCOnly);
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-08-13 07:37:29 +08:00
|
|
|
ASTContext &Ctx = BR.getContext();
|
|
|
|
const ObjCInterfaceDecl *ID = D->getClassInterface();
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-07 14:36:08 +08:00
|
|
|
// Does the class contain any ivars that are pointers (or id<...>)?
|
|
|
|
// If not, skip the check entirely.
|
|
|
|
// NOTE: This is motivated by PR 2517:
|
|
|
|
// http://llvm.org/bugs/show_bug.cgi?id=2517
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-07 14:36:08 +08:00
|
|
|
bool containsPointerIvar = false;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2014-03-14 05:09:43 +08:00
|
|
|
for (const auto *Ivar : ID->ivars()) {
|
|
|
|
QualType T = Ivar->getType();
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-07-16 23:41:00 +08:00
|
|
|
if (!T->isObjCObjectPointerType() ||
|
2014-03-14 05:09:43 +08:00
|
|
|
Ivar->hasAttr<IBOutletAttr>() || // Skip IBOutlets.
|
|
|
|
Ivar->hasAttr<IBOutletCollectionAttr>()) // Skip IBOutletCollections.
|
2008-07-26 01:04:49 +08:00
|
|
|
continue;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-26 01:04:49 +08:00
|
|
|
containsPointerIvar = true;
|
|
|
|
break;
|
2008-07-07 14:36:08 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-07 14:36:08 +08:00
|
|
|
if (!containsPointerIvar)
|
|
|
|
return;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-03 12:29:21 +08:00
|
|
|
// Determine if the class subclasses NSObject.
|
|
|
|
IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject");
|
2009-02-11 15:10:07 +08:00
|
|
|
IdentifierInfo* SenTestCaseII = &Ctx.Idents.get("SenTestCase");
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2009-02-11 15:10:07 +08:00
|
|
|
for ( ; ID ; ID = ID->getSuperClass()) {
|
|
|
|
IdentifierInfo *II = ID->getIdentifier();
|
|
|
|
|
|
|
|
if (II == NSObjectII)
|
2008-07-03 12:29:21 +08:00
|
|
|
break;
|
2009-02-11 15:10:07 +08:00
|
|
|
|
|
|
|
// FIXME: For now, ignore classes that subclass SenTestCase, as these don't
|
|
|
|
// need to implement -dealloc. They implement tear down in another way,
|
|
|
|
// which we should try and catch later.
|
|
|
|
// http://llvm.org/bugs/show_bug.cgi?id=3187
|
|
|
|
if (II == SenTestCaseII)
|
|
|
|
return;
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-03 12:29:21 +08:00
|
|
|
if (!ID)
|
|
|
|
return;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-03 12:29:21 +08:00
|
|
|
// Get the "dealloc" selector.
|
|
|
|
IdentifierInfo* II = &Ctx.Idents.get("dealloc");
|
2009-09-09 23:08:12 +08:00
|
|
|
Selector S = Ctx.Selectors.getSelector(0, &II);
|
2014-05-27 10:45:47 +08:00
|
|
|
const ObjCMethodDecl *MD = nullptr;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-07-03 12:29:21 +08:00
|
|
|
// Scan the instance methods for "dealloc".
|
2014-03-14 03:50:17 +08:00
|
|
|
for (const auto *I : D->instance_methods()) {
|
|
|
|
if (I->getSelector() == S) {
|
|
|
|
MD = I;
|
2008-07-03 12:29:21 +08:00
|
|
|
break;
|
2009-09-09 23:08:12 +08:00
|
|
|
}
|
2008-07-03 12:29:21 +08:00
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-09-21 05:38:35 +08:00
|
|
|
PathDiagnosticLocation DLoc =
|
|
|
|
PathDiagnosticLocation::createBegin(D, BR.getSourceManager());
|
|
|
|
|
2008-07-03 12:29:21 +08:00
|
|
|
if (!MD) { // No dealloc found.
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-09-14 01:21:33 +08:00
|
|
|
const char* name = LOpts.getGC() == LangOptions::NonGC
|
2009-09-09 23:08:12 +08:00
|
|
|
? "missing -dealloc"
|
2008-07-15 01:40:50 +08:00
|
|
|
: "missing -dealloc (Hybrid MM, non-GC)";
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
std::string buf;
|
|
|
|
llvm::raw_string_ostream os(buf);
|
2012-02-07 19:57:45 +08:00
|
|
|
os << "Objective-C class '" << *D << "' lacks a 'dealloc' instance method";
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2014-02-12 05:49:21 +08:00
|
|
|
BR.EmitBasicReport(D, Checker, name, categories::CoreFoundationObjectiveC,
|
2012-04-06 04:43:28 +08:00
|
|
|
os.str(), DLoc);
|
2008-07-03 12:29:21 +08:00
|
|
|
return;
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
// Get the "release" selector.
|
|
|
|
IdentifierInfo* RII = &Ctx.Idents.get("release");
|
2009-09-09 23:08:12 +08:00
|
|
|
Selector RS = Ctx.Selectors.getSelector(0, &RII);
|
|
|
|
|
2008-10-30 23:13:43 +08:00
|
|
|
// Get the "self" identifier
|
|
|
|
IdentifierInfo* SelfII = &Ctx.Idents.get("self");
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
// Scan for missing and extra releases of ivars used by implementations
|
|
|
|
// of synthesized properties
|
2014-03-14 23:02:45 +08:00
|
|
|
for (const auto *I : D->property_impls()) {
|
2008-10-29 12:30:28 +08:00
|
|
|
// We can only check the synthesized properties
|
2012-04-30 10:36:29 +08:00
|
|
|
if (I->getPropertyImplementation() != ObjCPropertyImplDecl::Synthesize)
|
2008-10-29 12:30:28 +08:00
|
|
|
continue;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2012-04-30 10:36:29 +08:00
|
|
|
ObjCIvarDecl *ID = I->getPropertyIvarDecl();
|
2008-10-29 12:30:28 +08:00
|
|
|
if (!ID)
|
|
|
|
continue;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
QualType T = ID->getType();
|
2009-07-16 23:41:00 +08:00
|
|
|
if (!T->isObjCObjectPointerType()) // Skip non-pointer ivars
|
2008-10-29 12:30:28 +08:00
|
|
|
continue;
|
|
|
|
|
2012-04-30 10:36:29 +08:00
|
|
|
const ObjCPropertyDecl *PD = I->getPropertyDecl();
|
2009-09-09 23:08:12 +08:00
|
|
|
if (!PD)
|
2008-10-29 12:30:28 +08:00
|
|
|
continue;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
// ivars cannot be set via read-only properties, so we'll skip them
|
2009-09-09 23:08:12 +08:00
|
|
|
if (PD->isReadOnly())
|
2011-10-15 02:45:37 +08:00
|
|
|
continue;
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2008-10-29 12:30:28 +08:00
|
|
|
// ivar must be released if and only if the kind of setter was not 'assign'
|
|
|
|
bool requiresRelease = PD->getSetterKind() != ObjCPropertyDecl::Assign;
|
2009-09-09 23:08:12 +08:00
|
|
|
if (scan_ivar_release(MD->getBody(), ID, PD, RS, SelfII, Ctx)
|
2008-10-30 23:13:43 +08:00
|
|
|
!= requiresRelease) {
|
2014-05-27 10:45:47 +08:00
|
|
|
const char *name = nullptr;
|
2008-10-29 12:30:28 +08:00
|
|
|
std::string buf;
|
|
|
|
llvm::raw_string_ostream os(buf);
|
|
|
|
|
2009-09-09 23:08:12 +08:00
|
|
|
if (requiresRelease) {
|
2011-09-14 01:21:33 +08:00
|
|
|
name = LOpts.getGC() == LangOptions::NonGC
|
2008-10-29 12:30:28 +08:00
|
|
|
? "missing ivar release (leak)"
|
|
|
|
: "missing ivar release (Hybrid MM, non-GC)";
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-10-15 02:45:37 +08:00
|
|
|
os << "The '" << *ID
|
2008-10-29 12:30:28 +08:00
|
|
|
<< "' instance variable was retained by a synthesized property but "
|
2009-09-09 23:08:12 +08:00
|
|
|
"wasn't released in 'dealloc'";
|
2008-10-29 12:30:28 +08:00
|
|
|
} else {
|
2011-09-14 01:21:33 +08:00
|
|
|
name = LOpts.getGC() == LangOptions::NonGC
|
2008-10-29 12:30:28 +08:00
|
|
|
? "extra ivar release (use-after-release)"
|
|
|
|
: "extra ivar release (Hybrid MM, non-GC)";
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-10-15 02:45:37 +08:00
|
|
|
os << "The '" << *ID
|
2008-10-29 12:30:28 +08:00
|
|
|
<< "' instance variable was not retained by a synthesized property "
|
|
|
|
"but was released in 'dealloc'";
|
|
|
|
}
|
2009-09-09 23:08:12 +08:00
|
|
|
|
2011-09-21 05:38:35 +08:00
|
|
|
PathDiagnosticLocation SDLoc =
|
2014-03-14 23:02:45 +08:00
|
|
|
PathDiagnosticLocation::createBegin(I, BR.getSourceManager());
|
2011-09-21 05:38:35 +08:00
|
|
|
|
2014-02-12 05:49:21 +08:00
|
|
|
BR.EmitBasicReport(MD, Checker, name,
|
|
|
|
categories::CoreFoundationObjectiveC, os.str(), SDLoc);
|
2008-10-29 12:30:28 +08:00
|
|
|
}
|
|
|
|
}
|
2008-07-03 12:29:21 +08:00
|
|
|
}
|
|
|
|
|
2011-02-18 05:39:33 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ObjCDeallocChecker
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace {
|
2011-03-01 09:16:21 +08:00
|
|
|
class ObjCDeallocChecker : public Checker<
|
2011-02-18 05:39:33 +08:00
|
|
|
check::ASTDecl<ObjCImplementationDecl> > {
|
|
|
|
public:
|
|
|
|
void checkASTDecl(const ObjCImplementationDecl *D, AnalysisManager& mgr,
|
|
|
|
BugReporter &BR) const {
|
2012-03-11 15:00:24 +08:00
|
|
|
if (mgr.getLangOpts().getGC() == LangOptions::GCOnly)
|
2011-02-18 05:39:33 +08:00
|
|
|
return;
|
2014-02-12 05:49:21 +08:00
|
|
|
checkObjCDealloc(this, cast<ObjCImplementationDecl>(D), mgr.getLangOpts(),
|
|
|
|
BR);
|
2011-02-18 05:39:33 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void ento::registerObjCDeallocChecker(CheckerManager &mgr) {
|
|
|
|
mgr.registerChecker<ObjCDeallocChecker>();
|
|
|
|
}
|