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