summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Frontend
diff options
context:
space:
mode:
authorKristof Umann <kristof.umann@ericsson.com>2019-05-23 21:46:51 +0000
committerKristof Umann <kristof.umann@ericsson.com>2019-05-23 21:46:51 +0000
commit5bc40d9b188bb43e2aafafe58d8d169cc7c9b4f1 (patch)
tree3578e16536f1d42617a6c2894cb588bcd8f825d8 /clang/lib/StaticAnalyzer/Frontend
parenta85c0fd918749fe88c3a3bbc5ca23061e88b4536 (diff)
downloadbcm5719-llvm-5bc40d9b188bb43e2aafafe58d8d169cc7c9b4f1.tar.gz
bcm5719-llvm-5bc40d9b188bb43e2aafafe58d8d169cc7c9b4f1.zip
[analyzer] List checkers in 3 categories: released, alpha, developer
Previously, the only way to display the list of available checkers was to invoke the analyzer with -analyzer-checker-help frontend flag. This however wasn't really great from a maintainer standpoint: users came across checkers meant strictly for development purposes that weren't to be tinkered with, or those that were still in development. This patch creates a clearer division in between these categories. From now on, we'll have 3 flags to display the list checkers. These lists are mutually exclusive and can be used in any combination (for example to display both stable and alpha checkers). -analyzer-checker-help: Displays the list for stable, production ready checkers. -analyzer-checker-help-alpha: Displays the list for in development checkers. Enabling is discouraged for non-development purposes. -analyzer-checker-help-developer: Modeling and debug checkers. Modeling checkers shouldn't be enabled/disabled by hand, and debug checkers shouldn't be touched by users. Differential Revision: https://reviews.llvm.org/D62093 llvm-svn: 361558
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend')
-rw-r--r--clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
index d405933ca65..5f96389e597 100644
--- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
+++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
@@ -514,13 +514,36 @@ void CheckerRegistry::printCheckerWithDescList(raw_ostream &Out,
}
const size_t InitialPad = 2;
- for (const auto &Checker : Checkers) {
- if (!AnOpts.ShowCheckerHelpHidden && Checker.IsHidden)
- continue;
- AnalyzerOptions::printFormattedEntry(Out, {Checker.FullName, Checker.Desc},
+ auto Print = [=](llvm::raw_ostream &Out, const CheckerInfo &Checker,
+ StringRef Description) {
+ AnalyzerOptions::printFormattedEntry(Out, {Checker.FullName, Description},
InitialPad, OptionFieldWidth);
Out << '\n';
+ };
+
+ for (const auto &Checker : Checkers) {
+ // The order of this if branches is significant, we wouldn't like to display
+ // developer checkers even in the alpha output. For example,
+ // alpha.cplusplus.IteratorModeling is a modeling checker, hence it's hidden
+ // by default, and users (even when the user is a developer of an alpha
+ // checker) shouldn't normally tinker with whether they should be enabled.
+
+ if (Checker.IsHidden) {
+ if (AnOpts.ShowCheckerHelpDeveloper)
+ Print(Out, Checker, Checker.Desc);
+ continue;
+ }
+
+ if (Checker.FullName.startswith("alpha")) {
+ if (AnOpts.ShowCheckerHelpAlpha)
+ Print(Out, Checker,
+ ("(Enable only for development!) " + Checker.Desc).str());
+ continue;
+ }
+
+ if (AnOpts.ShowCheckerHelp)
+ Print(Out, Checker, Checker.Desc);
}
}
OpenPOWER on IntegriCloud