1//===--- Checkers.td - Static Analyzer Checkers -===-----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9include "CheckerBase.td"
10
11//===----------------------------------------------------------------------===//
12// Packages.
13//===----------------------------------------------------------------------===//
14
15// The Alpha package is for checkers that have too many false positives to be
16// turned on by default. The hierarchy under Alpha should be organized in the
17// hierarchy checkers would have had if they were truly at the top level.
18// (For example, a Cocoa-specific checker that is alpha should be in
19// alpha.osx.cocoa).
20def Alpha : Package<"alpha">;
21
22def Core : Package<"core">;
23def CoreBuiltin : Package<"builtin">, ParentPackage<Core>, Hidden;
24def CoreUninitialized  : Package<"uninitialized">, ParentPackage<Core>;
25def CoreAlpha : Package<"core">, ParentPackage<Alpha>;
26
27// The OptIn package is for checkers that are not alpha and that would normally
28// be on by default but where the driver does not have enough information to
29// determine when they are applicable. For example, localizability checkers fit
30// this criterion because the driver cannot determine whether a project is
31// localized or not -- this is best determined at the IDE or build-system level.
32//
33// The checker hierarchy under OptIn should mirror that in Alpha: checkers
34// should be organized as if they were at the top level.
35//
36// Note: OptIn is *not* intended for checkers that are too noisy to be on by
37// default. Such checkers belong in the alpha package.
38def OptIn : Package<"optin">;
39
40// In the Portability package reside checkers for finding code that relies on
41// implementation-defined behavior. Such checks are wanted for cross-platform
42// development, but unwanted for developers who target only a single platform.
43def PortabilityOptIn : Package<"portability">, ParentPackage<OptIn>;
44
45def Nullability : Package<"nullability">,
46  PackageOptions<[
47    CmdLineOption<Boolean,
48                  "NoDiagnoseCallsToSystemHeaders",
49                  "Suppresses warnings for violating nullability annotations "
50                  "of system header functions. This is useful if you are "
51                  "concerned with your custom nullability annotations more "
52                  "than with following nullability specifications of system "
53                  "header functions.",
54                  "false",
55                  Released>
56  ]>;
57
58def Cplusplus : Package<"cplusplus">;
59def CplusplusAlpha : Package<"cplusplus">, ParentPackage<Alpha>;
60def CplusplusOptIn : Package<"cplusplus">, ParentPackage<OptIn>;
61
62def Valist : Package<"valist">;
63
64def DeadCode : Package<"deadcode">;
65def DeadCodeAlpha : Package<"deadcode">, ParentPackage<Alpha>;
66
67def Performance : Package<"performance">, ParentPackage<OptIn>;
68
69def Security : Package <"security">;
70def InsecureAPI : Package<"insecureAPI">, ParentPackage<Security>;
71def SecurityAlpha : Package<"security">, ParentPackage<Alpha>;
72def Taint : Package<"taint">, ParentPackage<SecurityAlpha>;
73
74def Unix : Package<"unix">;
75def UnixAlpha : Package<"unix">, ParentPackage<Alpha>;
76def CString : Package<"cstring">, ParentPackage<Unix>;
77def CStringAlpha : Package<"cstring">, ParentPackage<UnixAlpha>;
78
79def OSX : Package<"osx">;
80def OSXAlpha : Package<"osx">, ParentPackage<Alpha>;
81def OSXOptIn : Package<"osx">, ParentPackage<OptIn>;
82
83def Cocoa : Package<"cocoa">, ParentPackage<OSX>;
84def CocoaAlpha : Package<"cocoa">, ParentPackage<OSXAlpha>;
85def CocoaOptIn : Package<"cocoa">, ParentPackage<OSXOptIn>;
86
87def CoreFoundation : Package<"coreFoundation">, ParentPackage<OSX>;
88def Containers : Package<"containers">, ParentPackage<CoreFoundation>;
89
90def LocalizabilityAlpha : Package<"localizability">, ParentPackage<CocoaAlpha>;
91def LocalizabilityOptIn : Package<"localizability">, ParentPackage<CocoaOptIn>;
92
93def MPI : Package<"mpi">, ParentPackage<OptIn>;
94
95def LLVM : Package<"llvm">;
96def LLVMAlpha : Package<"llvm">, ParentPackage<Alpha>;
97
98// The APIModeling package is for checkers that model APIs and don't perform
99// any diagnostics. These checkers are always turned on; this package is
100// intended for API modeling that is not controlled by the target triple.
101def APIModeling : Package<"apiModeling">, Hidden;
102def GoogleAPIModeling : Package<"google">, ParentPackage<APIModeling>, Hidden;
103def LLVMAPIModeling : Package<"llvm">, ParentPackage<APIModeling>, Hidden;
104
105def Debug : Package<"debug">, Hidden;
106
107def CloneDetectionAlpha : Package<"clone">, ParentPackage<Alpha>;
108
109def NonDeterminismAlpha : Package<"nondeterminism">, ParentPackage<Alpha>;
110
111def Fuchsia : Package<"fuchsia">;
112
113//===----------------------------------------------------------------------===//
114// Core Checkers.
115//===----------------------------------------------------------------------===//
116
117let ParentPackage = Core in {
118
119def DereferenceChecker : Checker<"NullDereference">,
120  HelpText<"Check for dereferences of null pointers">,
121  Documentation<HasDocumentation>;
122
123def CallAndMessageChecker : Checker<"CallAndMessage">,
124  HelpText<"Check for logical errors for function calls and Objective-C "
125           "message expressions (e.g., uninitialized arguments, null function "
126           "pointers)">,
127  Documentation<HasDocumentation>;
128
129def NonNullParamChecker : Checker<"NonNullParamChecker">,
130  HelpText<"Check for null pointers passed as arguments to a function whose "
131           "arguments are references or marked with the 'nonnull' attribute">,
132  Documentation<HasDocumentation>;
133
134def VLASizeChecker : Checker<"VLASize">,
135  HelpText<"Check for declarations of VLA of undefined or zero size">,
136  Documentation<HasDocumentation>;
137
138def DivZeroChecker : Checker<"DivideZero">,
139  HelpText<"Check for division by zero">,
140  Documentation<HasDocumentation>;
141
142def UndefResultChecker : Checker<"UndefinedBinaryOperatorResult">,
143  HelpText<"Check for undefined results of binary operators">,
144  Documentation<HasDocumentation>;
145
146def StackAddrEscapeBase : Checker<"StackAddrEscapeBase">,
147  HelpText<"Generate information about stack address escapes.">,
148  Documentation<NotDocumented>,
149  Hidden;
150
151def StackAddrEscapeChecker : Checker<"StackAddressEscape">,
152  HelpText<"Check that addresses to stack memory do not escape the function">,
153  Dependencies<[StackAddrEscapeBase]>,
154  Documentation<HasDocumentation>;
155
156def DynamicTypePropagation : Checker<"DynamicTypePropagation">,
157  HelpText<"Generate dynamic type information">,
158  Documentation<NotDocumented>;
159
160def NonnullGlobalConstantsChecker: Checker<"NonnilStringConstants">,
161  HelpText<"Assume that const string-like globals are non-null">,
162  Documentation<NotDocumented>,
163  Hidden;
164
165} // end "core"
166
167let ParentPackage = CoreAlpha in {
168
169def BoolAssignmentChecker : Checker<"BoolAssignment">,
170  HelpText<"Warn about assigning non-{0,1} values to Boolean variables">,
171  Documentation<HasAlphaDocumentation>;
172
173def CastSizeChecker : Checker<"CastSize">,
174  HelpText<"Check when casting a malloc'ed type T, whether the size is a "
175           "multiple of the size of T">,
176  Documentation<HasAlphaDocumentation>;
177
178def CastToStructChecker : Checker<"CastToStruct">,
179  HelpText<"Check for cast from non-struct pointer to struct pointer">,
180  Documentation<HasAlphaDocumentation>;
181
182def ConversionChecker : Checker<"Conversion">,
183  HelpText<"Loss of sign/precision in implicit conversions">,
184  Documentation<HasAlphaDocumentation>;
185
186def IdenticalExprChecker : Checker<"IdenticalExpr">,
187  HelpText<"Warn about unintended use of identical expressions in operators">,
188  Documentation<HasAlphaDocumentation>;
189
190def FixedAddressChecker : Checker<"FixedAddr">,
191  HelpText<"Check for assignment of a fixed address to a pointer">,
192  Documentation<HasAlphaDocumentation>;
193
194def PointerArithChecker : Checker<"PointerArithm">,
195  HelpText<"Check for pointer arithmetic on locations other than array "
196           "elements">,
197  Documentation<HasAlphaDocumentation>;
198
199def PointerSubChecker : Checker<"PointerSub">,
200  HelpText<"Check for pointer subtractions on two pointers pointing to "
201           "different memory chunks">,
202  Documentation<HasAlphaDocumentation>;
203
204def SizeofPointerChecker : Checker<"SizeofPtr">,
205  HelpText<"Warn about unintended use of sizeof() on pointer expressions">,
206  Documentation<HasAlphaDocumentation>;
207
208def CallAndMessageUnInitRefArg : Checker<"CallAndMessageUnInitRefArg">,
209  HelpText<"Check for logical errors for function calls and Objective-C "
210           "message expressions (e.g., uninitialized arguments, null function "
211           "pointers, and pointer to undefined variables)">,
212  Dependencies<[CallAndMessageChecker]>,
213  Documentation<HasAlphaDocumentation>;
214
215def TestAfterDivZeroChecker : Checker<"TestAfterDivZero">,
216  HelpText<"Check for division by variable that is later compared against 0. "
217           "Either the comparison is useless or there is division by zero.">,
218  Documentation<HasAlphaDocumentation>;
219
220def DynamicTypeChecker : Checker<"DynamicTypeChecker">,
221  HelpText<"Check for cases where the dynamic and the static type of an object "
222           "are unrelated.">,
223  Documentation<HasAlphaDocumentation>;
224
225def StackAddrAsyncEscapeChecker : Checker<"StackAddressAsyncEscape">,
226  HelpText<"Check that addresses to stack memory do not escape the function">,
227  Dependencies<[StackAddrEscapeBase]>,
228  Documentation<HasAlphaDocumentation>;
229
230} // end "alpha.core"
231
232//===----------------------------------------------------------------------===//
233// Nullability checkers.
234//===----------------------------------------------------------------------===//
235
236let ParentPackage = Nullability in {
237
238def NullabilityBase : Checker<"NullabilityBase">,
239  HelpText<"Stores information during the analysis about nullability.">,
240  Documentation<NotDocumented>,
241  Hidden;
242
243def NullPassedToNonnullChecker : Checker<"NullPassedToNonnull">,
244  HelpText<"Warns when a null pointer is passed to a pointer which has a "
245           "_Nonnull type.">,
246  Dependencies<[NullabilityBase]>,
247  Documentation<HasDocumentation>;
248
249def NullReturnedFromNonnullChecker : Checker<"NullReturnedFromNonnull">,
250  HelpText<"Warns when a null pointer is returned from a function that has "
251           "_Nonnull return type.">,
252  Dependencies<[NullabilityBase]>,
253  Documentation<HasDocumentation>;
254
255def NullableDereferencedChecker : Checker<"NullableDereferenced">,
256  HelpText<"Warns when a nullable pointer is dereferenced.">,
257  Dependencies<[NullabilityBase]>,
258  Documentation<HasDocumentation>;
259
260def NullablePassedToNonnullChecker : Checker<"NullablePassedToNonnull">,
261  HelpText<"Warns when a nullable pointer is passed to a pointer which has a "
262           "_Nonnull type.">,
263  Dependencies<[NullabilityBase]>,
264  Documentation<HasDocumentation>;
265
266def NullableReturnedFromNonnullChecker : Checker<"NullableReturnedFromNonnull">,
267  HelpText<"Warns when a nullable pointer is returned from a function that has "
268           "_Nonnull return type.">,
269  Dependencies<[NullabilityBase]>,
270  Documentation<NotDocumented>;
271
272} // end "nullability"
273
274//===----------------------------------------------------------------------===//
275// APIModeling.
276//===----------------------------------------------------------------------===//
277
278let ParentPackage = APIModeling in {
279
280def StdCLibraryFunctionsChecker : Checker<"StdCLibraryFunctions">,
281  HelpText<"Improve modeling of the C standard library functions">,
282  Documentation<NotDocumented>;
283
284def TrustNonnullChecker : Checker<"TrustNonnull">,
285  HelpText<"Trust that returns from framework methods annotated with _Nonnull "
286           "are not null">,
287  Documentation<NotDocumented>;
288
289} // end "apiModeling"
290
291//===----------------------------------------------------------------------===//
292// Evaluate "builtin" functions.
293//===----------------------------------------------------------------------===//
294
295let ParentPackage = CoreBuiltin in {
296
297def NoReturnFunctionChecker : Checker<"NoReturnFunctions">,
298  HelpText<"Evaluate \"panic\" functions that are known to not return to the "
299           "caller">,
300  Documentation<NotDocumented>;
301
302def BuiltinFunctionChecker : Checker<"BuiltinFunctions">,
303  HelpText<"Evaluate compiler builtin functions (e.g., alloca())">,
304  Documentation<NotDocumented>;
305
306} // end "core.builtin"
307
308//===----------------------------------------------------------------------===//
309// Uninitialized values checkers.
310//===----------------------------------------------------------------------===//
311
312let ParentPackage = CoreUninitialized in {
313
314def UndefinedArraySubscriptChecker : Checker<"ArraySubscript">,
315  HelpText<"Check for uninitialized values used as array subscripts">,
316  Documentation<HasDocumentation>;
317
318def UndefinedAssignmentChecker : Checker<"Assign">,
319  HelpText<"Check for assigning uninitialized values">,
320  Documentation<HasDocumentation>;
321
322def UndefBranchChecker : Checker<"Branch">,
323  HelpText<"Check for uninitialized values used as branch conditions">,
324  Documentation<HasDocumentation>;
325
326def UndefCapturedBlockVarChecker : Checker<"CapturedBlockVariable">,
327  HelpText<"Check for blocks that capture uninitialized values">,
328  Documentation<NotDocumented>;
329
330def ReturnUndefChecker : Checker<"UndefReturn">,
331  HelpText<"Check for uninitialized values being returned to the caller">,
332  Documentation<HasDocumentation>;
333
334} // end "core.uninitialized"
335
336//===----------------------------------------------------------------------===//
337// Unix API checkers.
338//===----------------------------------------------------------------------===//
339
340let ParentPackage = CString in {
341
342def CStringModeling : Checker<"CStringModeling">,
343  HelpText<"The base of several CString related checkers. On it's own it emits "
344           "no reports, but adds valuable information to the analysis when "
345           "enabled.">,
346  Documentation<NotDocumented>,
347  Hidden;
348
349def CStringNullArg : Checker<"NullArg">,
350  HelpText<"Check for null pointers being passed as arguments to C string "
351           "functions">,
352  Dependencies<[CStringModeling]>,
353  Documentation<HasDocumentation>;
354
355def CStringSyntaxChecker : Checker<"BadSizeArg">,
356  HelpText<"Check the size argument passed into C string functions for common "
357           "erroneous patterns">,
358  Dependencies<[CStringModeling]>,
359  Documentation<HasDocumentation>;
360
361} // end "unix.cstring"
362
363let ParentPackage = CStringAlpha in {
364
365def CStringOutOfBounds : Checker<"OutOfBounds">,
366  HelpText<"Check for out-of-bounds access in string functions">,
367  Dependencies<[CStringModeling]>,
368  Documentation<HasAlphaDocumentation>;
369
370def CStringBufferOverlap : Checker<"BufferOverlap">,
371  HelpText<"Checks for overlap in two buffer arguments">,
372  Dependencies<[CStringModeling]>,
373  Documentation<HasAlphaDocumentation>;
374
375def CStringNotNullTerm : Checker<"NotNullTerminated">,
376  HelpText<"Check for arguments which are not null-terminating strings">,
377  Dependencies<[CStringModeling]>,
378  Documentation<HasAlphaDocumentation>;
379
380} // end "alpha.unix.cstring"
381
382let ParentPackage = Unix in {
383
384def UnixAPIMisuseChecker : Checker<"API">,
385  HelpText<"Check calls to various UNIX/Posix functions">,
386  Documentation<HasDocumentation>;
387
388def DynamicMemoryModeling: Checker<"DynamicMemoryModeling">,
389  HelpText<"The base of several malloc() related checkers. On it's own it "
390           "emits no reports, but adds valuable information to the analysis "
391           "when enabled.">,
392  CheckerOptions<[
393    CmdLineOption<Boolean,
394                  "Optimistic",
395                  "If set to true, the checker assumes that all the "
396                  "allocating and deallocating functions are annotated with "
397                  "ownership_holds, ownership_takes and ownership_returns.",
398                  "false",
399                  InAlpha>
400  ]>,
401  Dependencies<[CStringModeling]>,
402  Documentation<NotDocumented>,
403  Hidden;
404
405def MallocChecker: Checker<"Malloc">,
406  HelpText<"Check for memory leaks, double free, and use-after-free problems. "
407           "Traces memory managed by malloc()/free().">,
408  Dependencies<[DynamicMemoryModeling]>,
409  Documentation<HasDocumentation>;
410
411def MallocSizeofChecker : Checker<"MallocSizeof">,
412  HelpText<"Check for dubious malloc arguments involving sizeof">,
413  Documentation<HasDocumentation>;
414
415def MismatchedDeallocatorChecker : Checker<"MismatchedDeallocator">,
416  HelpText<"Check for mismatched deallocators.">,
417  Dependencies<[DynamicMemoryModeling]>,
418  Documentation<HasDocumentation>;
419
420def VforkChecker : Checker<"Vfork">,
421  HelpText<"Check for proper usage of vfork">,
422  Documentation<HasDocumentation>;
423
424} // end "unix"
425
426let ParentPackage = UnixAlpha in {
427
428def ChrootChecker : Checker<"Chroot">,
429  HelpText<"Check improper use of chroot">,
430  Documentation<HasAlphaDocumentation>;
431
432def PthreadLockChecker : Checker<"PthreadLock">,
433  HelpText<"Simple lock -> unlock checker">,
434  Documentation<HasAlphaDocumentation>;
435
436def StreamChecker : Checker<"Stream">,
437  HelpText<"Check stream handling functions">,
438  Documentation<HasAlphaDocumentation>;
439
440def SimpleStreamChecker : Checker<"SimpleStream">,
441  HelpText<"Check for misuses of stream APIs">,
442  Documentation<HasAlphaDocumentation>;
443
444def BlockInCriticalSectionChecker : Checker<"BlockInCriticalSection">,
445  HelpText<"Check for calls to blocking functions inside a critical section">,
446  Documentation<HasAlphaDocumentation>;
447
448} // end "alpha.unix"
449
450//===----------------------------------------------------------------------===//
451// C++ checkers.
452//===----------------------------------------------------------------------===//
453
454let ParentPackage = Cplusplus in {
455
456def InnerPointerChecker : Checker<"InnerPointer">,
457  HelpText<"Check for inner pointers of C++ containers used after "
458           "re/deallocation">,
459  Dependencies<[DynamicMemoryModeling]>,
460  Documentation<NotDocumented>;
461
462def NewDeleteChecker : Checker<"NewDelete">,
463  HelpText<"Check for double-free and use-after-free problems. Traces memory "
464           "managed by new/delete.">,
465  Dependencies<[DynamicMemoryModeling]>,
466  Documentation<HasDocumentation>;
467
468def NewDeleteLeaksChecker : Checker<"NewDeleteLeaks">,
469  HelpText<"Check for memory leaks. Traces memory managed by new/delete.">,
470  Dependencies<[NewDeleteChecker]>,
471  Documentation<HasDocumentation>;
472
473def CXXSelfAssignmentChecker : Checker<"SelfAssignment">,
474  HelpText<"Checks C++ copy and move assignment operators for self assignment">,
475  Documentation<NotDocumented>,
476  Hidden;
477
478def SmartPtrModeling: Checker<"SmartPtr">,
479  HelpText<"Model behavior of C++ smart pointers">,
480  Documentation<NotDocumented>,
481  Hidden;
482
483def MoveChecker: Checker<"Move">,
484  HelpText<"Find use-after-move bugs in C++">,
485  CheckerOptions<[
486    CmdLineOption<String,
487                  "WarnOn",
488                  "In non-aggressive mode, only warn on use-after-move of "
489                  "local variables (or local rvalue references) and of STL "
490                  "objects. The former is possible because local variables (or "
491                  "local rvalue references) are not tempting their user to "
492                  "re-use the storage. The latter is possible because STL "
493                  "objects are known to end up in a valid but unspecified "
494                  "state after the move and their state-reset methods are also "
495                  "known, which allows us to predict precisely when "
496                  "use-after-move is invalid. Some STL objects are known to "
497                  "conform to additional contracts after move, so they are not "
498                  "tracked. However, smart pointers specifically are tracked "
499                  "because we can perform extra checking over them. In "
500                  "aggressive mode, warn on any use-after-move because the "
501                  "user has intentionally asked us to completely eliminate "
502                  "use-after-move in his code. Values: \"KnownsOnly\", "
503                  "\"KnownsAndLocals\", \"All\".",
504                  "KnownsAndLocals",
505                  Released>
506  ]>,
507  Documentation<HasDocumentation>;
508
509def VirtualCallModeling : Checker<"VirtualCallModeling">,
510  HelpText<"Auxiliary modeling for the virtual method call checkers">,
511  Documentation<NotDocumented>,
512  Hidden;
513
514def PureVirtualCallChecker : Checker<"PureVirtualCall">,
515  HelpText<"Check pure virtual function calls during construction/destruction">,
516  Dependencies<[VirtualCallModeling]>,
517  Documentation<HasDocumentation>;
518} // end: "cplusplus"
519
520let ParentPackage = CplusplusOptIn in {
521
522def UninitializedObjectChecker: Checker<"UninitializedObject">,
523  HelpText<"Reports uninitialized fields after object construction">,
524  CheckerOptions<[
525    CmdLineOption<Boolean,
526                  "Pedantic",
527                  "If set to false, the checker won't emit warnings "
528                  "for objects that don't have at least one initialized "
529                  "field.",
530                  "false",
531                  Released>,
532    CmdLineOption<Boolean,
533                  "NotesAsWarnings",
534                  "If set to true, the checker will emit a warning "
535                  "for each uninitalized field, as opposed to emitting one "
536                  "warning per constructor call, and listing the uninitialized "
537                  "fields that belongs to it in notes.",
538                  "false",
539                  Released,
540                  Hide>,
541    CmdLineOption<Boolean,
542                  "CheckPointeeInitialization",
543                  "If set to false, the checker will not analyze "
544                  "the pointee of pointer/reference fields, and will only "
545                  "check whether the object itself is initialized.",
546                  "false",
547                  InAlpha>,
548    CmdLineOption<String,
549                  "IgnoreRecordsWithField",
550                  "If supplied, the checker will not analyze "
551                  "structures that have a field with a name or type name that "
552                  "matches the given pattern.",
553                  "\"\"",
554                  Released>,
555    CmdLineOption<Boolean,
556                  "IgnoreGuardedFields",
557                  "If set to true, the checker will analyze _syntactically_ "
558                  "whether the found uninitialized object is used without a "
559                  "preceding assert call. Defaults to false.",
560                  "false",
561                  InAlpha>
562  ]>,
563  Documentation<HasAlphaDocumentation>;
564
565def VirtualCallChecker : Checker<"VirtualCall">,
566  HelpText<"Check virtual function calls during construction/destruction">,
567  CheckerOptions<[
568    CmdLineOption<Boolean,
569                  "ShowFixIts",
570                  "Enable fix-it hints for this checker",
571                  "false",
572                  InAlpha>,
573    CmdLineOption<Boolean,
574                  "PureOnly",
575                  "Disables the checker. Keeps cplusplus.PureVirtualCall "
576                  "enabled. This option is only provided for backwards "
577                  "compatibility.",
578                  "false",
579                  InAlpha>
580  ]>,
581  Dependencies<[VirtualCallModeling]>,
582  Documentation<HasDocumentation>;
583
584} // end: "optin.cplusplus"
585
586let ParentPackage = CplusplusAlpha in {
587
588def DeleteWithNonVirtualDtorChecker : Checker<"DeleteWithNonVirtualDtor">,
589  HelpText<"Reports destructions of polymorphic objects with a non-virtual "
590           "destructor in their base class">,
591  Documentation<HasAlphaDocumentation>;
592
593def EnumCastOutOfRangeChecker : Checker<"EnumCastOutOfRange">,
594  HelpText<"Check integer to enumeration casts for out of range values">,
595  Documentation<HasAlphaDocumentation>;
596
597def IteratorModeling : Checker<"IteratorModeling">,
598  HelpText<"Models iterators of C++ containers">,
599  Documentation<NotDocumented>,
600  Hidden;
601
602def InvalidatedIteratorChecker : Checker<"InvalidatedIterator">,
603  HelpText<"Check for use of invalidated iterators">,
604  Dependencies<[IteratorModeling]>,
605  Documentation<HasAlphaDocumentation>;
606
607def IteratorRangeChecker : Checker<"IteratorRange">,
608  HelpText<"Check for iterators used outside their valid ranges">,
609  Dependencies<[IteratorModeling]>,
610  Documentation<HasAlphaDocumentation>;
611
612def MismatchedIteratorChecker : Checker<"MismatchedIterator">,
613  HelpText<"Check for use of iterators of different containers where iterators "
614           "of the same container are expected">,
615  Dependencies<[IteratorModeling]>,
616  Documentation<HasAlphaDocumentation>;
617
618def PlacementNewChecker : Checker<"PlacementNew">,
619  HelpText<"Check if default placement new is provided with pointers to "
620           "sufficient storage capacity">,
621  Dependencies<[NewDeleteChecker]>,
622  Documentation<HasDocumentation>;
623
624} // end: "alpha.cplusplus"
625
626
627//===----------------------------------------------------------------------===//
628// Valist checkers.
629//===----------------------------------------------------------------------===//
630
631let ParentPackage = Valist in {
632
633def ValistBase : Checker<"ValistBase">,
634  HelpText<"Gathers information about va_lists.">,
635  Documentation<NotDocumented>,
636  Hidden;
637
638def UninitializedChecker : Checker<"Uninitialized">,
639  HelpText<"Check for usages of uninitialized (or already released) va_lists.">,
640  Dependencies<[ValistBase]>,
641  Documentation<NotDocumented>;
642
643def UnterminatedChecker : Checker<"Unterminated">,
644  HelpText<"Check for va_lists which are not released by a va_end call.">,
645  Dependencies<[ValistBase]>,
646  Documentation<NotDocumented>;
647
648def CopyToSelfChecker : Checker<"CopyToSelf">,
649  HelpText<"Check for va_lists which are copied onto itself.">,
650  Dependencies<[ValistBase]>,
651  Documentation<NotDocumented>;
652
653} // end : "valist"
654
655//===----------------------------------------------------------------------===//
656// Deadcode checkers.
657//===----------------------------------------------------------------------===//
658
659let ParentPackage = DeadCode in {
660
661def DeadStoresChecker : Checker<"DeadStores">,
662  HelpText<"Check for values stored to variables that are never read "
663           "afterwards">,
664  CheckerOptions<[
665    CmdLineOption<Boolean,
666                  "WarnForDeadNestedAssignments",
667                  "Warns for deadstores in nested assignments."
668                  "E.g.: if ((P = f())) where P is unused.",
669                  "true",
670                  Released>,
671    CmdLineOption<Boolean,
672                  "ShowFixIts",
673                  "Enable fix-it hints for this checker",
674                  "false",
675                  InAlpha>
676  ]>,
677  Documentation<HasDocumentation>;
678
679} // end DeadCode
680
681let ParentPackage = DeadCodeAlpha in {
682
683def UnreachableCodeChecker : Checker<"UnreachableCode">,
684  HelpText<"Check unreachable code">,
685  Documentation<HasAlphaDocumentation>;
686
687} // end "alpha.deadcode"
688
689//===----------------------------------------------------------------------===//
690// Performance checkers.
691//===----------------------------------------------------------------------===//
692
693let ParentPackage = Performance in {
694
695def PaddingChecker : Checker<"Padding">,
696  HelpText<"Check for excessively padded structs.">,
697  CheckerOptions<[
698    CmdLineOption<Integer,
699                  "AllowedPad",
700                  "Reports are only generated if the excessive padding exceeds "
701                  "'AllowedPad' in bytes.",
702                  "24",
703                  Released>
704  ]>,
705  Documentation<NotDocumented>;
706
707} // end: "padding"
708
709//===----------------------------------------------------------------------===//
710// Security checkers.
711//===----------------------------------------------------------------------===//
712
713let ParentPackage = InsecureAPI in {
714
715def SecuritySyntaxChecker : Checker<"SecuritySyntaxChecker">,
716  HelpText<"Base of various security function related checkers">,
717  Documentation<NotDocumented>,
718  Hidden;
719
720def bcmp : Checker<"bcmp">,
721  HelpText<"Warn on uses of the 'bcmp' function">,
722  Dependencies<[SecuritySyntaxChecker]>,
723  Documentation<HasDocumentation>;
724
725def bcopy : Checker<"bcopy">,
726  HelpText<"Warn on uses of the 'bcopy' function">,
727  Dependencies<[SecuritySyntaxChecker]>,
728  Documentation<HasDocumentation>;
729
730def bzero : Checker<"bzero">,
731  HelpText<"Warn on uses of the 'bzero' function">,
732  Dependencies<[SecuritySyntaxChecker]>,
733  Documentation<HasDocumentation>;
734
735def gets : Checker<"gets">,
736  HelpText<"Warn on uses of the 'gets' function">,
737  Dependencies<[SecuritySyntaxChecker]>,
738  Documentation<HasDocumentation>;
739
740def getpw : Checker<"getpw">,
741  HelpText<"Warn on uses of the 'getpw' function">,
742  Dependencies<[SecuritySyntaxChecker]>,
743  Documentation<HasDocumentation>;
744
745def mktemp : Checker<"mktemp">,
746  HelpText<"Warn on uses of the 'mktemp' function">,
747  Dependencies<[SecuritySyntaxChecker]>,
748  Documentation<HasDocumentation>;
749
750def mkstemp : Checker<"mkstemp">,
751  HelpText<"Warn when 'mkstemp' is passed fewer than 6 X's in the format "
752           "string">,
753  Dependencies<[SecuritySyntaxChecker]>,
754  Documentation<HasDocumentation>;
755
756def rand : Checker<"rand">,
757  HelpText<"Warn on uses of the 'rand', 'random', and related functions">,
758  Dependencies<[SecuritySyntaxChecker]>,
759  Documentation<HasDocumentation>;
760
761def strcpy : Checker<"strcpy">,
762  HelpText<"Warn on uses of the 'strcpy' and 'strcat' functions">,
763  Dependencies<[SecuritySyntaxChecker]>,
764  Documentation<HasDocumentation>;
765
766def vfork : Checker<"vfork">,
767  HelpText<"Warn on uses of the 'vfork' function">,
768  Dependencies<[SecuritySyntaxChecker]>,
769  Documentation<HasDocumentation>;
770
771def UncheckedReturn : Checker<"UncheckedReturn">,
772  HelpText<"Warn on uses of functions whose return values must be always "
773           "checked">,
774  Dependencies<[SecuritySyntaxChecker]>,
775  Documentation<HasDocumentation>;
776
777def DeprecatedOrUnsafeBufferHandling :
778  Checker<"DeprecatedOrUnsafeBufferHandling">,
779  HelpText<"Warn on uses of unsecure or deprecated buffer manipulating "
780           "functions">,
781  Dependencies<[SecuritySyntaxChecker]>,
782  Documentation<HasDocumentation>;
783
784def decodeValueOfObjCType : Checker<"decodeValueOfObjCType">,
785  HelpText<"Warn on uses of the '-decodeValueOfObjCType:at:' method">,
786  Dependencies<[SecuritySyntaxChecker]>,
787  Documentation<HasDocumentation>;
788
789} // end "security.insecureAPI"
790
791let ParentPackage = Security in {
792
793def FloatLoopCounter : Checker<"FloatLoopCounter">,
794  HelpText<"Warn on using a floating point value as a loop counter (CERT: "
795           "FLP30-C, FLP30-CPP)">,
796  Dependencies<[SecuritySyntaxChecker]>,
797  Documentation<HasDocumentation>;
798
799} // end "security"
800
801let ParentPackage = SecurityAlpha in {
802
803def ArrayBoundChecker : Checker<"ArrayBound">,
804  HelpText<"Warn about buffer overflows (older checker)">,
805  Documentation<HasAlphaDocumentation>;
806
807def ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">,
808  HelpText<"Warn about buffer overflows (newer checker)">,
809  Documentation<HasAlphaDocumentation>;
810
811def ReturnPointerRangeChecker : Checker<"ReturnPtrRange">,
812  HelpText<"Check for an out-of-bound pointer being returned to callers">,
813  Documentation<HasAlphaDocumentation>;
814
815def MallocOverflowSecurityChecker : Checker<"MallocOverflow">,
816  HelpText<"Check for overflows in the arguments to malloc()">,
817  Documentation<HasAlphaDocumentation>;
818
819def MmapWriteExecChecker : Checker<"MmapWriteExec">,
820  HelpText<"Warn on mmap() calls that are both writable and executable">,
821  CheckerOptions<[
822    CmdLineOption<Integer,
823                  "MmapProtExec",
824                  "Specifies the value of PROT_EXEC",
825                  "0x04",
826                  Released>,
827    CmdLineOption<Integer,
828                  "MmapProtRead",
829                  "Specifies the value of PROT_READ",
830                  "0x01",
831                  Released>
832  ]>,
833  Documentation<HasAlphaDocumentation>;
834
835} // end "alpha.security"
836
837//===----------------------------------------------------------------------===//
838// Taint checkers.
839//===----------------------------------------------------------------------===//
840
841let ParentPackage = Taint in {
842
843def GenericTaintChecker : Checker<"TaintPropagation">,
844  HelpText<"Generate taint information used by other checkers">,
845  CheckerOptions<[
846    CmdLineOption<String,
847                  "Config",
848                  "Specifies the name of the configuration file.",
849                  "",
850                  InAlpha>,
851  ]>,
852  Documentation<HasAlphaDocumentation>;
853
854} // end "alpha.security.taint"
855
856//===----------------------------------------------------------------------===//
857// Mac OS X, Cocoa, and Core Foundation checkers.
858//===----------------------------------------------------------------------===//
859
860let ParentPackage = Cocoa in {
861
862def RetainCountBase : Checker<"RetainCountBase">,
863  HelpText<"Common base of various retain count related checkers">,
864  Documentation<NotDocumented>,
865  Hidden;
866
867} // end "osx.cocoa"
868
869let ParentPackage = OSX in {
870
871def NSOrCFErrorDerefChecker : Checker<"NSOrCFErrorDerefChecker">,
872  HelpText<"Implementation checker for NSErrorChecker and CFErrorChecker">,
873  Documentation<NotDocumented>,
874  Hidden;
875
876def NumberObjectConversionChecker : Checker<"NumberObjectConversion">,
877  HelpText<"Check for erroneous conversions of objects representing numbers "
878           "into numbers">,
879  CheckerOptions<[
880    CmdLineOption<Boolean,
881                  "Pedantic",
882                  "Enables detection of more conversion patterns (which are "
883                  "most likely more harmless, and therefore are more likely to "
884                  "produce false positives).",
885                  "false",
886                  Released>
887  ]>,
888  Documentation<NotDocumented>;
889
890def MacOSXAPIChecker : Checker<"API">,
891  HelpText<"Check for proper uses of various Apple APIs">,
892  Documentation<HasDocumentation>;
893
894def MacOSKeychainAPIChecker : Checker<"SecKeychainAPI">,
895  HelpText<"Check for proper uses of Secure Keychain APIs">,
896  Documentation<HasDocumentation>;
897
898def MIGChecker : Checker<"MIG">,
899  HelpText<"Find violations of the Mach Interface Generator "
900           "calling convention">,
901  Documentation<NotDocumented>;
902
903def ObjCPropertyChecker : Checker<"ObjCProperty">,
904  HelpText<"Check for proper uses of Objective-C properties">,
905  Documentation<NotDocumented>;
906
907def OSObjectRetainCountChecker : Checker<"OSObjectRetainCount">,
908  HelpText<"Check for leaks and improper reference count management for "
909           "OSObject">,
910  Dependencies<[RetainCountBase]>,
911  Documentation<NotDocumented>;
912
913} // end "osx"
914
915let ParentPackage = Cocoa in {
916
917def RunLoopAutoreleaseLeakChecker : Checker<"RunLoopAutoreleaseLeak">,
918  HelpText<"Check for leaked memory in autorelease pools that will never be "
919           "drained">,
920  Documentation<NotDocumented>;
921
922def ObjCAtSyncChecker : Checker<"AtSync">,
923  HelpText<"Check for nil pointers used as mutexes for @synchronized">,
924  Documentation<HasDocumentation>;
925
926def NilArgChecker : Checker<"NilArg">,
927  HelpText<"Check for prohibited nil arguments to ObjC method calls">,
928  Documentation<HasDocumentation>;
929
930def ClassReleaseChecker : Checker<"ClassRelease">,
931  HelpText<"Check for sending 'retain', 'release', or 'autorelease' directly "
932           "to a Class">,
933  Documentation<HasDocumentation>;
934
935def VariadicMethodTypeChecker : Checker<"VariadicMethodTypes">,
936  HelpText<"Check for passing non-Objective-C types to variadic collection "
937           "initialization methods that expect only Objective-C types">,
938  Documentation<HasDocumentation>;
939
940def NSAutoreleasePoolChecker : Checker<"NSAutoreleasePool">,
941  HelpText<"Warn for suboptimal uses of NSAutoreleasePool in Objective-C GC "
942           "mode">,
943  Documentation<HasDocumentation>;
944
945def ObjCMethSigsChecker : Checker<"IncompatibleMethodTypes">,
946  HelpText<"Warn about Objective-C method signatures with type "
947           "incompatibilities">,
948  Documentation<HasDocumentation>;
949
950def ObjCUnusedIvarsChecker : Checker<"UnusedIvars">,
951  HelpText<"Warn about private ivars that are never used">,
952  Documentation<HasDocumentation>;
953
954def ObjCSelfInitChecker : Checker<"SelfInit">,
955  HelpText<"Check that 'self' is properly initialized inside an initializer "
956           "method">,
957  Documentation<HasDocumentation>;
958
959def ObjCLoopChecker : Checker<"Loops">,
960  HelpText<"Improved modeling of loops using Cocoa collection types">,
961  Documentation<NotDocumented>;
962
963def ObjCNonNilReturnValueChecker : Checker<"NonNilReturnValue">,
964  HelpText<"Model the APIs that are guaranteed to return a non-nil value">,
965  Documentation<NotDocumented>;
966
967def ObjCSuperCallChecker : Checker<"MissingSuperCall">,
968  HelpText<"Warn about Objective-C methods that lack a necessary call to "
969           "super">,
970  Documentation<NotDocumented>;
971
972def NSErrorChecker : Checker<"NSError">,
973  HelpText<"Check usage of NSError** parameters">,
974  Dependencies<[NSOrCFErrorDerefChecker]>,
975  Documentation<HasDocumentation>;
976
977def RetainCountChecker : Checker<"RetainCount">,
978  HelpText<"Check for leaks and improper reference count management">,
979  CheckerOptions<[
980    CmdLineOption<Boolean,
981                  "CheckOSObject",
982                  "Find violations of retain-release rules applied to XNU "
983                  "OSObject instances. By default, the checker only checks "
984                  "retain-release rules for Objective-C NSObject instances "
985                  "and CoreFoundation objects.",
986                  "true",
987                  InAlpha,
988                  Hide>,
989    CmdLineOption<Boolean,
990                  "TrackNSCFStartParam",
991                  "Check not only that the code follows retain-release rules "
992                  "with respect to objects it allocates or borrows from "
993                  "elsewhere, but also that it fulfills its own retain count "
994                  "specification with respect to objects that it receives as "
995                  "arguments.",
996                  "false",
997                  Released>
998  ]>,
999  Dependencies<[RetainCountBase]>,
1000  Documentation<HasDocumentation>;
1001
1002def ObjCGenericsChecker : Checker<"ObjCGenerics">,
1003  HelpText<"Check for type errors when using Objective-C generics">,
1004  Dependencies<[DynamicTypePropagation]>,
1005  Documentation<HasDocumentation>;
1006
1007def ObjCDeallocChecker : Checker<"Dealloc">,
1008  HelpText<"Warn about Objective-C classes that lack a correct implementation "
1009           "of -dealloc">,
1010  Documentation<HasDocumentation>;
1011
1012def ObjCSuperDeallocChecker : Checker<"SuperDealloc">,
1013  HelpText<"Warn about improper use of '[super dealloc]' in Objective-C">,
1014  Documentation<HasDocumentation>;
1015
1016def AutoreleaseWriteChecker : Checker<"AutoreleaseWrite">,
1017  HelpText<"Warn about potentially crashing writes to autoreleasing objects "
1018           "from different autoreleasing pools in Objective-C">,
1019  Documentation<NotDocumented>;
1020
1021} // end "osx.cocoa"
1022
1023let ParentPackage = Performance in {
1024
1025def GCDAntipattern : Checker<"GCDAntipattern">,
1026  HelpText<"Check for performance anti-patterns when using Grand Central "
1027           "Dispatch">,
1028  Documentation<NotDocumented>;
1029} // end "optin.performance"
1030
1031let ParentPackage = OSXOptIn in {
1032
1033def OSObjectCStyleCast : Checker<"OSObjectCStyleCast">,
1034  HelpText<"Checker for C-style casts of OSObjects">,
1035  Documentation<NotDocumented>;
1036
1037} // end "optin.osx"
1038
1039let ParentPackage = CocoaAlpha in {
1040
1041def IvarInvalidationModeling : Checker<"IvarInvalidationModeling">,
1042  HelpText<"Gathers information for annotation driven invalidation checking "
1043           "for classes that contains a method annotated with "
1044           "'objc_instance_variable_invalidator'">,
1045  Documentation<NotDocumented>,
1046  Hidden;
1047
1048def InstanceVariableInvalidation : Checker<"InstanceVariableInvalidation">,
1049  HelpText<"Check that the invalidatable instance variables are invalidated in "
1050           "the methods annotated with objc_instance_variable_invalidator">,
1051  Dependencies<[IvarInvalidationModeling]>,
1052  Documentation<HasAlphaDocumentation>;
1053
1054def MissingInvalidationMethod : Checker<"MissingInvalidationMethod">,
1055  HelpText<"Check that the invalidation methods are present in classes that "
1056           "contain invalidatable instance variables">,
1057  Dependencies<[IvarInvalidationModeling]>,
1058  Documentation<HasAlphaDocumentation>;
1059
1060def DirectIvarAssignment : Checker<"DirectIvarAssignment">,
1061  HelpText<"Check for direct assignments to instance variables">,
1062  Documentation<HasAlphaDocumentation>;
1063
1064def DirectIvarAssignmentForAnnotatedFunctions :
1065  Checker<"DirectIvarAssignmentForAnnotatedFunctions">,
1066  HelpText<"Check for direct assignments to instance variables in the methods "
1067           "annotated with objc_no_direct_instance_variable_assignment">,
1068  Dependencies<[DirectIvarAssignment]>,
1069  Documentation<HasAlphaDocumentation>;
1070
1071} // end "alpha.osx.cocoa"
1072
1073let ParentPackage = CoreFoundation in {
1074
1075def CFNumberChecker : Checker<"CFNumber">,
1076  HelpText<"Check for proper uses of CFNumber APIs">,
1077  Documentation<HasDocumentation>;
1078
1079def CFRetainReleaseChecker : Checker<"CFRetainRelease">,
1080  HelpText<"Check for null arguments to CFRetain/CFRelease/CFMakeCollectable">,
1081  Documentation<HasDocumentation>;
1082
1083def CFErrorChecker : Checker<"CFError">,
1084  HelpText<"Check usage of CFErrorRef* parameters">,
1085  Dependencies<[NSOrCFErrorDerefChecker]>,
1086  Documentation<HasDocumentation>;
1087
1088} // end "osx.coreFoundation"
1089
1090let ParentPackage = Containers in {
1091
1092def ObjCContainersASTChecker : Checker<"PointerSizedValues">,
1093  HelpText<"Warns if 'CFArray', 'CFDictionary', 'CFSet' are created with "
1094           "non-pointer-size values">,
1095  Documentation<HasDocumentation>;
1096
1097def ObjCContainersChecker : Checker<"OutOfBounds">,
1098  HelpText<"Checks for index out-of-bounds when using 'CFArray' API">,
1099  Documentation<HasDocumentation>;
1100
1101} // end "osx.coreFoundation.containers"
1102
1103let ParentPackage = LocalizabilityOptIn in {
1104
1105def NonLocalizedStringChecker : Checker<"NonLocalizedStringChecker">,
1106  HelpText<"Warns about uses of non-localized NSStrings passed to UI methods "
1107           "expecting localized NSStrings">,
1108  CheckerOptions<[
1109    CmdLineOption<Boolean,
1110                  "AggressiveReport",
1111                  "Marks a string being returned by any call as localized if "
1112                  "it is in LocStringFunctions (LSF) or the function is "
1113                  "annotated. Otherwise, we mark it as NonLocalized "
1114                  "(Aggressive) or NonLocalized only if it is not backed by a "
1115                  "SymRegion (Non-Aggressive), basically leaving only string "
1116                  "literals as NonLocalized.",
1117                  "false",
1118                  InAlpha,
1119                  Hide>
1120  ]>,
1121  Documentation<HasDocumentation>;
1122
1123def EmptyLocalizationContextChecker :
1124  Checker<"EmptyLocalizationContextChecker">,
1125  HelpText<"Check that NSLocalizedString macros include a comment for context">,
1126  Documentation<HasDocumentation>;
1127
1128} // end "optin.osx.cocoa.localizability"
1129
1130let ParentPackage = LocalizabilityAlpha in {
1131
1132def PluralMisuseChecker : Checker<"PluralMisuseChecker">,
1133  HelpText<"Warns against using one vs. many plural pattern in code when "
1134           "generating localized strings.">,
1135  Documentation<HasAlphaDocumentation>;
1136
1137} // end "alpha.osx.cocoa.localizability"
1138
1139let ParentPackage = MPI in {
1140
1141def MPIChecker : Checker<"MPI-Checker">,
1142  HelpText<"Checks MPI code">,
1143  Documentation<HasDocumentation>;
1144
1145} // end "optin.mpi"
1146
1147//===----------------------------------------------------------------------===//
1148// Checkers for LLVM development.
1149//===----------------------------------------------------------------------===//
1150
1151let ParentPackage = LLVMAlpha in {
1152
1153def LLVMConventionsChecker : Checker<"Conventions">,
1154  HelpText<"Check code for LLVM codebase conventions">,
1155  Documentation<HasAlphaDocumentation>;
1156
1157} // end "llvm"
1158
1159let ParentPackage = LLVMAPIModeling in {
1160
1161def CastValueChecker : Checker<"CastValue">,
1162  HelpText<"Model implementation of custom RTTIs">,
1163  Documentation<NotDocumented>;
1164
1165def ReturnValueChecker : Checker<"ReturnValue">,
1166  HelpText<"Model the guaranteed boolean return value of function calls">,
1167  Documentation<NotDocumented>;
1168
1169} // end "apiModeling.llvm"
1170
1171//===----------------------------------------------------------------------===//
1172// Checkers modeling Google APIs.
1173//===----------------------------------------------------------------------===//
1174
1175let ParentPackage = GoogleAPIModeling in {
1176
1177def GTestChecker : Checker<"GTest">,
1178  HelpText<"Model gtest assertion APIs">,
1179  Documentation<NotDocumented>;
1180
1181} // end "apiModeling.google"
1182
1183//===----------------------------------------------------------------------===//
1184// Debugging checkers (for analyzer development).
1185//===----------------------------------------------------------------------===//
1186
1187let ParentPackage = Debug in {
1188
1189def AnalysisOrderChecker : Checker<"AnalysisOrder">,
1190  HelpText<"Print callbacks that are called during analysis in order">,
1191  CheckerOptions<[
1192    CmdLineOption<Boolean,
1193                  "PreStmtCastExpr",
1194                  "",
1195                  "false",
1196                  Released,
1197                  Hide>,
1198    CmdLineOption<Boolean,
1199                  "PostStmtCastExpr",
1200                  "",
1201                  "false",
1202                  Released,
1203                  Hide>,
1204    CmdLineOption<Boolean,
1205                  "PreStmtArraySubscriptExpr",
1206                  "",
1207                  "false",
1208                  Released,
1209                  Hide>,
1210    CmdLineOption<Boolean,
1211                  "PostStmtArraySubscriptExpr",
1212                  "",
1213                  "false",
1214                  Released,
1215                  Hide>,
1216    CmdLineOption<Boolean,
1217                  "PreStmtCXXNewExpr",
1218                  "",
1219                  "false",
1220                  Released,
1221                  Hide>,
1222    CmdLineOption<Boolean,
1223                  "PostStmtCXXNewExpr",
1224                  "",
1225                  "false",
1226                  Released,
1227                  Hide>,
1228    CmdLineOption<Boolean,
1229                  "PreStmtOffsetOfExpr",
1230                  "",
1231                  "false",
1232                  Released,
1233                  Hide>,
1234    CmdLineOption<Boolean,
1235                  "PostStmtOffsetOfExpr",
1236                  "",
1237                  "false",
1238                  Released,
1239                  Hide>,
1240    CmdLineOption<Boolean,
1241                  "PreCall",
1242                  "",
1243                  "false",
1244                  Released,
1245                  Hide>,
1246    CmdLineOption<Boolean,
1247                  "PostCall",
1248                  "",
1249                  "false",
1250                  Released,
1251                  Hide>,
1252    CmdLineOption<Boolean,
1253                  "EndFunction",
1254                  "",
1255                  "false",
1256                  Released,
1257                  Hide>,
1258    CmdLineOption<Boolean,
1259                  "NewAllocator",
1260                  "",
1261                  "false",
1262                  Released,
1263                  Hide>,
1264    CmdLineOption<Boolean,
1265                  "Bind",
1266                  "",
1267                  "false",
1268                  Released,
1269                  Hide>,
1270    CmdLineOption<Boolean,
1271                  "LiveSymbols",
1272                  "",
1273                  "false",
1274                  Released,
1275                  Hide>,
1276    CmdLineOption<Boolean,
1277                  "RegionChanges",
1278                  "",
1279                  "false",
1280                  Released,
1281                  Hide>,
1282    CmdLineOption<Boolean,
1283                  "PointerEscape",
1284                  "",
1285                  "false",
1286                  Released,
1287                  Hide>,
1288    CmdLineOption<Boolean,
1289                  "*",
1290                  "Enables all callbacks.",
1291                  "false",
1292                  Released,
1293                  Hide>
1294  ]>,
1295  Documentation<NotDocumented>;
1296
1297def DominatorsTreeDumper : Checker<"DumpDominators">,
1298  HelpText<"Print the dominance tree for a given CFG">,
1299  Documentation<NotDocumented>;
1300
1301def PostDominatorsTreeDumper : Checker<"DumpPostDominators">,
1302  HelpText<"Print the post dominance tree for a given CFG">,
1303  Documentation<NotDocumented>;
1304
1305def ControlDependencyTreeDumper : Checker<"DumpControlDependencies">,
1306  HelpText<"Print the post control dependency tree for a given CFG">,
1307  Documentation<NotDocumented>;
1308
1309def LiveVariablesDumper : Checker<"DumpLiveVars">,
1310  HelpText<"Print results of live variable analysis">,
1311  Documentation<NotDocumented>;
1312
1313def LiveStatementsDumper : Checker<"DumpLiveStmts">,
1314  HelpText<"Print results of live statement analysis">,
1315  Documentation<NotDocumented>;
1316
1317def CFGViewer : Checker<"ViewCFG">,
1318  HelpText<"View Control-Flow Graphs using GraphViz">,
1319  Documentation<NotDocumented>;
1320
1321def CFGDumper : Checker<"DumpCFG">,
1322  HelpText<"Display Control-Flow Graphs">,
1323  Documentation<NotDocumented>;
1324
1325def CallGraphViewer : Checker<"ViewCallGraph">,
1326  HelpText<"View Call Graph using GraphViz">,
1327  Documentation<NotDocumented>;
1328
1329def CallGraphDumper : Checker<"DumpCallGraph">,
1330  HelpText<"Display Call Graph">,
1331  Documentation<NotDocumented>;
1332
1333def ConfigDumper : Checker<"ConfigDumper">,
1334  HelpText<"Dump config table">,
1335  Documentation<NotDocumented>;
1336
1337def TraversalDumper : Checker<"DumpTraversal">,
1338  HelpText<"Print branch conditions as they are traversed by the engine">,
1339  Documentation<NotDocumented>;
1340
1341def CallDumper : Checker<"DumpCalls">,
1342  HelpText<"Print calls as they are traversed by the engine">,
1343  Documentation<NotDocumented>;
1344
1345def AnalyzerStatsChecker : Checker<"Stats">,
1346  HelpText<"Emit warnings with analyzer statistics">,
1347  Documentation<NotDocumented>;
1348
1349def TaintTesterChecker : Checker<"TaintTest">,
1350  HelpText<"Mark tainted symbols as such.">,
1351  Documentation<NotDocumented>;
1352
1353def ExprInspectionChecker : Checker<"ExprInspection">,
1354  HelpText<"Check the analyzer's understanding of expressions">,
1355  Documentation<NotDocumented>;
1356
1357def ExplodedGraphViewer : Checker<"ViewExplodedGraph">,
1358  HelpText<"View Exploded Graphs using GraphViz">,
1359  Documentation<NotDocumented>;
1360
1361def ReportStmts : Checker<"ReportStmts">,
1362  HelpText<"Emits a warning for every statement.">,
1363  Documentation<NotDocumented>;
1364
1365def DebugIteratorModeling : Checker<"DebugIteratorModeling">,
1366  HelpText<"Check the analyzer's understanding of C++ iterators">,
1367  Dependencies<[IteratorModeling]>,
1368  Documentation<NotDocumented>;
1369
1370} // end "debug"
1371
1372
1373//===----------------------------------------------------------------------===//
1374// Clone Detection
1375//===----------------------------------------------------------------------===//
1376
1377let ParentPackage = CloneDetectionAlpha in {
1378
1379def CloneChecker : Checker<"CloneChecker">,
1380  HelpText<"Reports similar pieces of code.">,
1381  CheckerOptions<[
1382    CmdLineOption<Integer,
1383                  "MinimumCloneComplexity",
1384                  "Ensures that every clone has at least the given complexity. "
1385                  "Complexity is here defined as the total amount of children "
1386                  "of a statement. This constraint assumes the first statement "
1387                  "in the group is representative for all other statements in "
1388                  "the group in terms of complexity.",
1389                  "50",
1390                  Released>,
1391    CmdLineOption<Boolean,
1392                  "ReportNormalClones",
1393                  "Report all clones, even less suspicious ones.",
1394                  "true",
1395                  Released>,
1396    CmdLineOption<String,
1397                  "IgnoredFilesPattern",
1398                  "If supplied, the checker wont analyze files with a filename "
1399                  "that matches the given pattern.",
1400                  "\"\"",
1401                  Released>
1402  ]>,
1403  Documentation<HasAlphaDocumentation>;
1404
1405} // end "clone"
1406
1407//===----------------------------------------------------------------------===//
1408// Portability checkers.
1409//===----------------------------------------------------------------------===//
1410
1411let ParentPackage = PortabilityOptIn in {
1412
1413def UnixAPIPortabilityChecker : Checker<"UnixAPI">,
1414  HelpText<"Finds implementation-defined behavior in UNIX/Posix functions">,
1415  Documentation<NotDocumented>;
1416
1417} // end optin.portability
1418
1419//===----------------------------------------------------------------------===//
1420// NonDeterminism checkers.
1421//===----------------------------------------------------------------------===//
1422
1423let ParentPackage = NonDeterminismAlpha in {
1424
1425def PointerIterationChecker : Checker<"PointerIteration">,
1426  HelpText<"Checks for non-determinism caused by iteration of unordered containers of pointers">,
1427  Documentation<HasDocumentation>;
1428
1429def PointerSortingChecker : Checker<"PointerSorting">,
1430  HelpText<"Check for non-determinism caused by sorting of pointers">,
1431  Documentation<HasDocumentation>;
1432
1433} // end alpha.nondeterminism
1434
1435//===----------------------------------------------------------------------===//
1436// Fuchsia checkers.
1437//===----------------------------------------------------------------------===//
1438
1439let ParentPackage = Fuchsia in {
1440
1441def FuchsiaHandleChecker : Checker<"HandleChecker">,
1442  HelpText<"A Checker that detect leaks related to Fuchsia handles">,
1443  Documentation<HasDocumentation>;
1444
1445} // end fuchsia
1446
1447