28 using namespace clang;
32 class NSAutoreleasePoolChecker
33 :
public Checker<check::PreObjCMessage> {
34 mutable std::unique_ptr<BugType> BT;
38 void checkPreObjCMessage(
const ObjCMethodCall &msg, CheckerContext &C)
const;
43 void NSAutoreleasePoolChecker::checkPreObjCMessage(
const ObjCMethodCall &msg,
44 CheckerContext &C)
const {
54 if (releaseS.isNull())
61 BT.reset(
new BugType(
this,
"Use -drain instead of -release",
62 "API Upgrade (Apple)"));
64 ExplodedNode *N = C.generateNonFatalErrorNode();
70 auto Report = std::make_unique<PathSensitiveBugReport>(
72 "Use -drain instead of -release when using NSAutoreleasePool and " 76 C.emitReport(std::move(Report));
79 void ento::registerNSAutoreleasePoolChecker(CheckerManager &mgr) {
80 mgr.registerChecker<NSAutoreleasePoolChecker>();
83 bool ento::shouldRegisterNSAutoreleasePoolChecker(
const LangOptions &LO) {
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.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
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