зеркало из https://github.com/microsoft/clang-1.git
[analyzer] Checker Packages can now belong to a group. This requires llvm commit r128474.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128475 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fc5c8fc5ff
Коммит
1293cdac69
|
@ -11,18 +11,19 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
class Package<string name> {
|
||||
string PackageName = name;
|
||||
bit Hidden = 0;
|
||||
Package ParentPackage;
|
||||
}
|
||||
class InPackage<Package P> { Package ParentPackage = P; }
|
||||
|
||||
class CheckerGroup<string name> {
|
||||
string GroupName = name;
|
||||
}
|
||||
class InGroup<CheckerGroup G> { CheckerGroup Group = G; }
|
||||
|
||||
class Package<string name> {
|
||||
string PackageName = name;
|
||||
bit Hidden = 0;
|
||||
Package ParentPackage;
|
||||
CheckerGroup Group;
|
||||
}
|
||||
class InPackage<Package P> { Package ParentPackage = P; }
|
||||
|
||||
// All checkers are an indirect subclass of this.
|
||||
class Checker<string name = ""> {
|
||||
string CheckerName = name;
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
|
||||
include "clang/StaticAnalyzer/Checkers/CheckerBase.td"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Groups.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def AllExperimental : CheckerGroup<"all-experimental">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Packages.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -16,35 +22,34 @@ include "clang/StaticAnalyzer/Checkers/CheckerBase.td"
|
|||
def Core : Package<"core">;
|
||||
def CoreBuiltin : Package<"builtin">, InPackage<Core>;
|
||||
def CoreUninitialized : Package<"uninitialized">, InPackage<Core>;
|
||||
def CoreExperimental : Package<"experimental">, InPackage<Core>, Hidden;
|
||||
def CoreExperimental : Package<"experimental">, InPackage<Core>,
|
||||
InGroup<AllExperimental>, Hidden;
|
||||
|
||||
def Cplusplus : Package<"cplusplus">;
|
||||
def CplusplusExperimental : Package<"experimental">, InPackage<Cplusplus>, Hidden;
|
||||
def CplusplusExperimental : Package<"experimental">, InPackage<Cplusplus>,
|
||||
InGroup<AllExperimental>, Hidden;
|
||||
|
||||
def DeadCode : Package<"deadcode">;
|
||||
def DeadCodeExperimental : Package<"experimental">, InPackage<DeadCode>, Hidden;
|
||||
def DeadCodeExperimental : Package<"experimental">, InPackage<DeadCode>,
|
||||
InGroup<AllExperimental>, Hidden;
|
||||
|
||||
def Security : Package <"security">;
|
||||
def SecurityExperimental : Package<"experimental">, InPackage<Security>, Hidden;
|
||||
def SecurityExperimental : Package<"experimental">, InPackage<Security>,
|
||||
InGroup<AllExperimental>, Hidden;
|
||||
|
||||
def Unix : Package<"unix">;
|
||||
def UnixExperimental : Package<"experimental">, InPackage<Unix>, Hidden;
|
||||
def UnixExperimental : Package<"experimental">, InPackage<Unix>,
|
||||
InGroup<AllExperimental>, Hidden;
|
||||
|
||||
def OSX : Package<"osx">;
|
||||
def Cocoa : Package<"cocoa">, InPackage<OSX>;
|
||||
def CocoaExperimental : Package<"experimental">, InPackage<Cocoa>, Hidden;
|
||||
def CocoaExperimental : Package<"experimental">, InPackage<Cocoa>,
|
||||
InGroup<AllExperimental>, Hidden;
|
||||
def CoreFoundation : Package<"coreFoundation">, InPackage<OSX>;
|
||||
|
||||
def LLVM : Package<"llvm">;
|
||||
def Debug : Package<"debug">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Groups.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def AllExperimental : CheckerGroup<"all-experimental">,
|
||||
Hidden;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Core Checkers.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -88,32 +93,26 @@ def StackAddrEscapeChecker : Checker<"StackAddressEscape">,
|
|||
let ParentPackage = CoreExperimental in {
|
||||
|
||||
def CastSizeChecker : Checker<"CastSize">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check when casting a malloc'ed type T, whether the size is a multiple of the size of T">,
|
||||
DescFile<"CastSizeChecker.cpp">;
|
||||
|
||||
def CastToStructChecker : Checker<"CastToStruct">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check for cast from non-struct pointer to struct pointer">,
|
||||
DescFile<"CastToStructChecker.cpp">;
|
||||
|
||||
def FixedAddressChecker : Checker<"FixedAddr">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check for assignment of a fixed address to a pointer">,
|
||||
DescFile<"FixedAddressChecker.cpp">;
|
||||
|
||||
def PointerArithChecker : Checker<"PointerArithm">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check for pointer arithmetic on locations other than array elements">,
|
||||
DescFile<"PointerArithChecker">;
|
||||
|
||||
def PointerSubChecker : Checker<"PointerSub">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check for pointer subtractions on two pointers pointing to different memory chunks">,
|
||||
DescFile<"PointerSubChecker">;
|
||||
|
||||
def SizeofPointerChecker : Checker<"SizeofPtr">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Warn about unintended use of sizeof() on pointer expressions">,
|
||||
DescFile<"CheckSizeofPointer.cpp">;
|
||||
|
||||
|
@ -170,12 +169,10 @@ def ReturnUndefChecker : Checker<"UndefReturn">,
|
|||
let ParentPackage = CplusplusExperimental in {
|
||||
|
||||
def CStringChecker : Checker<"CString">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check calls to functions in <string.h>">,
|
||||
DescFile<"CStringChecker.cpp">;
|
||||
|
||||
def IteratorsChecker : Checker<"Iterators">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check improper uses of STL vector iterators">,
|
||||
DescFile<"IteratorsChecker.cpp">;
|
||||
|
||||
|
@ -200,7 +197,6 @@ def IdempotentOperationChecker : Checker<"IdempotentOperations">,
|
|||
let ParentPackage = DeadCodeExperimental in {
|
||||
|
||||
def UnreachableCodeChecker : Checker<"UnreachableCode">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check unreachable code">,
|
||||
DescFile<"UnreachableCodeChecker.cpp">;
|
||||
|
||||
|
@ -217,17 +213,14 @@ def SecuritySyntaxChecker : Checker<"SecuritySyntactic">,
|
|||
DescFile<"CheckSecuritySyntaxOnly.cpp">;
|
||||
|
||||
def ArrayBoundChecker : Checker<"ArrayBound">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Warn about buffer overflows (older checker)">,
|
||||
DescFile<"ArrayBoundChecker.cpp">;
|
||||
|
||||
def ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Warn about buffer overflows (newer checker)">,
|
||||
DescFile<"ArrayBoundCheckerV2.cpp">;
|
||||
|
||||
def ReturnPointerRangeChecker : Checker<"ReturnPtrRange">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check for an out-of-bound pointer being returned to callers">,
|
||||
DescFile<"ReturnPointerRangeChecker.cpp">;
|
||||
|
||||
|
@ -248,22 +241,18 @@ def UnixAPIChecker : Checker<"API">,
|
|||
let ParentPackage = UnixExperimental in {
|
||||
|
||||
def ChrootChecker : Checker<"Chroot">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check improper use of chroot">,
|
||||
DescFile<"ChrootChecker.cpp">;
|
||||
|
||||
def MallocChecker : Checker<"Malloc">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check for potential memory leaks, double free, and use-after-free problems">,
|
||||
DescFile<"MallocChecker.cpp">;
|
||||
|
||||
def PthreadLockChecker : Checker<"PthreadLock">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Simple lock -> unlock checker">,
|
||||
DescFile<"PthreadLockChecker.cpp">;
|
||||
|
||||
def StreamChecker : Checker<"Stream">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Check stream handling functions">,
|
||||
DescFile<"StreamChecker.cpp">;
|
||||
|
||||
|
@ -331,7 +320,6 @@ def NSErrorChecker : Checker<"NSError">,
|
|||
let ParentPackage = CocoaExperimental in {
|
||||
|
||||
def ObjCDeallocChecker : Checker<"Dealloc">,
|
||||
InGroup<AllExperimental>,
|
||||
HelpText<"Warn about Objective-C classes that lack a correct implementation of -dealloc">,
|
||||
DescFile<"CheckObjCDealloc.cpp">;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче