29 using namespace clang;
33 class NSAutoreleasePoolChecker
34 :
public Checker<check::PreObjCMessage> {
35 mutable std::unique_ptr<BugType> BT;
39 void checkPreObjCMessage(
const ObjCMethodCall &msg, CheckerContext &C)
const;
44 void NSAutoreleasePoolChecker::checkPreObjCMessage(
const ObjCMethodCall &msg,
45 CheckerContext &C)
const {
55 if (releaseS.isNull())
62 BT.reset(
new BugType(
this,
"Use -drain instead of -release",
63 "API Upgrade (Apple)"));
65 ExplodedNode *N = C.generateNonFatalErrorNode();
71 auto Report = llvm::make_unique<BugReport>(
72 *BT,
"Use -drain instead of -release when using NSAutoreleasePool and " 73 "garbage collection", N);
75 C.emitReport(std::move(Report));
78 void ento::registerNSAutoreleasePoolChecker(CheckerManager &mgr) {
80 mgr.registerChecker<NSAutoreleasePoolChecker>();
Smart pointer class that efficiently represents Objective-C method names.
SourceRange getSourceRange() const override
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
const ObjCInterfaceDecl * getReceiverInterface() const
Get the interface for the receiver.
Represents any expression that calls an Objective-C method.
Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
Represents an ObjC class declaration.
Selector getSelector() const
Dataflow Directional Tag Classes.
bool isInstanceMessage() const