1f4a2713aSLionel Sambuc//===--- Checkers.td - Static Analyzer Checkers -===-----------------------===//
2f4a2713aSLionel Sambuc//
3f4a2713aSLionel Sambuc//                     The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc//
5f4a2713aSLionel Sambuc// This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc// License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc//
8f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambucinclude "clang/StaticAnalyzer/Checkers/CheckerBase.td"
11f4a2713aSLionel Sambuc
12f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
13f4a2713aSLionel Sambuc// Packages.
14f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
15f4a2713aSLionel Sambuc
16f4a2713aSLionel Sambucdef Alpha : Package<"alpha">;
17f4a2713aSLionel Sambuc
18f4a2713aSLionel Sambucdef Core : Package<"core">;
19f4a2713aSLionel Sambucdef CoreBuiltin : Package<"builtin">, InPackage<Core>;
20f4a2713aSLionel Sambucdef CoreUninitialized  : Package<"uninitialized">, InPackage<Core>;
21f4a2713aSLionel Sambucdef CoreAlpha : Package<"core">, InPackage<Alpha>, Hidden;
22f4a2713aSLionel Sambuc
23f4a2713aSLionel Sambucdef Cplusplus : Package<"cplusplus">;
24f4a2713aSLionel Sambucdef CplusplusAlpha : Package<"cplusplus">, InPackage<Alpha>, Hidden;
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambucdef DeadCode : Package<"deadcode">;
27f4a2713aSLionel Sambucdef DeadCodeAlpha : Package<"deadcode">, InPackage<Alpha>, Hidden;
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambucdef Security : Package <"security">;
30f4a2713aSLionel Sambucdef InsecureAPI : Package<"insecureAPI">, InPackage<Security>;
31f4a2713aSLionel Sambucdef SecurityAlpha : Package<"security">, InPackage<Alpha>, Hidden;
32f4a2713aSLionel Sambucdef Taint : Package<"taint">, InPackage<SecurityAlpha>, Hidden;
33f4a2713aSLionel Sambuc
34f4a2713aSLionel Sambucdef Unix : Package<"unix">;
35f4a2713aSLionel Sambucdef UnixAlpha : Package<"unix">, InPackage<Alpha>, Hidden;
36f4a2713aSLionel Sambucdef CString : Package<"cstring">, InPackage<Unix>, Hidden;
37f4a2713aSLionel Sambucdef CStringAlpha : Package<"cstring">, InPackage<UnixAlpha>, Hidden;
38f4a2713aSLionel Sambuc
39f4a2713aSLionel Sambucdef OSX : Package<"osx">;
40f4a2713aSLionel Sambucdef OSXAlpha : Package<"osx">, InPackage<Alpha>, Hidden;
41f4a2713aSLionel Sambucdef Cocoa : Package<"cocoa">, InPackage<OSX>;
42f4a2713aSLionel Sambucdef CocoaAlpha : Package<"cocoa">, InPackage<OSXAlpha>, Hidden;
43f4a2713aSLionel Sambucdef CoreFoundation : Package<"coreFoundation">, InPackage<OSX>;
44f4a2713aSLionel Sambucdef Containers : Package<"containers">, InPackage<CoreFoundation>;
45f4a2713aSLionel Sambuc
46f4a2713aSLionel Sambucdef LLVM : Package<"llvm">;
47f4a2713aSLionel Sambucdef Debug : Package<"debug">;
48f4a2713aSLionel Sambuc
49f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
50f4a2713aSLionel Sambuc// Core Checkers.
51f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
52f4a2713aSLionel Sambuc
53f4a2713aSLionel Sambuclet ParentPackage = Core in {
54f4a2713aSLionel Sambuc
55f4a2713aSLionel Sambucdef DereferenceChecker : Checker<"NullDereference">,
56f4a2713aSLionel Sambuc  HelpText<"Check for dereferences of null pointers">,
57f4a2713aSLionel Sambuc  DescFile<"DereferenceChecker.cpp">;
58f4a2713aSLionel Sambuc
59f4a2713aSLionel Sambucdef CallAndMessageChecker : Checker<"CallAndMessage">,
60f4a2713aSLionel Sambuc  HelpText<"Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers)">,
61f4a2713aSLionel Sambuc  DescFile<"CallAndMessageChecker.cpp">;
62f4a2713aSLionel Sambuc
63f4a2713aSLionel Sambucdef NonNullParamChecker : Checker<"NonNullParamChecker">,
64f4a2713aSLionel Sambuc  HelpText<"Check for null pointers passed as arguments to a function whose arguments are references or marked with the 'nonnull' attribute">,
65f4a2713aSLionel Sambuc  DescFile<"NonNullParamChecker.cpp">;
66f4a2713aSLionel Sambuc
67f4a2713aSLionel Sambucdef VLASizeChecker : Checker<"VLASize">,
68f4a2713aSLionel Sambuc  HelpText<"Check for declarations of VLA of undefined or zero size">,
69f4a2713aSLionel Sambuc  DescFile<"VLASizeChecker.cpp">;
70f4a2713aSLionel Sambuc
71f4a2713aSLionel Sambucdef DivZeroChecker : Checker<"DivideZero">,
72f4a2713aSLionel Sambuc  HelpText<"Check for division by zero">,
73f4a2713aSLionel Sambuc  DescFile<"DivZeroChecker.cpp">;
74f4a2713aSLionel Sambuc
75f4a2713aSLionel Sambucdef UndefResultChecker : Checker<"UndefinedBinaryOperatorResult">,
76f4a2713aSLionel Sambuc  HelpText<"Check for undefined results of binary operators">,
77f4a2713aSLionel Sambuc  DescFile<"UndefResultChecker.cpp">;
78f4a2713aSLionel Sambuc
79f4a2713aSLionel Sambucdef StackAddrEscapeChecker : Checker<"StackAddressEscape">,
80f4a2713aSLionel Sambuc  HelpText<"Check that addresses to stack memory do not escape the function">,
81f4a2713aSLionel Sambuc  DescFile<"StackAddrEscapeChecker.cpp">;
82f4a2713aSLionel Sambuc
83f4a2713aSLionel Sambucdef DynamicTypePropagation : Checker<"DynamicTypePropagation">,
84f4a2713aSLionel Sambuc  HelpText<"Generate dynamic type information">,
85f4a2713aSLionel Sambuc  DescFile<"DynamicTypePropagation.cpp">;
86f4a2713aSLionel Sambuc
87f4a2713aSLionel Sambuc} // end "core"
88f4a2713aSLionel Sambuc
89f4a2713aSLionel Sambuclet ParentPackage = CoreAlpha in {
90f4a2713aSLionel Sambuc
91f4a2713aSLionel Sambucdef BoolAssignmentChecker : Checker<"BoolAssignment">,
92f4a2713aSLionel Sambuc  HelpText<"Warn about assigning non-{0,1} values to Boolean variables">,
93f4a2713aSLionel Sambuc  DescFile<"BoolAssignmentChecker.cpp">;
94f4a2713aSLionel Sambuc
95f4a2713aSLionel Sambucdef CastSizeChecker : Checker<"CastSize">,
96f4a2713aSLionel Sambuc  HelpText<"Check when casting a malloc'ed type T, whether the size is a multiple of the size of T">,
97f4a2713aSLionel Sambuc  DescFile<"CastSizeChecker.cpp">;
98f4a2713aSLionel Sambuc
99f4a2713aSLionel Sambucdef CastToStructChecker : Checker<"CastToStruct">,
100f4a2713aSLionel Sambuc  HelpText<"Check for cast from non-struct pointer to struct pointer">,
101f4a2713aSLionel Sambuc  DescFile<"CastToStructChecker.cpp">;
102f4a2713aSLionel Sambuc
103f4a2713aSLionel Sambucdef IdenticalExprChecker : Checker<"IdenticalExpr">,
104f4a2713aSLionel Sambuc  HelpText<"Warn about unintended use of identical expressions in operators">,
105f4a2713aSLionel Sambuc  DescFile<"IdenticalExprChecker.cpp">;
106f4a2713aSLionel Sambuc
107f4a2713aSLionel Sambucdef FixedAddressChecker : Checker<"FixedAddr">,
108f4a2713aSLionel Sambuc  HelpText<"Check for assignment of a fixed address to a pointer">,
109f4a2713aSLionel Sambuc  DescFile<"FixedAddressChecker.cpp">;
110f4a2713aSLionel Sambuc
111f4a2713aSLionel Sambucdef PointerArithChecker : Checker<"PointerArithm">,
112f4a2713aSLionel Sambuc  HelpText<"Check for pointer arithmetic on locations other than array elements">,
113f4a2713aSLionel Sambuc  DescFile<"PointerArithChecker">;
114f4a2713aSLionel Sambuc
115f4a2713aSLionel Sambucdef PointerSubChecker : Checker<"PointerSub">,
116f4a2713aSLionel Sambuc  HelpText<"Check for pointer subtractions on two pointers pointing to different memory chunks">,
117f4a2713aSLionel Sambuc  DescFile<"PointerSubChecker">;
118f4a2713aSLionel Sambuc
119f4a2713aSLionel Sambucdef SizeofPointerChecker : Checker<"SizeofPtr">,
120f4a2713aSLionel Sambuc  HelpText<"Warn about unintended use of sizeof() on pointer expressions">,
121f4a2713aSLionel Sambuc  DescFile<"CheckSizeofPointer.cpp">;
122f4a2713aSLionel Sambuc
123*0a6a1f1dSLionel Sambucdef CallAndMessageUnInitRefArg : Checker<"CallAndMessageUnInitRefArg">,
124*0a6a1f1dSLionel Sambuc  HelpText<"Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers, and pointer to undefined variables)">,
125*0a6a1f1dSLionel Sambuc  DescFile<"CallAndMessageChecker.cpp">;
126*0a6a1f1dSLionel Sambuc
127*0a6a1f1dSLionel Sambucdef TestAfterDivZeroChecker : Checker<"TestAfterDivZero">,
128*0a6a1f1dSLionel Sambuc  HelpText<"Check for division by variable that is later compared against 0. Either the comparison is useless or there is division by zero.">,
129*0a6a1f1dSLionel Sambuc  DescFile<"TestAfterDivZeroChecker.cpp">;
130*0a6a1f1dSLionel Sambuc
131f4a2713aSLionel Sambuc} // end "alpha.core"
132f4a2713aSLionel Sambuc
133f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
134f4a2713aSLionel Sambuc// Evaluate "builtin" functions.
135f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
136f4a2713aSLionel Sambuc
137f4a2713aSLionel Sambuclet ParentPackage = CoreBuiltin in {
138f4a2713aSLionel Sambuc
139f4a2713aSLionel Sambucdef NoReturnFunctionChecker : Checker<"NoReturnFunctions">,
140f4a2713aSLionel Sambuc  HelpText<"Evaluate \"panic\" functions that are known to not return to the caller">,
141f4a2713aSLionel Sambuc  DescFile<"NoReturnFunctionChecker.cpp">;
142f4a2713aSLionel Sambuc
143f4a2713aSLionel Sambucdef BuiltinFunctionChecker : Checker<"BuiltinFunctions">,
144f4a2713aSLionel Sambuc  HelpText<"Evaluate compiler builtin functions (e.g., alloca())">,
145f4a2713aSLionel Sambuc  DescFile<"BuiltinFunctionChecker.cpp">;
146f4a2713aSLionel Sambuc
147f4a2713aSLionel Sambuc} // end "core.builtin"
148f4a2713aSLionel Sambuc
149f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
150f4a2713aSLionel Sambuc// Uninitialized values checkers.
151f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
152f4a2713aSLionel Sambuc
153f4a2713aSLionel Sambuclet ParentPackage = CoreUninitialized in {
154f4a2713aSLionel Sambuc
155f4a2713aSLionel Sambucdef UndefinedArraySubscriptChecker : Checker<"ArraySubscript">,
156f4a2713aSLionel Sambuc  HelpText<"Check for uninitialized values used as array subscripts">,
157f4a2713aSLionel Sambuc  DescFile<"UndefinedArraySubscriptChecker.cpp">;
158f4a2713aSLionel Sambuc
159f4a2713aSLionel Sambucdef UndefinedAssignmentChecker : Checker<"Assign">,
160f4a2713aSLionel Sambuc  HelpText<"Check for assigning uninitialized values">,
161f4a2713aSLionel Sambuc  DescFile<"UndefinedAssignmentChecker.cpp">;
162f4a2713aSLionel Sambuc
163f4a2713aSLionel Sambucdef UndefBranchChecker : Checker<"Branch">,
164f4a2713aSLionel Sambuc  HelpText<"Check for uninitialized values used as branch conditions">,
165f4a2713aSLionel Sambuc  DescFile<"UndefBranchChecker.cpp">;
166f4a2713aSLionel Sambuc
167f4a2713aSLionel Sambucdef UndefCapturedBlockVarChecker : Checker<"CapturedBlockVariable">,
168f4a2713aSLionel Sambuc  HelpText<"Check for blocks that capture uninitialized values">,
169f4a2713aSLionel Sambuc  DescFile<"UndefCapturedBlockVarChecker.cpp">;
170f4a2713aSLionel Sambuc
171f4a2713aSLionel Sambucdef ReturnUndefChecker : Checker<"UndefReturn">,
172f4a2713aSLionel Sambuc  HelpText<"Check for uninitialized values being returned to the caller">,
173f4a2713aSLionel Sambuc  DescFile<"ReturnUndefChecker.cpp">;
174f4a2713aSLionel Sambuc
175f4a2713aSLionel Sambuc} // end "core.uninitialized"
176f4a2713aSLionel Sambuc
177f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
178f4a2713aSLionel Sambuc// C++ checkers.
179f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
180f4a2713aSLionel Sambuc
181f4a2713aSLionel Sambuclet ParentPackage = Cplusplus in {
182f4a2713aSLionel Sambuc
183f4a2713aSLionel Sambucdef NewDeleteChecker : Checker<"NewDelete">,
184f4a2713aSLionel Sambuc  HelpText<"Check for double-free and use-after-free problems. Traces memory managed by new/delete.">,
185f4a2713aSLionel Sambuc  DescFile<"MallocChecker.cpp">;
186f4a2713aSLionel Sambuc
187*0a6a1f1dSLionel Sambucdef NewDeleteLeaksChecker : Checker<"NewDeleteLeaks">,
188*0a6a1f1dSLionel Sambuc  HelpText<"Check for memory leaks. Traces memory managed by new/delete.">,
189*0a6a1f1dSLionel Sambuc  DescFile<"MallocChecker.cpp">;
190*0a6a1f1dSLionel Sambuc
191f4a2713aSLionel Sambuc} // end: "cplusplus"
192f4a2713aSLionel Sambuc
193f4a2713aSLionel Sambuclet ParentPackage = CplusplusAlpha in {
194f4a2713aSLionel Sambuc
195f4a2713aSLionel Sambucdef VirtualCallChecker : Checker<"VirtualCall">,
196f4a2713aSLionel Sambuc  HelpText<"Check virtual function calls during construction or destruction">,
197f4a2713aSLionel Sambuc  DescFile<"VirtualCallChecker.cpp">;
198f4a2713aSLionel Sambuc
199f4a2713aSLionel Sambuc} // end: "alpha.cplusplus"
200f4a2713aSLionel Sambuc
201f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
202f4a2713aSLionel Sambuc// Deadcode checkers.
203f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
204f4a2713aSLionel Sambuc
205f4a2713aSLionel Sambuclet ParentPackage = DeadCode in {
206f4a2713aSLionel Sambuc
207f4a2713aSLionel Sambucdef DeadStoresChecker : Checker<"DeadStores">,
208f4a2713aSLionel Sambuc  HelpText<"Check for values stored to variables that are never read afterwards">,
209f4a2713aSLionel Sambuc  DescFile<"DeadStoresChecker.cpp">;
210f4a2713aSLionel Sambuc} // end DeadCode
211f4a2713aSLionel Sambuc
212f4a2713aSLionel Sambuclet ParentPackage = DeadCodeAlpha in {
213f4a2713aSLionel Sambuc
214f4a2713aSLionel Sambucdef UnreachableCodeChecker : Checker<"UnreachableCode">,
215f4a2713aSLionel Sambuc  HelpText<"Check unreachable code">,
216f4a2713aSLionel Sambuc  DescFile<"UnreachableCodeChecker.cpp">;
217f4a2713aSLionel Sambuc
218f4a2713aSLionel Sambuc} // end "alpha.deadcode"
219f4a2713aSLionel Sambuc
220f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
221f4a2713aSLionel Sambuc// Security checkers.
222f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
223f4a2713aSLionel Sambuc
224f4a2713aSLionel Sambuclet ParentPackage = InsecureAPI in {
225f4a2713aSLionel Sambuc  def gets : Checker<"gets">,
226f4a2713aSLionel Sambuc    HelpText<"Warn on uses of the 'gets' function">,
227f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
228f4a2713aSLionel Sambuc  def getpw : Checker<"getpw">,
229f4a2713aSLionel Sambuc    HelpText<"Warn on uses of the 'getpw' function">,
230f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
231f4a2713aSLionel Sambuc  def mktemp : Checker<"mktemp">,
232f4a2713aSLionel Sambuc    HelpText<"Warn on uses of the 'mktemp' function">,
233f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
234f4a2713aSLionel Sambuc  def mkstemp : Checker<"mkstemp">,
235f4a2713aSLionel Sambuc    HelpText<"Warn when 'mkstemp' is passed fewer than 6 X's in the format string">,
236f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
237f4a2713aSLionel Sambuc  def rand : Checker<"rand">,
238f4a2713aSLionel Sambuc    HelpText<"Warn on uses of the 'rand', 'random', and related functions">,
239f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
240f4a2713aSLionel Sambuc  def strcpy : Checker<"strcpy">,
241f4a2713aSLionel Sambuc    HelpText<"Warn on uses of the 'strcpy' and 'strcat' functions">,
242f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
243f4a2713aSLionel Sambuc  def vfork : Checker<"vfork">,
244f4a2713aSLionel Sambuc    HelpText<"Warn on uses of the 'vfork' function">,
245f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
246f4a2713aSLionel Sambuc  def UncheckedReturn : Checker<"UncheckedReturn">,
247f4a2713aSLionel Sambuc    HelpText<"Warn on uses of functions whose return values must be always checked">,
248f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
249f4a2713aSLionel Sambuc}
250f4a2713aSLionel Sambuclet ParentPackage = Security in {
251f4a2713aSLionel Sambuc  def FloatLoopCounter : Checker<"FloatLoopCounter">,
252f4a2713aSLionel Sambuc    HelpText<"Warn on using a floating point value as a loop counter (CERT: FLP30-C, FLP30-CPP)">,
253f4a2713aSLionel Sambuc    DescFile<"CheckSecuritySyntaxOnly.cpp">;
254f4a2713aSLionel Sambuc}
255f4a2713aSLionel Sambuc
256f4a2713aSLionel Sambuclet ParentPackage = SecurityAlpha in {
257f4a2713aSLionel Sambuc
258f4a2713aSLionel Sambucdef ArrayBoundChecker : Checker<"ArrayBound">,
259f4a2713aSLionel Sambuc  HelpText<"Warn about buffer overflows (older checker)">,
260f4a2713aSLionel Sambuc  DescFile<"ArrayBoundChecker.cpp">;
261f4a2713aSLionel Sambuc
262f4a2713aSLionel Sambucdef ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">,
263f4a2713aSLionel Sambuc  HelpText<"Warn about buffer overflows (newer checker)">,
264f4a2713aSLionel Sambuc  DescFile<"ArrayBoundCheckerV2.cpp">;
265f4a2713aSLionel Sambuc
266f4a2713aSLionel Sambucdef ReturnPointerRangeChecker : Checker<"ReturnPtrRange">,
267f4a2713aSLionel Sambuc  HelpText<"Check for an out-of-bound pointer being returned to callers">,
268f4a2713aSLionel Sambuc  DescFile<"ReturnPointerRangeChecker.cpp">;
269f4a2713aSLionel Sambuc
270f4a2713aSLionel Sambucdef MallocOverflowSecurityChecker : Checker<"MallocOverflow">,
271f4a2713aSLionel Sambuc  HelpText<"Check for overflows in the arguments to malloc()">,
272f4a2713aSLionel Sambuc  DescFile<"MallocOverflowSecurityChecker.cpp">;
273f4a2713aSLionel Sambuc
274f4a2713aSLionel Sambuc} // end "alpha.security"
275f4a2713aSLionel Sambuc
276f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
277f4a2713aSLionel Sambuc// Taint checkers.
278f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
279f4a2713aSLionel Sambuc
280f4a2713aSLionel Sambuclet ParentPackage = Taint in {
281f4a2713aSLionel Sambuc
282f4a2713aSLionel Sambucdef GenericTaintChecker : Checker<"TaintPropagation">,
283f4a2713aSLionel Sambuc  HelpText<"Generate taint information used by other checkers">,
284f4a2713aSLionel Sambuc  DescFile<"GenericTaintChecker.cpp">;
285f4a2713aSLionel Sambuc
286f4a2713aSLionel Sambuc} // end "alpha.security.taint"
287f4a2713aSLionel Sambuc
288f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
289f4a2713aSLionel Sambuc// Unix API checkers.
290f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
291f4a2713aSLionel Sambuc
292f4a2713aSLionel Sambuclet ParentPackage = Unix in {
293f4a2713aSLionel Sambuc
294f4a2713aSLionel Sambucdef UnixAPIChecker : Checker<"API">,
295f4a2713aSLionel Sambuc  HelpText<"Check calls to various UNIX/Posix functions">,
296f4a2713aSLionel Sambuc  DescFile<"UnixAPIChecker.cpp">;
297f4a2713aSLionel Sambuc
298f4a2713aSLionel Sambucdef MallocPessimistic : Checker<"Malloc">,
299f4a2713aSLionel Sambuc  HelpText<"Check for memory leaks, double free, and use-after-free problems. Traces memory managed by malloc()/free().">,
300f4a2713aSLionel Sambuc  DescFile<"MallocChecker.cpp">;
301f4a2713aSLionel Sambuc
302f4a2713aSLionel Sambucdef MallocSizeofChecker : Checker<"MallocSizeof">,
303f4a2713aSLionel Sambuc  HelpText<"Check for dubious malloc arguments involving sizeof">,
304f4a2713aSLionel Sambuc  DescFile<"MallocSizeofChecker.cpp">;
305f4a2713aSLionel Sambuc
306f4a2713aSLionel Sambucdef MismatchedDeallocatorChecker : Checker<"MismatchedDeallocator">,
307f4a2713aSLionel Sambuc  HelpText<"Check for mismatched deallocators.">,
308f4a2713aSLionel Sambuc  DescFile<"MallocChecker.cpp">;
309f4a2713aSLionel Sambuc
310f4a2713aSLionel Sambuc} // end "unix"
311f4a2713aSLionel Sambuc
312f4a2713aSLionel Sambuclet ParentPackage = UnixAlpha in {
313f4a2713aSLionel Sambuc
314f4a2713aSLionel Sambucdef ChrootChecker : Checker<"Chroot">,
315f4a2713aSLionel Sambuc  HelpText<"Check improper use of chroot">,
316f4a2713aSLionel Sambuc  DescFile<"ChrootChecker.cpp">;
317f4a2713aSLionel Sambuc
318f4a2713aSLionel Sambucdef MallocOptimistic : Checker<"MallocWithAnnotations">,
319f4a2713aSLionel Sambuc  HelpText<"Check for memory leaks, double free, and use-after-free problems. Traces memory managed by malloc()/free(). Assumes that all user-defined functions which might free a pointer are annotated.">,
320f4a2713aSLionel Sambuc  DescFile<"MallocChecker.cpp">;
321f4a2713aSLionel Sambuc
322f4a2713aSLionel Sambucdef PthreadLockChecker : Checker<"PthreadLock">,
323f4a2713aSLionel Sambuc  HelpText<"Simple lock -> unlock checker">,
324f4a2713aSLionel Sambuc  DescFile<"PthreadLockChecker.cpp">;
325f4a2713aSLionel Sambuc
326f4a2713aSLionel Sambucdef StreamChecker : Checker<"Stream">,
327f4a2713aSLionel Sambuc  HelpText<"Check stream handling functions">,
328f4a2713aSLionel Sambuc  DescFile<"StreamChecker.cpp">;
329f4a2713aSLionel Sambuc
330f4a2713aSLionel Sambucdef SimpleStreamChecker : Checker<"SimpleStream">,
331f4a2713aSLionel Sambuc  HelpText<"Check for misuses of stream APIs">,
332f4a2713aSLionel Sambuc  DescFile<"SimpleStreamChecker.cpp">;
333f4a2713aSLionel Sambuc
334f4a2713aSLionel Sambuc} // end "alpha.unix"
335f4a2713aSLionel Sambuc
336f4a2713aSLionel Sambuclet ParentPackage = CString in {
337f4a2713aSLionel Sambuc
338f4a2713aSLionel Sambucdef CStringNullArg : Checker<"NullArg">,
339f4a2713aSLionel Sambuc  HelpText<"Check for null pointers being passed as arguments to C string functions">,
340f4a2713aSLionel Sambuc  DescFile<"CStringChecker.cpp">;
341f4a2713aSLionel Sambuc
342f4a2713aSLionel Sambucdef CStringSyntaxChecker : Checker<"BadSizeArg">,
343f4a2713aSLionel Sambuc  HelpText<"Check the size argument passed into C string functions for common erroneous patterns">,
344f4a2713aSLionel Sambuc  DescFile<"CStringSyntaxChecker.cpp">;
345f4a2713aSLionel Sambuc}
346f4a2713aSLionel Sambuc
347f4a2713aSLionel Sambuclet ParentPackage = CStringAlpha in {
348f4a2713aSLionel Sambuc
349f4a2713aSLionel Sambucdef CStringOutOfBounds : Checker<"OutOfBounds">,
350f4a2713aSLionel Sambuc  HelpText<"Check for out-of-bounds access in string functions">,
351f4a2713aSLionel Sambuc  DescFile<"CStringChecker.cpp">;
352f4a2713aSLionel Sambuc
353f4a2713aSLionel Sambucdef CStringBufferOverlap : Checker<"BufferOverlap">,
354f4a2713aSLionel Sambuc  HelpText<"Checks for overlap in two buffer arguments">,
355f4a2713aSLionel Sambuc  DescFile<"CStringChecker.cpp">;
356f4a2713aSLionel Sambuc
357f4a2713aSLionel Sambucdef CStringNotNullTerm : Checker<"NotNullTerminated">,
358f4a2713aSLionel Sambuc  HelpText<"Check for arguments which are not null-terminating strings">,
359f4a2713aSLionel Sambuc  DescFile<"CStringChecker.cpp">;
360f4a2713aSLionel Sambuc}
361f4a2713aSLionel Sambuc
362f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
363f4a2713aSLionel Sambuc// Mac OS X, Cocoa, and Core Foundation checkers.
364f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
365f4a2713aSLionel Sambuc
366f4a2713aSLionel Sambuclet ParentPackage = OSX in {
367f4a2713aSLionel Sambuc
368f4a2713aSLionel Sambucdef MacOSXAPIChecker : Checker<"API">,
369f4a2713aSLionel Sambuc  InPackage<OSX>,
370f4a2713aSLionel Sambuc  HelpText<"Check for proper uses of various Apple APIs">,
371f4a2713aSLionel Sambuc  DescFile<"MacOSXAPIChecker.cpp">;
372f4a2713aSLionel Sambuc
373f4a2713aSLionel Sambucdef MacOSKeychainAPIChecker : Checker<"SecKeychainAPI">,
374f4a2713aSLionel Sambuc  InPackage<OSX>,
375f4a2713aSLionel Sambuc  HelpText<"Check for proper uses of Secure Keychain APIs">,
376f4a2713aSLionel Sambuc  DescFile<"MacOSKeychainAPIChecker.cpp">;
377f4a2713aSLionel Sambuc
378f4a2713aSLionel Sambuc} // end "osx"
379f4a2713aSLionel Sambuc
380f4a2713aSLionel Sambuclet ParentPackage = Cocoa in {
381f4a2713aSLionel Sambuc
382f4a2713aSLionel Sambucdef ObjCAtSyncChecker : Checker<"AtSync">,
383f4a2713aSLionel Sambuc  HelpText<"Check for nil pointers used as mutexes for @synchronized">,
384f4a2713aSLionel Sambuc  DescFile<"ObjCAtSyncChecker.cpp">;
385f4a2713aSLionel Sambuc
386f4a2713aSLionel Sambucdef NilArgChecker : Checker<"NilArg">,
387f4a2713aSLionel Sambuc  HelpText<"Check for prohibited nil arguments to ObjC method calls">,
388f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
389f4a2713aSLionel Sambuc
390f4a2713aSLionel Sambucdef ClassReleaseChecker : Checker<"ClassRelease">,
391f4a2713aSLionel Sambuc  HelpText<"Check for sending 'retain', 'release', or 'autorelease' directly to a Class">,
392f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
393f4a2713aSLionel Sambuc
394f4a2713aSLionel Sambucdef VariadicMethodTypeChecker : Checker<"VariadicMethodTypes">,
395f4a2713aSLionel Sambuc  HelpText<"Check for passing non-Objective-C types to variadic collection "
396f4a2713aSLionel Sambuc           "initialization methods that expect only Objective-C types">,
397f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
398f4a2713aSLionel Sambuc
399f4a2713aSLionel Sambucdef NSAutoreleasePoolChecker : Checker<"NSAutoreleasePool">,
400f4a2713aSLionel Sambuc  HelpText<"Warn for suboptimal uses of NSAutoreleasePool in Objective-C GC mode">,
401f4a2713aSLionel Sambuc  DescFile<"NSAutoreleasePoolChecker.cpp">;
402f4a2713aSLionel Sambuc
403f4a2713aSLionel Sambucdef ObjCMethSigsChecker : Checker<"IncompatibleMethodTypes">,
404f4a2713aSLionel Sambuc  HelpText<"Warn about Objective-C method signatures with type incompatibilities">,
405f4a2713aSLionel Sambuc  DescFile<"CheckObjCInstMethSignature.cpp">;
406f4a2713aSLionel Sambuc
407f4a2713aSLionel Sambucdef ObjCUnusedIvarsChecker : Checker<"UnusedIvars">,
408f4a2713aSLionel Sambuc  HelpText<"Warn about private ivars that are never used">,
409f4a2713aSLionel Sambuc  DescFile<"ObjCUnusedIVarsChecker.cpp">;
410f4a2713aSLionel Sambuc
411f4a2713aSLionel Sambucdef ObjCSelfInitChecker : Checker<"SelfInit">,
412f4a2713aSLionel Sambuc  HelpText<"Check that 'self' is properly initialized inside an initializer method">,
413f4a2713aSLionel Sambuc  DescFile<"ObjCSelfInitChecker.cpp">;
414f4a2713aSLionel Sambuc
415f4a2713aSLionel Sambucdef ObjCLoopChecker : Checker<"Loops">,
416f4a2713aSLionel Sambuc  HelpText<"Improved modeling of loops using Cocoa collection types">,
417f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
418f4a2713aSLionel Sambuc
419f4a2713aSLionel Sambucdef ObjCNonNilReturnValueChecker : Checker<"NonNilReturnValue">,
420f4a2713aSLionel Sambuc  HelpText<"Model the APIs that are guaranteed to return a non-nil value">,
421f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
422f4a2713aSLionel Sambuc
423*0a6a1f1dSLionel Sambucdef ObjCSuperCallChecker : Checker<"MissingSuperCall">,
424*0a6a1f1dSLionel Sambuc  HelpText<"Warn about Objective-C methods that lack a necessary call to super">,
425*0a6a1f1dSLionel Sambuc  DescFile<"ObjCMissingSuperCallChecker.cpp">;
426*0a6a1f1dSLionel Sambuc
427f4a2713aSLionel Sambucdef NSErrorChecker : Checker<"NSError">,
428f4a2713aSLionel Sambuc  HelpText<"Check usage of NSError** parameters">,
429f4a2713aSLionel Sambuc  DescFile<"NSErrorChecker.cpp">;
430f4a2713aSLionel Sambuc
431f4a2713aSLionel Sambucdef RetainCountChecker : Checker<"RetainCount">,
432f4a2713aSLionel Sambuc  HelpText<"Check for leaks and improper reference count management">,
433f4a2713aSLionel Sambuc  DescFile<"RetainCountChecker.cpp">;
434f4a2713aSLionel Sambuc
435f4a2713aSLionel Sambuc} // end "osx.cocoa"
436f4a2713aSLionel Sambuc
437f4a2713aSLionel Sambuclet ParentPackage = CocoaAlpha in {
438f4a2713aSLionel Sambuc
439f4a2713aSLionel Sambucdef ObjCDeallocChecker : Checker<"Dealloc">,
440f4a2713aSLionel Sambuc  HelpText<"Warn about Objective-C classes that lack a correct implementation of -dealloc">,
441f4a2713aSLionel Sambuc  DescFile<"CheckObjCDealloc.cpp">;
442f4a2713aSLionel Sambuc
443f4a2713aSLionel Sambucdef InstanceVariableInvalidation : Checker<"InstanceVariableInvalidation">,
444f4a2713aSLionel Sambuc  HelpText<"Check that the invalidatable instance variables are invalidated in the methods annotated with objc_instance_variable_invalidator">,
445f4a2713aSLionel Sambuc  DescFile<"IvarInvalidationChecker.cpp">;
446f4a2713aSLionel Sambuc
447f4a2713aSLionel Sambucdef MissingInvalidationMethod : Checker<"MissingInvalidationMethod">,
448f4a2713aSLionel Sambuc  HelpText<"Check that the invalidation methods are present in classes that contain invalidatable instance variables">,
449f4a2713aSLionel Sambuc  DescFile<"IvarInvalidationChecker.cpp">;
450f4a2713aSLionel Sambuc
451f4a2713aSLionel Sambucdef DirectIvarAssignment : Checker<"DirectIvarAssignment">,
452f4a2713aSLionel Sambuc  HelpText<"Check for direct assignments to instance variables">,
453f4a2713aSLionel Sambuc  DescFile<"DirectIvarAssignment.cpp">;
454f4a2713aSLionel Sambuc
455f4a2713aSLionel Sambucdef DirectIvarAssignmentForAnnotatedFunctions : Checker<"DirectIvarAssignmentForAnnotatedFunctions">,
456f4a2713aSLionel Sambuc  HelpText<"Check for direct assignments to instance variables in the methods annotated with objc_no_direct_instance_variable_assignment">,
457f4a2713aSLionel Sambuc  DescFile<"DirectIvarAssignment.cpp">;
458f4a2713aSLionel Sambuc
459f4a2713aSLionel Sambuc} // end "alpha.osx.cocoa"
460f4a2713aSLionel Sambuc
461f4a2713aSLionel Sambuclet ParentPackage = CoreFoundation in {
462f4a2713aSLionel Sambuc
463f4a2713aSLionel Sambucdef CFNumberCreateChecker : Checker<"CFNumber">,
464f4a2713aSLionel Sambuc  HelpText<"Check for proper uses of CFNumberCreate">,
465f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
466f4a2713aSLionel Sambuc
467f4a2713aSLionel Sambucdef CFRetainReleaseChecker : Checker<"CFRetainRelease">,
468f4a2713aSLionel Sambuc  HelpText<"Check for null arguments to CFRetain/CFRelease/CFMakeCollectable">,
469f4a2713aSLionel Sambuc  DescFile<"BasicObjCFoundationChecks.cpp">;
470f4a2713aSLionel Sambuc
471f4a2713aSLionel Sambucdef CFErrorChecker : Checker<"CFError">,
472f4a2713aSLionel Sambuc  HelpText<"Check usage of CFErrorRef* parameters">,
473f4a2713aSLionel Sambuc  DescFile<"NSErrorChecker.cpp">;
474f4a2713aSLionel Sambuc}
475f4a2713aSLionel Sambuc
476f4a2713aSLionel Sambuclet ParentPackage = Containers in {
477f4a2713aSLionel Sambucdef ObjCContainersASTChecker : Checker<"PointerSizedValues">,
478f4a2713aSLionel Sambuc  HelpText<"Warns if 'CFArray', 'CFDictionary', 'CFSet' are created with non-pointer-size values">,
479f4a2713aSLionel Sambuc  DescFile<"ObjCContainersASTChecker.cpp">;
480f4a2713aSLionel Sambuc
481f4a2713aSLionel Sambucdef ObjCContainersChecker : Checker<"OutOfBounds">,
482f4a2713aSLionel Sambuc  HelpText<"Checks for index out-of-bounds when using 'CFArray' API">,
483f4a2713aSLionel Sambuc  DescFile<"ObjCContainersChecker.cpp">;
484f4a2713aSLionel Sambuc
485f4a2713aSLionel Sambuc}
486f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
487f4a2713aSLionel Sambuc// Checkers for LLVM development.
488f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
489f4a2713aSLionel Sambuc
490f4a2713aSLionel Sambucdef LLVMConventionsChecker : Checker<"Conventions">,
491f4a2713aSLionel Sambuc  InPackage<LLVM>,
492f4a2713aSLionel Sambuc  HelpText<"Check code for LLVM codebase conventions">,
493f4a2713aSLionel Sambuc  DescFile<"LLVMConventionsChecker.cpp">;
494f4a2713aSLionel Sambuc
495f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
496f4a2713aSLionel Sambuc// Debugging checkers (for analyzer development).
497f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
498f4a2713aSLionel Sambuc
499f4a2713aSLionel Sambuclet ParentPackage = Debug in {
500f4a2713aSLionel Sambuc
501f4a2713aSLionel Sambucdef DominatorsTreeDumper : Checker<"DumpDominators">,
502f4a2713aSLionel Sambuc  HelpText<"Print the dominance tree for a given CFG">,
503f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
504f4a2713aSLionel Sambuc
505f4a2713aSLionel Sambucdef LiveVariablesDumper : Checker<"DumpLiveVars">,
506f4a2713aSLionel Sambuc  HelpText<"Print results of live variable analysis">,
507f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
508f4a2713aSLionel Sambuc
509f4a2713aSLionel Sambucdef CFGViewer : Checker<"ViewCFG">,
510f4a2713aSLionel Sambuc  HelpText<"View Control-Flow Graphs using GraphViz">,
511f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
512f4a2713aSLionel Sambuc
513f4a2713aSLionel Sambucdef CFGDumper : Checker<"DumpCFG">,
514f4a2713aSLionel Sambuc  HelpText<"Display Control-Flow Graphs">,
515f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
516f4a2713aSLionel Sambuc
517f4a2713aSLionel Sambucdef CallGraphViewer : Checker<"ViewCallGraph">,
518f4a2713aSLionel Sambuc  HelpText<"View Call Graph using GraphViz">,
519f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
520f4a2713aSLionel Sambuc
521f4a2713aSLionel Sambucdef CallGraphDumper : Checker<"DumpCallGraph">,
522f4a2713aSLionel Sambuc  HelpText<"Display Call Graph">,
523f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
524f4a2713aSLionel Sambuc
525f4a2713aSLionel Sambucdef ConfigDumper : Checker<"ConfigDumper">,
526f4a2713aSLionel Sambuc  HelpText<"Dump config table">,
527f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
528f4a2713aSLionel Sambuc
529f4a2713aSLionel Sambucdef TraversalDumper : Checker<"DumpTraversal">,
530f4a2713aSLionel Sambuc  HelpText<"Print branch conditions as they are traversed by the engine">,
531f4a2713aSLionel Sambuc  DescFile<"TraversalChecker.cpp">;
532f4a2713aSLionel Sambuc
533f4a2713aSLionel Sambucdef CallDumper : Checker<"DumpCalls">,
534f4a2713aSLionel Sambuc  HelpText<"Print calls as they are traversed by the engine">,
535f4a2713aSLionel Sambuc  DescFile<"TraversalChecker.cpp">;
536f4a2713aSLionel Sambuc
537f4a2713aSLionel Sambucdef AnalyzerStatsChecker : Checker<"Stats">,
538f4a2713aSLionel Sambuc  HelpText<"Emit warnings with analyzer statistics">,
539f4a2713aSLionel Sambuc  DescFile<"AnalyzerStatsChecker.cpp">;
540f4a2713aSLionel Sambuc
541f4a2713aSLionel Sambucdef TaintTesterChecker : Checker<"TaintTest">,
542f4a2713aSLionel Sambuc  HelpText<"Mark tainted symbols as such.">,
543f4a2713aSLionel Sambuc  DescFile<"TaintTesterChecker.cpp">;
544f4a2713aSLionel Sambuc
545f4a2713aSLionel Sambucdef ExprInspectionChecker : Checker<"ExprInspection">,
546f4a2713aSLionel Sambuc  HelpText<"Check the analyzer's understanding of expressions">,
547f4a2713aSLionel Sambuc  DescFile<"ExprInspectionChecker.cpp">;
548f4a2713aSLionel Sambuc
549f4a2713aSLionel Sambucdef ExplodedGraphViewer : Checker<"ViewExplodedGraph">,
550f4a2713aSLionel Sambuc  HelpText<"View Exploded Graphs using GraphViz">,
551f4a2713aSLionel Sambuc  DescFile<"DebugCheckers.cpp">;
552f4a2713aSLionel Sambuc
553f4a2713aSLionel Sambuc} // end "debug"
554