]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
Merge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / StaticAnalyzer / Checkers / Checkers.td
1 //===--- Checkers.td - Static Analyzer Checkers -===-----------------------===//
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 include "CheckerBase.td"
11
12 //===----------------------------------------------------------------------===//
13 // Packages.
14 //===----------------------------------------------------------------------===//
15
16 // The Alpha package is for checkers that have too many false positives to be
17 // turned on by default. The hierarchy under Alpha should be organized in the
18 // hierarchy checkers would have had if they were truly at the top level.
19 // (For example, a Cocoa-specific checker that is alpha should be in
20 // alpha.osx.cocoa).
21 def Alpha : Package<"alpha">;
22
23 def Core : Package<"core">;
24 def CoreBuiltin : Package<"builtin">, ParentPackage<Core>;
25 def CoreUninitialized  : Package<"uninitialized">, ParentPackage<Core>;
26 def CoreAlpha : Package<"core">, ParentPackage<Alpha>;
27
28 // The OptIn package is for checkers that are not alpha and that would normally
29 // be on by default but where the driver does not have enough information to
30 // determine when they are applicable. For example, localizability checkers fit
31 // this criterion because the driver cannot determine whether a project is
32 // localized or not -- this is best determined at the IDE or build-system level.
33 //
34 // The checker hierarchy under OptIn should mirror that in Alpha: checkers
35 // should be organized as if they were at the top level.
36 //
37 // Note: OptIn is *not* intended for checkers that are too noisy to be on by
38 // default. Such checkers belong in the alpha package.
39 def OptIn : Package<"optin">;
40
41 // In the Portability package reside checkers for finding code that relies on
42 // implementation-defined behavior. Such checks are wanted for cross-platform
43 // development, but unwanted for developers who target only a single platform.
44 def PortabilityOptIn : Package<"portability">, ParentPackage<OptIn>;
45
46 def Nullability : Package<"nullability">;
47
48 def Cplusplus : Package<"cplusplus">;
49 def CplusplusAlpha : Package<"cplusplus">, ParentPackage<Alpha>;
50 def CplusplusOptIn : Package<"cplusplus">, ParentPackage<OptIn>;
51
52 def Valist : Package<"valist">;
53
54 def DeadCode : Package<"deadcode">;
55 def DeadCodeAlpha : Package<"deadcode">, ParentPackage<Alpha>;
56
57 def Performance : Package<"performance">, ParentPackage<OptIn>;
58
59 def Security : Package <"security">;
60 def InsecureAPI : Package<"insecureAPI">, ParentPackage<Security>;
61 def SecurityAlpha : Package<"security">, ParentPackage<Alpha>;
62 def Taint : Package<"taint">, ParentPackage<SecurityAlpha>;
63
64 def Unix : Package<"unix">;
65 def UnixAlpha : Package<"unix">, ParentPackage<Alpha>;
66 def CString : Package<"cstring">, ParentPackage<Unix>;
67 def CStringAlpha : Package<"cstring">, ParentPackage<UnixAlpha>;
68
69 def OSX : Package<"osx">;
70 def OSXAlpha : Package<"osx">, ParentPackage<Alpha>;
71 def OSXOptIn : Package<"osx">, ParentPackage<OptIn>;
72
73 def Cocoa : Package<"cocoa">, ParentPackage<OSX>;
74 def CocoaAlpha : Package<"cocoa">, ParentPackage<OSXAlpha>;
75 def CocoaOptIn : Package<"cocoa">, ParentPackage<OSXOptIn>;
76
77 def CoreFoundation : Package<"coreFoundation">, ParentPackage<OSX>;
78 def Containers : Package<"containers">, ParentPackage<CoreFoundation>;
79
80 def LocalizabilityAlpha : Package<"localizability">, ParentPackage<CocoaAlpha>;
81 def LocalizabilityOptIn : Package<"localizability">, ParentPackage<CocoaOptIn>;
82
83 def MPI : Package<"mpi">, ParentPackage<OptIn>;
84
85 def LLVM : Package<"llvm">;
86 def LLVMAlpha : Package<"llvm">, ParentPackage<Alpha>;
87
88 // The APIModeling package is for checkers that model APIs and don't perform
89 // any diagnostics. These checkers are always turned on; this package is
90 // intended for API modeling that is not controlled by the target triple.
91 def APIModeling : Package<"apiModeling">;
92 def GoogleAPIModeling : Package<"google">, ParentPackage<APIModeling>;
93
94 def Debug : Package<"debug">;
95
96 def CloneDetectionAlpha : Package<"clone">, ParentPackage<Alpha>;
97
98 //===----------------------------------------------------------------------===//
99 // Core Checkers.
100 //===----------------------------------------------------------------------===//
101
102 let ParentPackage = Core in {
103
104 def DereferenceChecker : Checker<"NullDereference">,
105   HelpText<"Check for dereferences of null pointers">,
106   Documentation<HasDocumentation>;
107
108 def CallAndMessageChecker : Checker<"CallAndMessage">,
109   HelpText<"Check for logical errors for function calls and Objective-C "
110            "message expressions (e.g., uninitialized arguments, null function "
111            "pointers)">,
112   Documentation<HasDocumentation>;
113
114 def NonNullParamChecker : Checker<"NonNullParamChecker">,
115   HelpText<"Check for null pointers passed as arguments to a function whose "
116            "arguments are references or marked with the 'nonnull' attribute">,
117   Documentation<HasDocumentation>;
118
119 def VLASizeChecker : Checker<"VLASize">,
120   HelpText<"Check for declarations of VLA of undefined or zero size">,
121   Documentation<HasDocumentation>;
122
123 def DivZeroChecker : Checker<"DivideZero">,
124   HelpText<"Check for division by zero">,
125   Documentation<HasDocumentation>;
126
127 def UndefResultChecker : Checker<"UndefinedBinaryOperatorResult">,
128   HelpText<"Check for undefined results of binary operators">,
129   Documentation<HasDocumentation>;
130
131 def StackAddrEscapeChecker : Checker<"StackAddressEscape">,
132   HelpText<"Check that addresses to stack memory do not escape the function">,
133   Documentation<HasDocumentation>;
134
135 def DynamicTypePropagation : Checker<"DynamicTypePropagation">,
136   HelpText<"Generate dynamic type information">,
137   Documentation<NotDocumented>;
138
139 def NonnullGlobalConstantsChecker: Checker<"NonnilStringConstants">,
140   HelpText<"Assume that const string-like globals are non-null">,
141   Documentation<NotDocumented>;
142
143 } // end "core"
144
145 let ParentPackage = CoreAlpha in {
146
147 def BoolAssignmentChecker : Checker<"BoolAssignment">,
148   HelpText<"Warn about assigning non-{0,1} values to Boolean variables">,
149   Documentation<HasAlphaDocumentation>;
150
151 def CastSizeChecker : Checker<"CastSize">,
152   HelpText<"Check when casting a malloc'ed type T, whether the size is a "
153            "multiple of the size of T">,
154   Documentation<HasAlphaDocumentation>;
155
156 def CastToStructChecker : Checker<"CastToStruct">,
157   HelpText<"Check for cast from non-struct pointer to struct pointer">,
158   Documentation<HasAlphaDocumentation>;
159
160 def ConversionChecker : Checker<"Conversion">,
161   HelpText<"Loss of sign/precision in implicit conversions">,
162   Documentation<HasAlphaDocumentation>;
163
164 def IdenticalExprChecker : Checker<"IdenticalExpr">,
165   HelpText<"Warn about unintended use of identical expressions in operators">,
166   Documentation<HasAlphaDocumentation>;
167
168 def FixedAddressChecker : Checker<"FixedAddr">,
169   HelpText<"Check for assignment of a fixed address to a pointer">,
170   Documentation<HasAlphaDocumentation>;
171
172 def PointerArithChecker : Checker<"PointerArithm">,
173   HelpText<"Check for pointer arithmetic on locations other than array "
174            "elements">,
175   Documentation<HasAlphaDocumentation>;
176
177 def PointerSubChecker : Checker<"PointerSub">,
178   HelpText<"Check for pointer subtractions on two pointers pointing to "
179            "different memory chunks">,
180   Documentation<HasAlphaDocumentation>;
181
182 def SizeofPointerChecker : Checker<"SizeofPtr">,
183   HelpText<"Warn about unintended use of sizeof() on pointer expressions">,
184   Documentation<HasAlphaDocumentation>;
185
186 def CallAndMessageUnInitRefArg : Checker<"CallAndMessageUnInitRefArg">,
187   HelpText<"Check for logical errors for function calls and Objective-C "
188            "message expressions (e.g., uninitialized arguments, null function "
189            "pointers, and pointer to undefined variables)">,
190   Documentation<HasAlphaDocumentation>;
191
192 def TestAfterDivZeroChecker : Checker<"TestAfterDivZero">,
193   HelpText<"Check for division by variable that is later compared against 0. "
194            "Either the comparison is useless or there is division by zero.">,
195   Documentation<HasAlphaDocumentation>;
196
197 def DynamicTypeChecker : Checker<"DynamicTypeChecker">,
198   HelpText<"Check for cases where the dynamic and the static type of an object "
199            "are unrelated.">,
200   Documentation<HasAlphaDocumentation>;
201
202 def StackAddrAsyncEscapeChecker : Checker<"StackAddressAsyncEscape">,
203   HelpText<"Check that addresses to stack memory do not escape the function">,
204   Documentation<HasAlphaDocumentation>;
205
206 } // end "alpha.core"
207
208 let ParentPackage = Nullability in {
209
210 def NullPassedToNonnullChecker : Checker<"NullPassedToNonnull">,
211   HelpText<"Warns when a null pointer is passed to a pointer which has a "
212            "_Nonnull type.">,
213   Documentation<HasDocumentation>;
214
215 def NullReturnedFromNonnullChecker : Checker<"NullReturnedFromNonnull">,
216   HelpText<"Warns when a null pointer is returned from a function that has "
217            "_Nonnull return type.">,
218   Documentation<HasDocumentation>;
219
220 def NullableDereferencedChecker : Checker<"NullableDereferenced">,
221   HelpText<"Warns when a nullable pointer is dereferenced.">,
222   Documentation<HasDocumentation>;
223
224 def NullablePassedToNonnullChecker : Checker<"NullablePassedToNonnull">,
225   HelpText<"Warns when a nullable pointer is passed to a pointer which has a "
226            "_Nonnull type.">,
227   Documentation<HasDocumentation>;
228
229 def NullableReturnedFromNonnullChecker : Checker<"NullableReturnedFromNonnull">,
230   HelpText<"Warns when a nullable pointer is returned from a function that has "
231            "_Nonnull return type.">,
232   Documentation<NotDocumented>;
233
234 } // end "nullability"
235
236 let ParentPackage = APIModeling in {
237
238 def StdCLibraryFunctionsChecker : Checker<"StdCLibraryFunctions">,
239   HelpText<"Improve modeling of the C standard library functions">,
240   Documentation<NotDocumented>;
241
242 def TrustNonnullChecker : Checker<"TrustNonnull">,
243   HelpText<"Trust that returns from framework methods annotated with _Nonnull "
244            "are not null">,
245   Documentation<NotDocumented>;
246
247 } // end "apiModeling"
248
249 //===----------------------------------------------------------------------===//
250 // Evaluate "builtin" functions.
251 //===----------------------------------------------------------------------===//
252
253 let ParentPackage = CoreBuiltin in {
254
255 def NoReturnFunctionChecker : Checker<"NoReturnFunctions">,
256   HelpText<"Evaluate \"panic\" functions that are known to not return to the "
257            "caller">,
258   Documentation<NotDocumented>;
259
260 def BuiltinFunctionChecker : Checker<"BuiltinFunctions">,
261   HelpText<"Evaluate compiler builtin functions (e.g., alloca())">,
262   Documentation<NotDocumented>;
263
264 } // end "core.builtin"
265
266 //===----------------------------------------------------------------------===//
267 // Uninitialized values checkers.
268 //===----------------------------------------------------------------------===//
269
270 let ParentPackage = CoreUninitialized in {
271
272 def UndefinedArraySubscriptChecker : Checker<"ArraySubscript">,
273   HelpText<"Check for uninitialized values used as array subscripts">,
274   Documentation<HasDocumentation>;
275
276 def UndefinedAssignmentChecker : Checker<"Assign">,
277   HelpText<"Check for assigning uninitialized values">,
278   Documentation<HasDocumentation>;
279
280 def UndefBranchChecker : Checker<"Branch">,
281   HelpText<"Check for uninitialized values used as branch conditions">,
282   Documentation<HasDocumentation>;
283
284 def UndefCapturedBlockVarChecker : Checker<"CapturedBlockVariable">,
285   HelpText<"Check for blocks that capture uninitialized values">,
286   Documentation<NotDocumented>;
287
288 def ReturnUndefChecker : Checker<"UndefReturn">,
289   HelpText<"Check for uninitialized values being returned to the caller">,
290   Documentation<HasDocumentation>;
291
292 } // end "core.uninitialized"
293
294 //===----------------------------------------------------------------------===//
295 // C++ checkers.
296 //===----------------------------------------------------------------------===//
297
298 let ParentPackage = Cplusplus in {
299
300 def InnerPointerChecker : Checker<"InnerPointer">,
301   HelpText<"Check for inner pointers of C++ containers used after "
302            "re/deallocation">,
303   Documentation<NotDocumented>;
304
305 def NewDeleteChecker : Checker<"NewDelete">,
306   HelpText<"Check for double-free and use-after-free problems. Traces memory "
307            "managed by new/delete.">,
308   Documentation<HasDocumentation>;
309
310 def NewDeleteLeaksChecker : Checker<"NewDeleteLeaks">,
311   HelpText<"Check for memory leaks. Traces memory managed by new/delete.">,
312   Documentation<HasDocumentation>;
313
314 def CXXSelfAssignmentChecker : Checker<"SelfAssignment">,
315   HelpText<"Checks C++ copy and move assignment operators for self assignment">,
316   Documentation<NotDocumented>;
317
318 def MoveChecker: Checker<"Move">,
319    HelpText<"Find use-after-move bugs in C++">,
320   Documentation<HasDocumentation>;
321
322 } // end: "cplusplus"
323
324 let ParentPackage = CplusplusOptIn in {
325
326 def VirtualCallChecker : Checker<"VirtualCall">,
327   HelpText<"Check virtual function calls during construction or destruction">,
328   Documentation<HasDocumentation>;
329
330 } // end: "optin.cplusplus"
331
332 let ParentPackage = CplusplusAlpha in {
333
334 def DeleteWithNonVirtualDtorChecker : Checker<"DeleteWithNonVirtualDtor">,
335   HelpText<"Reports destructions of polymorphic objects with a non-virtual "
336            "destructor in their base class">,
337   Documentation<HasAlphaDocumentation>;
338
339 def EnumCastOutOfRangeChecker : Checker<"EnumCastOutOfRange">,
340   HelpText<"Check integer to enumeration casts for out of range values">,
341   Documentation<HasAlphaDocumentation>;
342
343 def InvalidatedIteratorChecker : Checker<"InvalidatedIterator">,
344   HelpText<"Check for use of invalidated iterators">,
345   Documentation<HasAlphaDocumentation>;
346
347 def IteratorRangeChecker : Checker<"IteratorRange">,
348   HelpText<"Check for iterators used outside their valid ranges">,
349   Documentation<HasAlphaDocumentation>;
350
351 def MismatchedIteratorChecker : Checker<"MismatchedIterator">,
352   HelpText<"Check for use of iterators of different containers where iterators "
353            "of the same container are expected">,
354   Documentation<HasAlphaDocumentation>;
355
356 def UninitializedObjectChecker: Checker<"UninitializedObject">,
357      HelpText<"Reports uninitialized fields after object construction">,
358   Documentation<HasAlphaDocumentation>;
359
360 } // end: "alpha.cplusplus"
361
362
363 //===----------------------------------------------------------------------===//
364 // Valist checkers.
365 //===----------------------------------------------------------------------===//
366
367 let ParentPackage = Valist in {
368
369 def UninitializedChecker : Checker<"Uninitialized">,
370   HelpText<"Check for usages of uninitialized (or already released) va_lists.">,
371   Documentation<NotDocumented>;
372
373 def UnterminatedChecker : Checker<"Unterminated">,
374   HelpText<"Check for va_lists which are not released by a va_end call.">,
375   Documentation<NotDocumented>;
376
377 def CopyToSelfChecker : Checker<"CopyToSelf">,
378   HelpText<"Check for va_lists which are copied onto itself.">,
379   Documentation<NotDocumented>;
380
381 } // end : "valist"
382
383 //===----------------------------------------------------------------------===//
384 // Deadcode checkers.
385 //===----------------------------------------------------------------------===//
386
387 let ParentPackage = DeadCode in {
388
389 def DeadStoresChecker : Checker<"DeadStores">,
390   HelpText<"Check for values stored to variables that are never read "
391            "afterwards">,
392   Documentation<HasDocumentation>;
393
394 } // end DeadCode
395
396 let ParentPackage = DeadCodeAlpha in {
397
398 def UnreachableCodeChecker : Checker<"UnreachableCode">,
399   HelpText<"Check unreachable code">,
400   Documentation<HasAlphaDocumentation>;
401
402 } // end "alpha.deadcode"
403
404 //===----------------------------------------------------------------------===//
405 // Performance checkers.
406 //===----------------------------------------------------------------------===//
407
408 let ParentPackage = Performance in {
409
410 def PaddingChecker : Checker<"Padding">,
411   HelpText<"Check for excessively padded structs.">,
412   Documentation<NotDocumented>;
413
414 } // end: "padding"
415
416 //===----------------------------------------------------------------------===//
417 // Security checkers.
418 //===----------------------------------------------------------------------===//
419
420 let ParentPackage = InsecureAPI in {
421
422 def bcmp : Checker<"bcmp">,
423   HelpText<"Warn on uses of the 'bcmp' function">,
424   Documentation<HasDocumentation>;
425 def bcopy : Checker<"bcopy">,
426   HelpText<"Warn on uses of the 'bcopy' function">,
427   Documentation<HasDocumentation>;
428 def bzero : Checker<"bzero">,
429   HelpText<"Warn on uses of the 'bzero' function">,
430   Documentation<HasDocumentation>;
431 def gets : Checker<"gets">,
432   HelpText<"Warn on uses of the 'gets' function">,
433   Documentation<HasDocumentation>;
434 def getpw : Checker<"getpw">,
435   HelpText<"Warn on uses of the 'getpw' function">,
436   Documentation<HasDocumentation>;
437 def mktemp : Checker<"mktemp">,
438   HelpText<"Warn on uses of the 'mktemp' function">,
439   Documentation<HasDocumentation>;
440 def mkstemp : Checker<"mkstemp">,
441   HelpText<"Warn when 'mkstemp' is passed fewer than 6 X's in the format "
442            "string">,
443   Documentation<HasDocumentation>;
444 def rand : Checker<"rand">,
445   HelpText<"Warn on uses of the 'rand', 'random', and related functions">,
446   Documentation<HasDocumentation>;
447 def strcpy : Checker<"strcpy">,
448   HelpText<"Warn on uses of the 'strcpy' and 'strcat' functions">,
449   Documentation<HasDocumentation>;
450 def vfork : Checker<"vfork">,
451   HelpText<"Warn on uses of the 'vfork' function">,
452   Documentation<HasDocumentation>;
453 def UncheckedReturn : Checker<"UncheckedReturn">,
454   HelpText<"Warn on uses of functions whose return values must be always "
455            "checked">,
456   Documentation<HasDocumentation>;
457
458 } // end "security.insecureAPI"
459
460 let ParentPackage = Security in {
461
462 def FloatLoopCounter : Checker<"FloatLoopCounter">,
463   HelpText<"Warn on using a floating point value as a loop counter (CERT: "
464            "FLP30-C, FLP30-CPP)">,
465   Documentation<HasDocumentation>;
466
467 } // end "security"
468
469 let ParentPackage = SecurityAlpha in {
470
471 def ArrayBoundChecker : Checker<"ArrayBound">,
472   HelpText<"Warn about buffer overflows (older checker)">,
473   Documentation<HasAlphaDocumentation>;
474
475 def ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">,
476   HelpText<"Warn about buffer overflows (newer checker)">,
477   Documentation<HasAlphaDocumentation>;
478
479 def ReturnPointerRangeChecker : Checker<"ReturnPtrRange">,
480   HelpText<"Check for an out-of-bound pointer being returned to callers">,
481   Documentation<HasAlphaDocumentation>;
482
483 def MallocOverflowSecurityChecker : Checker<"MallocOverflow">,
484   HelpText<"Check for overflows in the arguments to malloc()">,
485   Documentation<HasAlphaDocumentation>;
486
487 // Operating systems specific PROT_READ/PROT_WRITE values is not implemented,
488 // the defaults are correct for several common operating systems though,
489 // but may need to be overridden via the related analyzer-config flags.
490 def MmapWriteExecChecker : Checker<"MmapWriteExec">,
491   HelpText<"Warn on mmap() calls that are both writable and executable">,
492   Documentation<HasAlphaDocumentation>;
493
494 } // end "alpha.security"
495
496 //===----------------------------------------------------------------------===//
497 // Taint checkers.
498 //===----------------------------------------------------------------------===//
499
500 let ParentPackage = Taint in {
501
502 def GenericTaintChecker : Checker<"TaintPropagation">,
503   HelpText<"Generate taint information used by other checkers">,
504   Documentation<HasAlphaDocumentation>;
505
506 } // end "alpha.security.taint"
507
508 //===----------------------------------------------------------------------===//
509 // Unix API checkers.
510 //===----------------------------------------------------------------------===//
511
512 let ParentPackage = Unix in {
513
514 def UnixAPIMisuseChecker : Checker<"API">,
515   HelpText<"Check calls to various UNIX/Posix functions">,
516   Documentation<HasDocumentation>;
517
518 def MallocChecker: Checker<"Malloc">,
519   HelpText<"Check for memory leaks, double free, and use-after-free problems. "
520            "Traces memory managed by malloc()/free().">,
521   Documentation<HasDocumentation>;
522
523 def MallocSizeofChecker : Checker<"MallocSizeof">,
524   HelpText<"Check for dubious malloc arguments involving sizeof">,
525   Documentation<HasDocumentation>;
526
527 def MismatchedDeallocatorChecker : Checker<"MismatchedDeallocator">,
528   HelpText<"Check for mismatched deallocators.">,
529   Documentation<HasDocumentation>;
530
531 def VforkChecker : Checker<"Vfork">,
532   HelpText<"Check for proper usage of vfork">,
533   Documentation<HasDocumentation>;
534
535 } // end "unix"
536
537 let ParentPackage = UnixAlpha in {
538
539 def ChrootChecker : Checker<"Chroot">,
540   HelpText<"Check improper use of chroot">,
541   Documentation<HasAlphaDocumentation>;
542
543 def PthreadLockChecker : Checker<"PthreadLock">,
544   HelpText<"Simple lock -> unlock checker">,
545   Documentation<HasAlphaDocumentation>;
546
547 def StreamChecker : Checker<"Stream">,
548   HelpText<"Check stream handling functions">,
549   Documentation<HasAlphaDocumentation>;
550
551 def SimpleStreamChecker : Checker<"SimpleStream">,
552   HelpText<"Check for misuses of stream APIs">,
553   Documentation<HasAlphaDocumentation>;
554
555 def BlockInCriticalSectionChecker : Checker<"BlockInCriticalSection">,
556   HelpText<"Check for calls to blocking functions inside a critical section">,
557   Documentation<HasAlphaDocumentation>;
558
559 } // end "alpha.unix"
560
561 let ParentPackage = CString in {
562
563 def CStringNullArg : Checker<"NullArg">,
564   HelpText<"Check for null pointers being passed as arguments to C string "
565            "functions">,
566   Documentation<HasDocumentation>;
567
568 def CStringSyntaxChecker : Checker<"BadSizeArg">,
569   HelpText<"Check the size argument passed into C string functions for common "
570            "erroneous patterns">,
571   Documentation<HasDocumentation>;
572
573 } // end "unix.cstring"
574
575 let ParentPackage = CStringAlpha in {
576
577 def CStringOutOfBounds : Checker<"OutOfBounds">,
578   HelpText<"Check for out-of-bounds access in string functions">,
579   Documentation<HasAlphaDocumentation>;
580
581 def CStringBufferOverlap : Checker<"BufferOverlap">,
582   HelpText<"Checks for overlap in two buffer arguments">,
583   Documentation<HasAlphaDocumentation>;
584
585 def CStringNotNullTerm : Checker<"NotNullTerminated">,
586   HelpText<"Check for arguments which are not null-terminating strings">,
587   Documentation<HasAlphaDocumentation>;
588
589 } // end "alpha.unix.cstring"
590
591 //===----------------------------------------------------------------------===//
592 // Mac OS X, Cocoa, and Core Foundation checkers.
593 //===----------------------------------------------------------------------===//
594
595 let ParentPackage = OSX in {
596
597 def NumberObjectConversionChecker : Checker<"NumberObjectConversion">,
598   HelpText<"Check for erroneous conversions of objects representing numbers "
599            "into numbers">,
600   Documentation<NotDocumented>;
601
602 def MacOSXAPIChecker : Checker<"API">,
603   HelpText<"Check for proper uses of various Apple APIs">,
604   Documentation<HasDocumentation>;
605
606 def MacOSKeychainAPIChecker : Checker<"SecKeychainAPI">,
607   HelpText<"Check for proper uses of Secure Keychain APIs">,
608   Documentation<HasDocumentation>;
609
610 def ObjCPropertyChecker : Checker<"ObjCProperty">,
611   HelpText<"Check for proper uses of Objective-C properties">,
612   Documentation<NotDocumented>;
613
614 def OSObjectRetainCountChecker : Checker<"OSObjectRetainCount">,
615   HelpText<"Check for leaks and improper reference count management for OSObject">,
616   Documentation<NotDocumented>;
617
618 } // end "osx"
619
620 let ParentPackage = Cocoa in {
621
622 def RunLoopAutoreleaseLeakChecker : Checker<"RunLoopAutoreleaseLeak">,
623   HelpText<"Check for leaked memory in autorelease pools that will never be "
624            "drained">,
625   Documentation<NotDocumented>;
626
627 def ObjCAtSyncChecker : Checker<"AtSync">,
628   HelpText<"Check for nil pointers used as mutexes for @synchronized">,
629   Documentation<HasDocumentation>;
630
631 def NilArgChecker : Checker<"NilArg">,
632   HelpText<"Check for prohibited nil arguments to ObjC method calls">,
633   Documentation<HasDocumentation>;
634
635 def ClassReleaseChecker : Checker<"ClassRelease">,
636   HelpText<"Check for sending 'retain', 'release', or 'autorelease' directly "
637            "to a Class">,
638   Documentation<HasDocumentation>;
639
640 def VariadicMethodTypeChecker : Checker<"VariadicMethodTypes">,
641   HelpText<"Check for passing non-Objective-C types to variadic collection "
642            "initialization methods that expect only Objective-C types">,
643   Documentation<HasDocumentation>;
644
645 def NSAutoreleasePoolChecker : Checker<"NSAutoreleasePool">,
646   HelpText<"Warn for suboptimal uses of NSAutoreleasePool in Objective-C GC "
647            "mode">,
648   Documentation<HasDocumentation>;
649
650 def ObjCMethSigsChecker : Checker<"IncompatibleMethodTypes">,
651   HelpText<"Warn about Objective-C method signatures with type "
652            "incompatibilities">,
653   Documentation<HasDocumentation>;
654
655 def ObjCUnusedIvarsChecker : Checker<"UnusedIvars">,
656   HelpText<"Warn about private ivars that are never used">,
657   Documentation<HasDocumentation>;
658
659 def ObjCSelfInitChecker : Checker<"SelfInit">,
660   HelpText<"Check that 'self' is properly initialized inside an initializer "
661            "method">,
662   Documentation<HasDocumentation>;
663
664 def ObjCLoopChecker : Checker<"Loops">,
665   HelpText<"Improved modeling of loops using Cocoa collection types">,
666   Documentation<NotDocumented>;
667
668 def ObjCNonNilReturnValueChecker : Checker<"NonNilReturnValue">,
669   HelpText<"Model the APIs that are guaranteed to return a non-nil value">,
670   Documentation<NotDocumented>;
671
672 def ObjCSuperCallChecker : Checker<"MissingSuperCall">,
673   HelpText<"Warn about Objective-C methods that lack a necessary call to "
674            "super">,
675   Documentation<NotDocumented>;
676
677 def NSErrorChecker : Checker<"NSError">,
678   HelpText<"Check usage of NSError** parameters">,
679   Documentation<HasDocumentation>;
680
681 def RetainCountChecker : Checker<"RetainCount">,
682   HelpText<"Check for leaks and improper reference count management">,
683   Documentation<HasDocumentation>;
684
685 def ObjCGenericsChecker : Checker<"ObjCGenerics">,
686   HelpText<"Check for type errors when using Objective-C generics">,
687   Documentation<HasDocumentation>;
688
689 def ObjCDeallocChecker : Checker<"Dealloc">,
690   HelpText<"Warn about Objective-C classes that lack a correct implementation "
691            "of -dealloc">,
692   Documentation<HasDocumentation>;
693
694 def ObjCSuperDeallocChecker : Checker<"SuperDealloc">,
695   HelpText<"Warn about improper use of '[super dealloc]' in Objective-C">,
696   Documentation<HasDocumentation>;
697
698 def AutoreleaseWriteChecker : Checker<"AutoreleaseWrite">,
699   HelpText<"Warn about potentially crashing writes to autoreleasing objects "
700            "from different autoreleasing pools in Objective-C">,
701   Documentation<NotDocumented>;
702
703 } // end "osx.cocoa"
704
705 let ParentPackage = Performance in {
706
707 def GCDAntipattern : Checker<"GCDAntipattern">,
708   HelpText<"Check for performance anti-patterns when using Grand Central "
709            "Dispatch">,
710   Documentation<NotDocumented>;
711 } // end "optin.performance"
712
713 let ParentPackage = CocoaAlpha in {
714
715 def InstanceVariableInvalidation : Checker<"InstanceVariableInvalidation">,
716   HelpText<"Check that the invalidatable instance variables are invalidated in "
717            "the methods annotated with objc_instance_variable_invalidator">,
718   Documentation<HasAlphaDocumentation>;
719
720 def MissingInvalidationMethod : Checker<"MissingInvalidationMethod">,
721   HelpText<"Check that the invalidation methods are present in classes that "
722            "contain invalidatable instance variables">,
723   Documentation<HasAlphaDocumentation>;
724
725 def DirectIvarAssignment : Checker<"DirectIvarAssignment">,
726   HelpText<"Check for direct assignments to instance variables">,
727   Documentation<HasAlphaDocumentation>;
728
729 def DirectIvarAssignmentForAnnotatedFunctions :
730   Checker<"DirectIvarAssignmentForAnnotatedFunctions">,
731   HelpText<"Check for direct assignments to instance variables in the methods "
732            "annotated with objc_no_direct_instance_variable_assignment">,
733   Documentation<HasAlphaDocumentation>;
734
735 } // end "alpha.osx.cocoa"
736
737 let ParentPackage = CoreFoundation in {
738
739 def CFNumberChecker : Checker<"CFNumber">,
740   HelpText<"Check for proper uses of CFNumber APIs">,
741   Documentation<HasDocumentation>;
742
743 def CFRetainReleaseChecker : Checker<"CFRetainRelease">,
744   HelpText<"Check for null arguments to CFRetain/CFRelease/CFMakeCollectable">,
745   Documentation<HasDocumentation>;
746
747 def CFErrorChecker : Checker<"CFError">,
748   HelpText<"Check usage of CFErrorRef* parameters">,
749   Documentation<HasDocumentation>;
750
751 } // end "osx.coreFoundation"
752
753 let ParentPackage = Containers in {
754
755 def ObjCContainersASTChecker : Checker<"PointerSizedValues">,
756   HelpText<"Warns if 'CFArray', 'CFDictionary', 'CFSet' are created with "
757            "non-pointer-size values">,
758   Documentation<HasDocumentation>;
759
760 def ObjCContainersChecker : Checker<"OutOfBounds">,
761   HelpText<"Checks for index out-of-bounds when using 'CFArray' API">,
762   Documentation<HasDocumentation>;
763
764 } // end "osx.coreFoundation.containers"
765
766 let ParentPackage = LocalizabilityOptIn in {
767
768 def NonLocalizedStringChecker : Checker<"NonLocalizedStringChecker">,
769   HelpText<"Warns about uses of non-localized NSStrings passed to UI methods "
770            "expecting localized NSStrings">,
771   Documentation<HasDocumentation>;
772
773 def EmptyLocalizationContextChecker :
774   Checker<"EmptyLocalizationContextChecker">,
775   HelpText<"Check that NSLocalizedString macros include a comment for context">,
776   Documentation<HasDocumentation>;
777
778 } // end "optin.osx.cocoa.localizability"
779
780 let ParentPackage = LocalizabilityAlpha in {
781
782 def PluralMisuseChecker : Checker<"PluralMisuseChecker">,
783   HelpText<"Warns against using one vs. many plural pattern in code when "
784            "generating localized strings.">,
785   Documentation<HasAlphaDocumentation>;
786
787 } // end "alpha.osx.cocoa.localizability"
788
789 let ParentPackage = MPI in {
790
791 def MPIChecker : Checker<"MPI-Checker">,
792   HelpText<"Checks MPI code">,
793   Documentation<HasDocumentation>;
794
795 } // end "optin.mpi"
796
797 //===----------------------------------------------------------------------===//
798 // Checkers for LLVM development.
799 //===----------------------------------------------------------------------===//
800
801 let ParentPackage = LLVMAlpha in {
802
803 def LLVMConventionsChecker : Checker<"Conventions">,
804   HelpText<"Check code for LLVM codebase conventions">,
805   Documentation<HasAlphaDocumentation>;
806
807 } // end "llvm"
808
809 //===----------------------------------------------------------------------===//
810 // Checkers modeling Google APIs.
811 //===----------------------------------------------------------------------===//
812
813 let ParentPackage = GoogleAPIModeling in {
814
815 def GTestChecker : Checker<"GTest">,
816   HelpText<"Model gtest assertion APIs">,
817   Documentation<NotDocumented>;
818
819 } // end "apiModeling.google"
820
821 //===----------------------------------------------------------------------===//
822 // Debugging checkers (for analyzer development).
823 //===----------------------------------------------------------------------===//
824
825 let ParentPackage = Debug in {
826
827 def AnalysisOrderChecker : Checker<"AnalysisOrder">,
828   HelpText<"Print callbacks that are called during analysis in order">,
829   Documentation<NotDocumented>;
830
831 def DominatorsTreeDumper : Checker<"DumpDominators">,
832   HelpText<"Print the dominance tree for a given CFG">,
833   Documentation<NotDocumented>;
834
835 def LiveVariablesDumper : Checker<"DumpLiveVars">,
836   HelpText<"Print results of live variable analysis">,
837   Documentation<NotDocumented>;
838
839 def LiveStatementsDumper : Checker<"DumpLiveStmts">,
840   HelpText<"Print results of live statement analysis">,
841   Documentation<NotDocumented>;
842
843 def CFGViewer : Checker<"ViewCFG">,
844   HelpText<"View Control-Flow Graphs using GraphViz">,
845   Documentation<NotDocumented>;
846
847 def CFGDumper : Checker<"DumpCFG">,
848   HelpText<"Display Control-Flow Graphs">,
849   Documentation<NotDocumented>;
850
851 def CallGraphViewer : Checker<"ViewCallGraph">,
852   HelpText<"View Call Graph using GraphViz">,
853   Documentation<NotDocumented>;
854
855 def CallGraphDumper : Checker<"DumpCallGraph">,
856   HelpText<"Display Call Graph">,
857   Documentation<NotDocumented>;
858
859 def ConfigDumper : Checker<"ConfigDumper">,
860   HelpText<"Dump config table">,
861   Documentation<NotDocumented>;
862
863 def TraversalDumper : Checker<"DumpTraversal">,
864   HelpText<"Print branch conditions as they are traversed by the engine">,
865   Documentation<NotDocumented>;
866
867 def CallDumper : Checker<"DumpCalls">,
868   HelpText<"Print calls as they are traversed by the engine">,
869   Documentation<NotDocumented>;
870
871 def AnalyzerStatsChecker : Checker<"Stats">,
872   HelpText<"Emit warnings with analyzer statistics">,
873   Documentation<NotDocumented>;
874
875 def TaintTesterChecker : Checker<"TaintTest">,
876   HelpText<"Mark tainted symbols as such.">,
877   Documentation<NotDocumented>;
878
879 def ExprInspectionChecker : Checker<"ExprInspection">,
880   HelpText<"Check the analyzer's understanding of expressions">,
881   Documentation<NotDocumented>;
882
883 def ExplodedGraphViewer : Checker<"ViewExplodedGraph">,
884   HelpText<"View Exploded Graphs using GraphViz">,
885   Documentation<NotDocumented>;
886
887 } // end "debug"
888
889
890 //===----------------------------------------------------------------------===//
891 // Clone Detection
892 //===----------------------------------------------------------------------===//
893
894 let ParentPackage = CloneDetectionAlpha in {
895
896 def CloneChecker : Checker<"CloneChecker">,
897   HelpText<"Reports similar pieces of code.">,
898   Documentation<HasAlphaDocumentation>;
899
900 } // end "clone"
901
902 //===----------------------------------------------------------------------===//
903 // Portability checkers.
904 //===----------------------------------------------------------------------===//
905
906 let ParentPackage = PortabilityOptIn in {
907
908 def UnixAPIPortabilityChecker : Checker<"UnixAPI">,
909   HelpText<"Finds implementation-defined behavior in UNIX/Posix functions">,
910   Documentation<NotDocumented>;
911
912 } // end optin.portability