зеркало из https://github.com/microsoft/clang-1.git
[analyzer] Reflect changes for tablegen'ing the checkers.
-Update tablegen files for checkers, use the tablegen class name for the checker class name. -Update ClangSACheckersProvider to not look into hidden checker packages. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
027a6abdd6
Коммит
26c05b11dc
|
@ -24,9 +24,8 @@ class CheckerGroup<string name> {
|
|||
class InGroup<CheckerGroup G> { CheckerGroup Group = G; }
|
||||
|
||||
// All checkers are an indirect subclass of this.
|
||||
class Checker<string className> {
|
||||
string ClassName = className;
|
||||
string CheckerName;
|
||||
class Checker<string name = ""> {
|
||||
string CheckerName = name;
|
||||
string DescFile;
|
||||
string HelpText;
|
||||
bit Hidden = 0;
|
||||
|
@ -34,7 +33,6 @@ class Checker<string className> {
|
|||
CheckerGroup Group;
|
||||
}
|
||||
|
||||
class Named<string name> { string CheckerName = name; }
|
||||
class DescFile<string filename> { string DescFile = filename; }
|
||||
class HelpText<string text> { string HelpText = text; }
|
||||
class Hidden { bit Hidden = 1; }
|
||||
|
|
|
@ -16,32 +16,27 @@ def MacOSX : Package<"macosx">;
|
|||
|
||||
let ParentPackage = Cocoa in {
|
||||
|
||||
def : Checker<"ObjCSelfInitChecker">,
|
||||
Named<"SelfInit">,
|
||||
def ObjCSelfInitChecker : Checker<"SelfInit">,
|
||||
HelpText<"Check that 'self' is propely initialized inside an initializer method">,
|
||||
DescFile<"ObjCSelfInitChecker.cpp">;
|
||||
|
||||
def : Checker<"ObjCAtSyncChecker">,
|
||||
Named<"AtSync">,
|
||||
def ObjCAtSyncChecker : Checker<"AtSync">,
|
||||
HelpText<"Check for null pointers used as mutexes for @synchronized">,
|
||||
DescFile<"ObjCAtSyncChecker.cpp">;
|
||||
|
||||
}
|
||||
|
||||
def : Checker<"StackAddrLeakChecker">,
|
||||
def StackAddrLeakChecker : Checker<"StackAddrLeak">,
|
||||
InPackage<Core>,
|
||||
Named<"StackAddrLeak">,
|
||||
HelpText<"Check that addresses to stack memory are not leaked outside the function">,
|
||||
DescFile<"StackAddrLeakChecker.cpp">;
|
||||
|
||||
def : Checker<"UnixAPIChecker">,
|
||||
def UnixAPIChecker : Checker<"API">,
|
||||
InPackage<Unix>,
|
||||
Named<"API">,
|
||||
HelpText<"Check calls to various UNIX/Posix functions">,
|
||||
DescFile<"UnixAPIChecker.cpp">;
|
||||
|
||||
def : Checker<"MacOSXAPIChecker">,
|
||||
def MacOSXAPIChecker : Checker<"API">,
|
||||
InPackage<MacOSX>,
|
||||
Named<"API">,
|
||||
HelpText<"Check calls to various MacOSXAPIChecker">,
|
||||
DescFile<"MacOSXAPIChecker.cpp">;
|
||||
|
|
|
@ -62,6 +62,7 @@ struct CheckNameOption {
|
|||
const char *Name;
|
||||
const short *Members;
|
||||
const short *SubGroups;
|
||||
bool Hidden;
|
||||
};
|
||||
|
||||
} // end anonymous namespace.
|
||||
|
@ -88,6 +89,9 @@ static void collectCheckers(const CheckNameOption *checkName,
|
|||
bool enable,
|
||||
llvm::DenseSet<const StaticCheckerInfoRec *> &checkers,
|
||||
bool collectHidden) {
|
||||
if (checkName->Hidden && !collectHidden)
|
||||
return;
|
||||
|
||||
if (const short *member = checkName->Members) {
|
||||
if (enable) {
|
||||
if (collectHidden || !StaticCheckerInfo[*member].Hidden)
|
||||
|
@ -102,14 +106,14 @@ static void collectCheckers(const CheckNameOption *checkName,
|
|||
if (const short *subGroups = checkName->SubGroups) {
|
||||
for (; *subGroups != -1; ++subGroups)
|
||||
collectCheckers(&CheckNameTable[*subGroups], enable, checkers,
|
||||
/*don't enable hidden in subgroups*/ false);
|
||||
collectHidden && checkName->Hidden);
|
||||
}
|
||||
}
|
||||
|
||||
static void collectCheckers(CheckerOptInfo &opt,
|
||||
llvm::DenseSet<const StaticCheckerInfoRec *> &checkers) {
|
||||
const char *optName = opt.getName();
|
||||
CheckNameOption key = { optName, 0, 0 };
|
||||
CheckNameOption key = { optName, 0, 0, false };
|
||||
const CheckNameOption *found =
|
||||
std::lower_bound(CheckNameTable, CheckNameTable + CheckNameTableSize, key,
|
||||
CheckNameOptionCompare);
|
||||
|
|
|
@ -19,6 +19,6 @@ TABLEGEN_INC_FILES_COMMON = 1
|
|||
|
||||
include $(CLANG_LEVEL)/Makefile
|
||||
|
||||
$(ObjDir)/Checkers.inc.tmp : Checkers.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(ObjDir)/Checkers.inc.tmp : Checkers.td $(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include/clang/StaticAnalyzer/Checkers/CheckerBase.td $(TBLGEN) $(ObjDir)/.dir
|
||||
$(Echo) "Building Clang SA Checkers tables with tblgen"
|
||||
$(Verb) $(TableGen) -gen-clang-sa-checkers -I $(PROJ_SRC_DIR)/$(CLANG_LEVEL)/include -o $(call SYSPATH, $@) $<
|
||||
|
|
Загрузка…
Ссылка в новой задаче