summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
diff options
context:
space:
mode:
authorKristof Umann <kristof.umann@ericsson.com>2019-05-01 19:56:47 +0000
committerKristof Umann <kristof.umann@ericsson.com>2019-05-01 19:56:47 +0000
commit9f7fc9838a21e0d7c67233f9dd2d17a63f6b0655 (patch)
tree97db518b6d449d87385f9421928a230b0ab4d293 /clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
parent20c5676416d3b1fff74ee4603d4eb1c646ae22bd (diff)
downloadbcm5719-llvm-9f7fc9838a21e0d7c67233f9dd2d17a63f6b0655.tar.gz
bcm5719-llvm-9f7fc9838a21e0d7c67233f9dd2d17a63f6b0655.zip
[analyzer] Don't display implementation checkers under -analyzer-checker-help, but do under the new flag -analyzer-checker-help-hidden
During my work on analyzer dependencies, I created a great amount of new checkers that emitted no diagnostics at all, and were purely modeling some function or another. However, the user shouldn't really disable/enable these by hand, hence this patch, which hides these by default. I intentionally chose not to hide alpha checkers, because they have a scary enough name, in my opinion, to cause no surprise when they emit false positives or cause crashes. The patch introduces the Hidden bit into the TableGen files (you may remember it before I removed it in D53995), and checkers that are either marked as hidden, or are in a package that is marked hidden won't be displayed under -analyzer-checker-help. -analyzer-checker-help-hidden, a new flag meant for developers only, displays the full list. Differential Revision: https://reviews.llvm.org/D60925 llvm-svn: 359720
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
index f1ee454f632..4267d8a2cdc 100644
--- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
@@ -115,9 +115,9 @@ CheckerRegistry::CheckerRegistry(
// Register builtin checkers.
#define GET_CHECKERS
-#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI) \
+#define CHECKER(FULLNAME, CLASS, HELPTEXT, DOC_URI, IS_HIDDEN) \
addChecker(register##CLASS, shouldRegister##CLASS, FULLNAME, HELPTEXT, \
- DOC_URI);
+ DOC_URI, IS_HIDDEN);
#define GET_PACKAGES
#define PACKAGE(FULLNAME) addPackage(FULLNAME);
@@ -350,8 +350,9 @@ void CheckerRegistry::addPackageOption(StringRef OptionType,
void CheckerRegistry::addChecker(InitializationFunction Rfn,
ShouldRegisterFunction Sfn, StringRef Name,
- StringRef Desc, StringRef DocsUri) {
- Checkers.emplace_back(Rfn, Sfn, Name, Desc, DocsUri);
+ StringRef Desc, StringRef DocsUri,
+ bool IsHidden) {
+ Checkers.emplace_back(Rfn, Sfn, Name, Desc, DocsUri, IsHidden);
// Record the presence of the checker in its packages.
StringRef PackageName, LeafName;
@@ -421,6 +422,9 @@ void CheckerRegistry::printCheckerWithDescList(raw_ostream &Out,
const size_t InitialPad = 2;
for (const auto &Checker : Checkers) {
+ if (!AnOpts.ShowCheckerHelpHidden && Checker.IsHidden)
+ continue;
+
Out.indent(InitialPad) << Checker.FullName;
int Pad = OptionFieldWidth - Checker.FullName.size();
OpenPOWER on IntegriCloud