xref: /llvm-project/clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (revision 1e809b4c4c526d22c8f892d870856265f940e65a)
1 //== BasicObjCFoundationChecks.cpp - Simple Apple-Foundation checks -*- C++ -*--
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines BasicObjCFoundationChecks, a class that encapsulates
11 //  a set of simple checks to run on Objective-C code using Apple's Foundation
12 //  classes.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #include "ClangSACheckers.h"
17 #include "clang/Analysis/DomainSpecific/CocoaConventions.h"
18 #include "clang/StaticAnalyzer/Core/Checker.h"
19 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
20 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
21 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
22 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
23 #include "clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h"
24 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
25 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
26 #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
27 #include "clang/AST/DeclObjC.h"
28 #include "clang/AST/Expr.h"
29 #include "clang/AST/ExprObjC.h"
30 #include "clang/AST/ASTContext.h"
31 #include "llvm/ADT/SmallString.h"
32 
33 using namespace clang;
34 using namespace ento;
35 
36 namespace {
37 class APIMisuse : public BugType {
38 public:
39   APIMisuse(const char* name) : BugType(name, "API Misuse (Apple)") {}
40 };
41 } // end anonymous namespace
42 
43 //===----------------------------------------------------------------------===//
44 // Utility functions.
45 //===----------------------------------------------------------------------===//
46 
47 static const char* GetReceiverNameType(const ObjCMessage &msg) {
48   if (const ObjCInterfaceDecl *ID = msg.getReceiverInterface())
49     return ID->getIdentifier()->getNameStart();
50   return 0;
51 }
52 
53 static bool isReceiverClassOrSuperclass(const ObjCInterfaceDecl *ID,
54                                         StringRef ClassName) {
55   if (ID->getIdentifier()->getName() == ClassName)
56     return true;
57 
58   if (const ObjCInterfaceDecl *Super = ID->getSuperClass())
59     return isReceiverClassOrSuperclass(Super, ClassName);
60 
61   return false;
62 }
63 
64 static inline bool isNil(SVal X) {
65   return isa<loc::ConcreteInt>(X);
66 }
67 
68 //===----------------------------------------------------------------------===//
69 // NilArgChecker - Check for prohibited nil arguments to ObjC method calls.
70 //===----------------------------------------------------------------------===//
71 
72 namespace {
73   class NilArgChecker : public Checker<check::PreObjCMessage> {
74     mutable OwningPtr<APIMisuse> BT;
75 
76     void WarnNilArg(CheckerContext &C,
77                     const ObjCMessage &msg, unsigned Arg) const;
78 
79   public:
80     void checkPreObjCMessage(ObjCMessage msg, CheckerContext &C) const;
81   };
82 }
83 
84 void NilArgChecker::WarnNilArg(CheckerContext &C,
85                                const ObjCMessage &msg,
86                                unsigned int Arg) const
87 {
88   if (!BT)
89     BT.reset(new APIMisuse("nil argument"));
90 
91   if (ExplodedNode *N = C.generateSink()) {
92     SmallString<128> sbuf;
93     llvm::raw_svector_ostream os(sbuf);
94     os << "Argument to '" << GetReceiverNameType(msg) << "' method '"
95        << msg.getSelector().getAsString() << "' cannot be nil";
96 
97     BugReport *R = new BugReport(*BT, os.str(), N);
98     R->addRange(msg.getArgSourceRange(Arg));
99     C.EmitReport(R);
100   }
101 }
102 
103 void NilArgChecker::checkPreObjCMessage(ObjCMessage msg,
104                                         CheckerContext &C) const {
105   const ObjCInterfaceDecl *ID = msg.getReceiverInterface();
106   if (!ID)
107     return;
108 
109   if (isReceiverClassOrSuperclass(ID, "NSString")) {
110     Selector S = msg.getSelector();
111 
112     if (S.isUnarySelector())
113       return;
114 
115     // FIXME: This is going to be really slow doing these checks with
116     //  lexical comparisons.
117 
118     std::string NameStr = S.getAsString();
119     StringRef Name(NameStr);
120     assert(!Name.empty());
121 
122     // FIXME: Checking for initWithFormat: will not work in most cases
123     //  yet because [NSString alloc] returns id, not NSString*.  We will
124     //  need support for tracking expected-type information in the analyzer
125     //  to find these errors.
126     if (Name == "caseInsensitiveCompare:" ||
127         Name == "compare:" ||
128         Name == "compare:options:" ||
129         Name == "compare:options:range:" ||
130         Name == "compare:options:range:locale:" ||
131         Name == "componentsSeparatedByCharactersInSet:" ||
132         Name == "initWithFormat:") {
133       if (isNil(msg.getArgSVal(0, C.getLocationContext(), C.getState())))
134         WarnNilArg(C, msg, 0);
135     }
136   }
137 }
138 
139 //===----------------------------------------------------------------------===//
140 // Error reporting.
141 //===----------------------------------------------------------------------===//
142 
143 namespace {
144 class CFNumberCreateChecker : public Checker< check::PreStmt<CallExpr> > {
145   mutable OwningPtr<APIMisuse> BT;
146   mutable IdentifierInfo* II;
147 public:
148   CFNumberCreateChecker() : II(0) {}
149 
150   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
151 
152 private:
153   void EmitError(const TypedRegion* R, const Expr *Ex,
154                 uint64_t SourceSize, uint64_t TargetSize, uint64_t NumberKind);
155 };
156 } // end anonymous namespace
157 
158 enum CFNumberType {
159   kCFNumberSInt8Type = 1,
160   kCFNumberSInt16Type = 2,
161   kCFNumberSInt32Type = 3,
162   kCFNumberSInt64Type = 4,
163   kCFNumberFloat32Type = 5,
164   kCFNumberFloat64Type = 6,
165   kCFNumberCharType = 7,
166   kCFNumberShortType = 8,
167   kCFNumberIntType = 9,
168   kCFNumberLongType = 10,
169   kCFNumberLongLongType = 11,
170   kCFNumberFloatType = 12,
171   kCFNumberDoubleType = 13,
172   kCFNumberCFIndexType = 14,
173   kCFNumberNSIntegerType = 15,
174   kCFNumberCGFloatType = 16
175 };
176 
177 namespace {
178   template<typename T>
179   class Optional {
180     bool IsKnown;
181     T Val;
182   public:
183     Optional() : IsKnown(false), Val(0) {}
184     Optional(const T& val) : IsKnown(true), Val(val) {}
185 
186     bool isKnown() const { return IsKnown; }
187 
188     const T& getValue() const {
189       assert (isKnown());
190       return Val;
191     }
192 
193     operator const T&() const {
194       return getValue();
195     }
196   };
197 }
198 
199 static Optional<uint64_t> GetCFNumberSize(ASTContext &Ctx, uint64_t i) {
200   static const unsigned char FixedSize[] = { 8, 16, 32, 64, 32, 64 };
201 
202   if (i < kCFNumberCharType)
203     return FixedSize[i-1];
204 
205   QualType T;
206 
207   switch (i) {
208     case kCFNumberCharType:     T = Ctx.CharTy;     break;
209     case kCFNumberShortType:    T = Ctx.ShortTy;    break;
210     case kCFNumberIntType:      T = Ctx.IntTy;      break;
211     case kCFNumberLongType:     T = Ctx.LongTy;     break;
212     case kCFNumberLongLongType: T = Ctx.LongLongTy; break;
213     case kCFNumberFloatType:    T = Ctx.FloatTy;    break;
214     case kCFNumberDoubleType:   T = Ctx.DoubleTy;   break;
215     case kCFNumberCFIndexType:
216     case kCFNumberNSIntegerType:
217     case kCFNumberCGFloatType:
218       // FIXME: We need a way to map from names to Type*.
219     default:
220       return Optional<uint64_t>();
221   }
222 
223   return Ctx.getTypeSize(T);
224 }
225 
226 #if 0
227 static const char* GetCFNumberTypeStr(uint64_t i) {
228   static const char* Names[] = {
229     "kCFNumberSInt8Type",
230     "kCFNumberSInt16Type",
231     "kCFNumberSInt32Type",
232     "kCFNumberSInt64Type",
233     "kCFNumberFloat32Type",
234     "kCFNumberFloat64Type",
235     "kCFNumberCharType",
236     "kCFNumberShortType",
237     "kCFNumberIntType",
238     "kCFNumberLongType",
239     "kCFNumberLongLongType",
240     "kCFNumberFloatType",
241     "kCFNumberDoubleType",
242     "kCFNumberCFIndexType",
243     "kCFNumberNSIntegerType",
244     "kCFNumberCGFloatType"
245   };
246 
247   return i <= kCFNumberCGFloatType ? Names[i-1] : "Invalid CFNumberType";
248 }
249 #endif
250 
251 void CFNumberCreateChecker::checkPreStmt(const CallExpr *CE,
252                                          CheckerContext &C) const {
253   ProgramStateRef state = C.getState();
254   const FunctionDecl *FD = C.getCalleeDecl(CE);
255   if (!FD)
256     return;
257 
258   ASTContext &Ctx = C.getASTContext();
259   if (!II)
260     II = &Ctx.Idents.get("CFNumberCreate");
261 
262   if (FD->getIdentifier() != II || CE->getNumArgs() != 3)
263     return;
264 
265   // Get the value of the "theType" argument.
266   const LocationContext *LCtx = C.getLocationContext();
267   SVal TheTypeVal = state->getSVal(CE->getArg(1), LCtx);
268 
269   // FIXME: We really should allow ranges of valid theType values, and
270   //   bifurcate the state appropriately.
271   nonloc::ConcreteInt* V = dyn_cast<nonloc::ConcreteInt>(&TheTypeVal);
272   if (!V)
273     return;
274 
275   uint64_t NumberKind = V->getValue().getLimitedValue();
276   Optional<uint64_t> TargetSize = GetCFNumberSize(Ctx, NumberKind);
277 
278   // FIXME: In some cases we can emit an error.
279   if (!TargetSize.isKnown())
280     return;
281 
282   // Look at the value of the integer being passed by reference.  Essentially
283   // we want to catch cases where the value passed in is not equal to the
284   // size of the type being created.
285   SVal TheValueExpr = state->getSVal(CE->getArg(2), LCtx);
286 
287   // FIXME: Eventually we should handle arbitrary locations.  We can do this
288   //  by having an enhanced memory model that does low-level typing.
289   loc::MemRegionVal* LV = dyn_cast<loc::MemRegionVal>(&TheValueExpr);
290   if (!LV)
291     return;
292 
293   const TypedValueRegion* R = dyn_cast<TypedValueRegion>(LV->stripCasts());
294   if (!R)
295     return;
296 
297   QualType T = Ctx.getCanonicalType(R->getValueType());
298 
299   // FIXME: If the pointee isn't an integer type, should we flag a warning?
300   //  People can do weird stuff with pointers.
301 
302   if (!T->isIntegerType())
303     return;
304 
305   uint64_t SourceSize = Ctx.getTypeSize(T);
306 
307   // CHECK: is SourceSize == TargetSize
308   if (SourceSize == TargetSize)
309     return;
310 
311   // Generate an error.  Only generate a sink if 'SourceSize < TargetSize';
312   // otherwise generate a regular node.
313   //
314   // FIXME: We can actually create an abstract "CFNumber" object that has
315   //  the bits initialized to the provided values.
316   //
317   if (ExplodedNode *N = SourceSize < TargetSize ? C.generateSink()
318                                                 : C.addTransition()) {
319     SmallString<128> sbuf;
320     llvm::raw_svector_ostream os(sbuf);
321 
322     os << (SourceSize == 8 ? "An " : "A ")
323        << SourceSize << " bit integer is used to initialize a CFNumber "
324                         "object that represents "
325        << (TargetSize == 8 ? "an " : "a ")
326        << TargetSize << " bit integer. ";
327 
328     if (SourceSize < TargetSize)
329       os << (TargetSize - SourceSize)
330       << " bits of the CFNumber value will be garbage." ;
331     else
332       os << (SourceSize - TargetSize)
333       << " bits of the input integer will be lost.";
334 
335     if (!BT)
336       BT.reset(new APIMisuse("Bad use of CFNumberCreate"));
337 
338     BugReport *report = new BugReport(*BT, os.str(), N);
339     report->addRange(CE->getArg(2)->getSourceRange());
340     C.EmitReport(report);
341   }
342 }
343 
344 //===----------------------------------------------------------------------===//
345 // CFRetain/CFRelease checking for null arguments.
346 //===----------------------------------------------------------------------===//
347 
348 namespace {
349 class CFRetainReleaseChecker : public Checker< check::PreStmt<CallExpr> > {
350   mutable OwningPtr<APIMisuse> BT;
351   mutable IdentifierInfo *Retain, *Release;
352 public:
353   CFRetainReleaseChecker(): Retain(0), Release(0) {}
354   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
355 };
356 } // end anonymous namespace
357 
358 
359 void CFRetainReleaseChecker::checkPreStmt(const CallExpr *CE,
360                                           CheckerContext &C) const {
361   // If the CallExpr doesn't have exactly 1 argument just give up checking.
362   if (CE->getNumArgs() != 1)
363     return;
364 
365   ProgramStateRef state = C.getState();
366   const FunctionDecl *FD = C.getCalleeDecl(CE);
367   if (!FD)
368     return;
369 
370   if (!BT) {
371     ASTContext &Ctx = C.getASTContext();
372     Retain = &Ctx.Idents.get("CFRetain");
373     Release = &Ctx.Idents.get("CFRelease");
374     BT.reset(new APIMisuse("null passed to CFRetain/CFRelease"));
375   }
376 
377   // Check if we called CFRetain/CFRelease.
378   const IdentifierInfo *FuncII = FD->getIdentifier();
379   if (!(FuncII == Retain || FuncII == Release))
380     return;
381 
382   // FIXME: The rest of this just checks that the argument is non-null.
383   // It should probably be refactored and combined with AttrNonNullChecker.
384 
385   // Get the argument's value.
386   const Expr *Arg = CE->getArg(0);
387   SVal ArgVal = state->getSVal(Arg, C.getLocationContext());
388   DefinedSVal *DefArgVal = dyn_cast<DefinedSVal>(&ArgVal);
389   if (!DefArgVal)
390     return;
391 
392   // Get a NULL value.
393   SValBuilder &svalBuilder = C.getSValBuilder();
394   DefinedSVal zero = cast<DefinedSVal>(svalBuilder.makeZeroVal(Arg->getType()));
395 
396   // Make an expression asserting that they're equal.
397   DefinedOrUnknownSVal ArgIsNull = svalBuilder.evalEQ(state, zero, *DefArgVal);
398 
399   // Are they equal?
400   ProgramStateRef stateTrue, stateFalse;
401   llvm::tie(stateTrue, stateFalse) = state->assume(ArgIsNull);
402 
403   if (stateTrue && !stateFalse) {
404     ExplodedNode *N = C.generateSink(stateTrue);
405     if (!N)
406       return;
407 
408     const char *description = (FuncII == Retain)
409                             ? "Null pointer argument in call to CFRetain"
410                             : "Null pointer argument in call to CFRelease";
411 
412     BugReport *report = new BugReport(*BT, description, N);
413     report->addRange(Arg->getSourceRange());
414     report->addVisitor(bugreporter::getTrackNullOrUndefValueVisitor(N, Arg,
415                                                                     report));
416     C.EmitReport(report);
417     return;
418   }
419 
420   // From here on, we know the argument is non-null.
421   C.addTransition(stateFalse);
422 }
423 
424 //===----------------------------------------------------------------------===//
425 // Check for sending 'retain', 'release', or 'autorelease' directly to a Class.
426 //===----------------------------------------------------------------------===//
427 
428 namespace {
429 class ClassReleaseChecker : public Checker<check::PreObjCMessage> {
430   mutable Selector releaseS;
431   mutable Selector retainS;
432   mutable Selector autoreleaseS;
433   mutable Selector drainS;
434   mutable OwningPtr<BugType> BT;
435 
436 public:
437   void checkPreObjCMessage(ObjCMessage msg, CheckerContext &C) const;
438 };
439 }
440 
441 void ClassReleaseChecker::checkPreObjCMessage(ObjCMessage msg,
442                                               CheckerContext &C) const {
443 
444   if (!BT) {
445     BT.reset(new APIMisuse("message incorrectly sent to class instead of class "
446                            "instance"));
447 
448     ASTContext &Ctx = C.getASTContext();
449     releaseS = GetNullarySelector("release", Ctx);
450     retainS = GetNullarySelector("retain", Ctx);
451     autoreleaseS = GetNullarySelector("autorelease", Ctx);
452     drainS = GetNullarySelector("drain", Ctx);
453   }
454 
455   if (msg.isInstanceMessage())
456     return;
457   const ObjCInterfaceDecl *Class = msg.getReceiverInterface();
458   assert(Class);
459 
460   Selector S = msg.getSelector();
461   if (!(S == releaseS || S == retainS || S == autoreleaseS || S == drainS))
462     return;
463 
464   if (ExplodedNode *N = C.addTransition()) {
465     SmallString<200> buf;
466     llvm::raw_svector_ostream os(buf);
467 
468     os << "The '" << S.getAsString() << "' message should be sent to instances "
469           "of class '" << Class->getName()
470        << "' and not the class directly";
471 
472     BugReport *report = new BugReport(*BT, os.str(), N);
473     report->addRange(msg.getSourceRange());
474     C.EmitReport(report);
475   }
476 }
477 
478 //===----------------------------------------------------------------------===//
479 // Check for passing non-Objective-C types to variadic methods that expect
480 // only Objective-C types.
481 //===----------------------------------------------------------------------===//
482 
483 namespace {
484 class VariadicMethodTypeChecker : public Checker<check::PreObjCMessage> {
485   mutable Selector arrayWithObjectsS;
486   mutable Selector dictionaryWithObjectsAndKeysS;
487   mutable Selector setWithObjectsS;
488   mutable Selector initWithObjectsS;
489   mutable Selector initWithObjectsAndKeysS;
490   mutable OwningPtr<BugType> BT;
491 
492   bool isVariadicMessage(const ObjCMessage &msg) const;
493 
494 public:
495   void checkPreObjCMessage(ObjCMessage msg, CheckerContext &C) const;
496 };
497 }
498 
499 /// isVariadicMessage - Returns whether the given message is a variadic message,
500 /// where all arguments must be Objective-C types.
501 bool
502 VariadicMethodTypeChecker::isVariadicMessage(const ObjCMessage &msg) const {
503   const ObjCMethodDecl *MD = msg.getMethodDecl();
504 
505   if (!MD || !MD->isVariadic() || isa<ObjCProtocolDecl>(MD->getDeclContext()))
506     return false;
507 
508   Selector S = msg.getSelector();
509 
510   if (msg.isInstanceMessage()) {
511     // FIXME: Ideally we'd look at the receiver interface here, but that's not
512     // useful for init, because alloc returns 'id'. In theory, this could lead
513     // to false positives, for example if there existed a class that had an
514     // initWithObjects: implementation that does accept non-Objective-C pointer
515     // types, but the chance of that happening is pretty small compared to the
516     // gains that this analysis gives.
517     const ObjCInterfaceDecl *Class = MD->getClassInterface();
518 
519     // -[NSArray initWithObjects:]
520     if (isReceiverClassOrSuperclass(Class, "NSArray") &&
521         S == initWithObjectsS)
522       return true;
523 
524     // -[NSDictionary initWithObjectsAndKeys:]
525     if (isReceiverClassOrSuperclass(Class, "NSDictionary") &&
526         S == initWithObjectsAndKeysS)
527       return true;
528 
529     // -[NSSet initWithObjects:]
530     if (isReceiverClassOrSuperclass(Class, "NSSet") &&
531         S == initWithObjectsS)
532       return true;
533   } else {
534     const ObjCInterfaceDecl *Class = msg.getReceiverInterface();
535 
536     // -[NSArray arrayWithObjects:]
537     if (isReceiverClassOrSuperclass(Class, "NSArray") &&
538         S == arrayWithObjectsS)
539       return true;
540 
541     // -[NSDictionary dictionaryWithObjectsAndKeys:]
542     if (isReceiverClassOrSuperclass(Class, "NSDictionary") &&
543         S == dictionaryWithObjectsAndKeysS)
544       return true;
545 
546     // -[NSSet setWithObjects:]
547     if (isReceiverClassOrSuperclass(Class, "NSSet") &&
548         S == setWithObjectsS)
549       return true;
550   }
551 
552   return false;
553 }
554 
555 void VariadicMethodTypeChecker::checkPreObjCMessage(ObjCMessage msg,
556                                                     CheckerContext &C) const {
557   if (!BT) {
558     BT.reset(new APIMisuse("Arguments passed to variadic method aren't all "
559                            "Objective-C pointer types"));
560 
561     ASTContext &Ctx = C.getASTContext();
562     arrayWithObjectsS = GetUnarySelector("arrayWithObjects", Ctx);
563     dictionaryWithObjectsAndKeysS =
564       GetUnarySelector("dictionaryWithObjectsAndKeys", Ctx);
565     setWithObjectsS = GetUnarySelector("setWithObjects", Ctx);
566 
567     initWithObjectsS = GetUnarySelector("initWithObjects", Ctx);
568     initWithObjectsAndKeysS = GetUnarySelector("initWithObjectsAndKeys", Ctx);
569   }
570 
571   if (!isVariadicMessage(msg))
572       return;
573 
574   // We are not interested in the selector arguments since they have
575   // well-defined types, so the compiler will issue a warning for them.
576   unsigned variadicArgsBegin = msg.getSelector().getNumArgs();
577 
578   // We're not interested in the last argument since it has to be nil or the
579   // compiler would have issued a warning for it elsewhere.
580   unsigned variadicArgsEnd = msg.getNumArgs() - 1;
581 
582   if (variadicArgsEnd <= variadicArgsBegin)
583     return;
584 
585   // Verify that all arguments have Objective-C types.
586   llvm::Optional<ExplodedNode*> errorNode;
587   ProgramStateRef state = C.getState();
588 
589   for (unsigned I = variadicArgsBegin; I != variadicArgsEnd; ++I) {
590     QualType ArgTy = msg.getArgType(I);
591     if (ArgTy->isObjCObjectPointerType())
592       continue;
593 
594     // Block pointers are treaded as Objective-C pointers.
595     if (ArgTy->isBlockPointerType())
596       continue;
597 
598     // Ignore pointer constants.
599     if (isa<loc::ConcreteInt>(msg.getArgSVal(I, C.getLocationContext(),
600                                              state)))
601       continue;
602 
603     // Ignore pointer types annotated with 'NSObject' attribute.
604     if (C.getASTContext().isObjCNSObjectType(ArgTy))
605       continue;
606 
607     // Ignore CF references, which can be toll-free bridged.
608     if (coreFoundation::isCFObjectRef(ArgTy))
609       continue;
610 
611     // Generate only one error node to use for all bug reports.
612     if (!errorNode.hasValue()) {
613       errorNode = C.addTransition();
614     }
615 
616     if (!errorNode.getValue())
617       continue;
618 
619     SmallString<128> sbuf;
620     llvm::raw_svector_ostream os(sbuf);
621 
622     if (const char *TypeName = GetReceiverNameType(msg))
623       os << "Argument to '" << TypeName << "' method '";
624     else
625       os << "Argument to method '";
626 
627     os << msg.getSelector().getAsString()
628       << "' should be an Objective-C pointer type, not '"
629       << ArgTy.getAsString() << "'";
630 
631     BugReport *R = new BugReport(*BT, os.str(),
632                                              errorNode.getValue());
633     R->addRange(msg.getArgSourceRange(I));
634     C.EmitReport(R);
635   }
636 }
637 
638 //===----------------------------------------------------------------------===//
639 // Check registration.
640 //===----------------------------------------------------------------------===//
641 
642 void ento::registerNilArgChecker(CheckerManager &mgr) {
643   mgr.registerChecker<NilArgChecker>();
644 }
645 
646 void ento::registerCFNumberCreateChecker(CheckerManager &mgr) {
647   mgr.registerChecker<CFNumberCreateChecker>();
648 }
649 
650 void ento::registerCFRetainReleaseChecker(CheckerManager &mgr) {
651   mgr.registerChecker<CFRetainReleaseChecker>();
652 }
653 
654 void ento::registerClassReleaseChecker(CheckerManager &mgr) {
655   mgr.registerChecker<ClassReleaseChecker>();
656 }
657 
658 void ento::registerVariadicMethodTypeChecker(CheckerManager &mgr) {
659   mgr.registerChecker<VariadicMethodTypeChecker>();
660 }
661