2011-02-15 02:13:31 +08:00
|
|
|
//===--- Checkers.td - Static Analyzer Checkers -===-----------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "clang/StaticAnalyzer/Checkers/CheckerBase.td"
|
|
|
|
|
2011-02-16 05:25:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Packages.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-02-15 15:42:33 +08:00
|
|
|
def Core : Package<"core">;
|
2011-02-15 02:13:31 +08:00
|
|
|
def Cocoa : Package<"cocoa">;
|
2011-02-15 15:42:33 +08:00
|
|
|
def Unix : Package<"unix">;
|
|
|
|
def MacOSX : Package<"macosx">;
|
|
|
|
|
2011-02-16 05:25:03 +08:00
|
|
|
def CoreExperimental : Package<"experimental">,
|
|
|
|
InPackage<Core>, Hidden;
|
|
|
|
|
2011-02-18 05:39:33 +08:00
|
|
|
def CocoaExperimental : Package<"experimental">,
|
|
|
|
InPackage<Cocoa>, Hidden;
|
|
|
|
|
2011-02-16 05:25:03 +08:00
|
|
|
def UnixExperimental : Package<"experimental">,
|
|
|
|
InPackage<Unix>, Hidden;
|
|
|
|
|
2011-02-18 05:39:24 +08:00
|
|
|
def LLVM : Package<"llvm">;
|
2011-02-18 05:39:39 +08:00
|
|
|
def Debug : Package<"debug">;
|
2011-02-18 05:39:24 +08:00
|
|
|
|
2011-02-16 05:25:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Groups.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
def AllExperimental : CheckerGroup<"all-experimental">,
|
|
|
|
Hidden;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Checkers.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-02-15 15:42:33 +08:00
|
|
|
let ParentPackage = Cocoa in {
|
2011-02-15 02:13:31 +08:00
|
|
|
|
2011-02-15 15:42:38 +08:00
|
|
|
def ObjCSelfInitChecker : Checker<"SelfInit">,
|
2011-02-15 02:13:31 +08:00
|
|
|
HelpText<"Check that 'self' is propely initialized inside an initializer method">,
|
|
|
|
DescFile<"ObjCSelfInitChecker.cpp">;
|
2011-02-15 15:42:33 +08:00
|
|
|
|
2011-02-15 15:42:38 +08:00
|
|
|
def ObjCAtSyncChecker : Checker<"AtSync">,
|
2011-02-15 15:42:33 +08:00
|
|
|
HelpText<"Check for null pointers used as mutexes for @synchronized">,
|
|
|
|
DescFile<"ObjCAtSyncChecker.cpp">;
|
|
|
|
|
2011-02-16 09:40:52 +08:00
|
|
|
def NilArgChecker : Checker<"NilArg">,
|
|
|
|
HelpText<"Check for prohibited nil arguments to ObjC method calls">,
|
|
|
|
DescFile<"BasicObjCFoundationChecks.cpp">;
|
|
|
|
|
|
|
|
def ClassReleaseChecker : Checker<"ClassRelease">,
|
|
|
|
HelpText<"Check for sending 'retain', 'release', or 'autorelease' directly to a Class">,
|
|
|
|
DescFile<"BasicObjCFoundationChecks.cpp">;
|
|
|
|
|
|
|
|
def NSAutoreleasePoolChecker : Checker<"NSAutoreleasePool">,
|
|
|
|
HelpText<"Warn for subpar uses of NSAutoreleasePool">,
|
|
|
|
DescFile<"NSAutoreleasePoolChecker.cpp">;
|
|
|
|
|
2011-02-18 05:39:33 +08:00
|
|
|
def ObjCMethSigsChecker : Checker<"MethodSigs">,
|
|
|
|
HelpText<"Warn about Objective-C method signatures with type incompatibilities">,
|
|
|
|
DescFile<"CheckObjCInstMethSignature.cpp">;
|
|
|
|
|
|
|
|
def ObjCUnusedIvarsChecker : Checker<"UnusedIvars">,
|
|
|
|
HelpText<"Warn about private ivars that are never used">,
|
|
|
|
DescFile<"ObjCUnusedIVarsChecker.cpp">;
|
|
|
|
|
2011-02-15 15:42:33 +08:00
|
|
|
}
|
|
|
|
|
2011-02-15 15:42:38 +08:00
|
|
|
def StackAddrLeakChecker : Checker<"StackAddrLeak">,
|
2011-02-15 15:42:33 +08:00
|
|
|
InPackage<Core>,
|
|
|
|
HelpText<"Check that addresses to stack memory are not leaked outside the function">,
|
|
|
|
DescFile<"StackAddrLeakChecker.cpp">;
|
|
|
|
|
2011-02-18 05:39:33 +08:00
|
|
|
def DeadStoresChecker : Checker<"DeadStores">,
|
|
|
|
InPackage<Core>,
|
|
|
|
HelpText<"Check for stores to dead variables">,
|
|
|
|
DescFile<"DeadStoresChecker.cpp">;
|
|
|
|
|
2011-02-15 15:42:38 +08:00
|
|
|
def UnixAPIChecker : Checker<"API">,
|
2011-02-15 15:42:33 +08:00
|
|
|
InPackage<Unix>,
|
|
|
|
HelpText<"Check calls to various UNIX/Posix functions">,
|
|
|
|
DescFile<"UnixAPIChecker.cpp">;
|
|
|
|
|
2011-02-15 15:42:38 +08:00
|
|
|
def MacOSXAPIChecker : Checker<"API">,
|
2011-02-15 15:42:33 +08:00
|
|
|
InPackage<MacOSX>,
|
|
|
|
HelpText<"Check calls to various MacOSXAPIChecker">,
|
|
|
|
DescFile<"MacOSXAPIChecker.cpp">;
|
2011-02-16 05:25:03 +08:00
|
|
|
|
2011-02-16 09:40:52 +08:00
|
|
|
def CFNumberCreateChecker : Checker<"CFNumber">,
|
|
|
|
InPackage<MacOSX>,
|
|
|
|
HelpText<"Check for CFNumberCreate">,
|
|
|
|
DescFile<"BasicObjCFoundationChecks.cpp">;
|
|
|
|
|
|
|
|
def CFRetainReleaseChecker : Checker<"CFRetainRelease">,
|
|
|
|
InPackage<MacOSX>,
|
|
|
|
HelpText<"Check for null arguments to CFRetain/CFRelease">,
|
|
|
|
DescFile<"BasicObjCFoundationChecks.cpp">;
|
|
|
|
|
2011-02-18 05:39:24 +08:00
|
|
|
def LLVMConventionsChecker : Checker<"Conventions">,
|
|
|
|
InPackage<LLVM>,
|
|
|
|
HelpText<"Check code for LLVM codebase conventions">,
|
|
|
|
DescFile<"LLVMConventionsChecker.cpp">;
|
|
|
|
|
2011-02-18 05:39:39 +08:00
|
|
|
def LiveVariablesDumper : Checker<"DumpLiveVars">,
|
|
|
|
InPackage<Debug>,
|
|
|
|
HelpText<"Print results of live variable analysis">,
|
|
|
|
DescFile<"DebugCheckers.cpp">;
|
|
|
|
|
|
|
|
def CFGViewer : Checker<"ViewCFG">,
|
|
|
|
InPackage<Debug>,
|
|
|
|
HelpText<"View Control-Flow Graphs using GraphViz">,
|
|
|
|
DescFile<"DebugCheckers.cpp">;
|
|
|
|
|
|
|
|
def CFGDumper : Checker<"DumpCFG">,
|
|
|
|
InPackage<Debug>,
|
|
|
|
HelpText<"Display Control-Flow Graphs">,
|
|
|
|
DescFile<"DebugCheckers.cpp">;
|
|
|
|
|
2011-02-16 05:25:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Hidden experimental checkers.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
let Group = AllExperimental in {
|
|
|
|
|
|
|
|
def CStringChecker : Checker<"CString">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Check calls to functions in <string.h>">,
|
|
|
|
DescFile<"CStringChecker.cpp">;
|
|
|
|
|
|
|
|
def UnreachableCodeChecker : Checker<"UnreachableCode">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Check unreachable code">,
|
|
|
|
DescFile<"UnreachableCodeChecker.cpp">;
|
|
|
|
|
2011-02-16 06:55:14 +08:00
|
|
|
def IdempotentOperationChecker : Checker<"IdempotentOps">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Warn about idempotent operations">,
|
|
|
|
DescFile<"IdempotentOperationChecker.cpp">;
|
|
|
|
|
2011-02-16 06:55:20 +08:00
|
|
|
def CastToStructChecker : Checker<"CastToStruct">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Check for cast from non-struct pointer to struct pointer">,
|
|
|
|
DescFile<"CastToStructChecker.cpp">;
|
|
|
|
|
|
|
|
def FixedAddressChecker : Checker<"FixedAddr">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Check for assignment of a fixed address to a pointer">,
|
|
|
|
DescFile<"FixedAddressChecker.cpp">;
|
|
|
|
|
|
|
|
def PointerArithChecker : Checker<"PointerArithm">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Check for pointer arithmetic on locations other than array elements">,
|
|
|
|
DescFile<"PointerArithChecker">;
|
|
|
|
|
|
|
|
def PointerSubChecker : Checker<"PointerSub">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Check for pointer subtractions on two pointers pointing to different memory chunks">,
|
|
|
|
DescFile<"PointerSubChecker">;
|
|
|
|
|
2011-02-18 05:39:33 +08:00
|
|
|
def SizeofPointerChecker : Checker<"SizeofPtr">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Warn about unintended use of sizeof() on pointer expressions">,
|
|
|
|
DescFile<"CheckSizeofPointer.cpp">;
|
|
|
|
|
|
|
|
def SecuritySyntaxChecker : Checker<"SecuritySyntactic">,
|
|
|
|
InPackage<CoreExperimental>,
|
|
|
|
HelpText<"Perform quick security checks that require no data flow">,
|
|
|
|
DescFile<"CheckSecuritySyntaxOnly.cpp">;
|
|
|
|
|
|
|
|
def ObjCDeallocChecker : Checker<"Dealloc">,
|
|
|
|
InPackage<CocoaExperimental>,
|
|
|
|
HelpText<"Warn about Objective-C classes that lack a correct implementation of -dealloc">,
|
|
|
|
DescFile<"CheckObjCDealloc.cpp">;
|
|
|
|
|
2011-02-16 05:25:03 +08:00
|
|
|
def ChrootChecker : Checker<"Chroot">,
|
|
|
|
InPackage<UnixExperimental>,
|
|
|
|
HelpText<"Check improper use of chroot">,
|
|
|
|
DescFile<"ChrootChecker.cpp">;
|
|
|
|
|
|
|
|
def PthreadLockChecker : Checker<"PthreadLock">,
|
|
|
|
InPackage<UnixExperimental>,
|
|
|
|
HelpText<"Simple lock -> unlock checker">,
|
|
|
|
DescFile<"PthreadLockChecker.cpp">;
|
|
|
|
|
|
|
|
def StreamChecker : Checker<"Stream">,
|
|
|
|
InPackage<UnixExperimental>,
|
|
|
|
HelpText<"Check stream handling functions">,
|
|
|
|
DescFile<"StreamChecker.cpp">;
|
|
|
|
|
|
|
|
}
|