]> granicus.if.org Git - clang/commitdiff
[analyzer] Allow a checker to be hidden even if its package is hidden & enabled.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 24 Feb 2011 21:42:52 +0000 (21:42 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 24 Feb 2011 21:42:52 +0000 (21:42 +0000)
For example, if 'core.experimental.UnreachableCode' is hidden, it should not be enabled with 'core.experimental'.
Note that this requires llvm commit r126436.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126439 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Checkers/ClangSACheckerProvider.cpp

index 0320d28b9a72ae5b91fd2f088da61a01da2b6a92..9bcd6c668dc774d35172ed17bd0fdccb1e824a01 100644 (file)
@@ -137,7 +137,8 @@ def CStringChecker : Checker<"CString">,
 def UnreachableCodeChecker : Checker<"UnreachableCode">,
   InPackage<CoreExperimental>,
   HelpText<"Check unreachable code">,
-  DescFile<"UnreachableCodeChecker.cpp">;
+  DescFile<"UnreachableCodeChecker.cpp">,
+  Hidden; // Must be specified explicitly in order to run.
 
 def IdempotentOperationChecker : Checker<"IdempotentOps">,
   InPackage<CoreExperimental>,
index 94f200f3e8929b12f7a00bb7660693f51d330266..aefaf5480204eaff330723a043f6ab5972e1800c 100644 (file)
@@ -104,9 +104,10 @@ static void collectCheckers(const CheckNameOption *checkName,
 
   // Enable/disable all subgroups along with this one.
   if (const short *subGroups = checkName->SubGroups) {
-    for (; *subGroups != -1; ++subGroups)
-      collectCheckers(&CheckNameTable[*subGroups], enable, checkers,
-                      collectHidden && checkName->Hidden);
+    for (; *subGroups != -1; ++subGroups) {
+      const CheckNameOption *sub = &CheckNameTable[*subGroups];
+      collectCheckers(sub, enable, checkers, collectHidden && !sub->Hidden);
+    }
   }
 }