summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2016-11-08 07:23:32 +0000
committerAlexander Kornienko <alexfh@google.com>2016-11-08 07:23:32 +0000
commit8df2a62ae65530c8a489e7520ff02c2ab6f5db94 (patch)
tree3313f654e932da29715f599615fb9bf6189024e5 /clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
parenta8ca3ed06a669e17c6a52b115525060fbb385072 (diff)
downloadbcm5719-llvm-8df2a62ae65530c8a489e7520ff02c2ab6f5db94.tar.gz
bcm5719-llvm-8df2a62ae65530c8a489e7520ff02c2ab6f5db94.zip
Add a method to get the list of registered static analyzer checkers.
Summary: This provides a better interface for clang-tidy and encapsulates the knowledge about experimental checkers instead of leaving this to the clients. Reviewers: zaks.anna Subscribers: a.sidorin, NoQ, dcoughlin, cfe-commits Differential Revision: https://reviews.llvm.org/D26310 llvm-svn: 286218
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
index 86c194e8fae..15422633ba3 100644
--- a/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ b/clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -23,6 +23,25 @@ using namespace clang;
using namespace ento;
using namespace llvm;
+std::vector<StringRef>
+AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental /* = false */) {
+ static const StringRef StaticAnalyzerChecks[] = {
+#define GET_CHECKERS
+#define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN) \
+ FULLNAME,
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+#undef CHECKER
+#undef GET_CHECKERS
+ };
+ std::vector<StringRef> Result;
+ for (StringRef CheckName : StaticAnalyzerChecks) {
+ if (!CheckName.startswith("debug.") &&
+ (IncludeExperimental || !CheckName.startswith("alpha.")))
+ Result.push_back(CheckName);
+ }
+ return Result;
+}
+
AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() {
if (UserMode == UMK_NotSet) {
StringRef ModeStr =
OpenPOWER on IntegriCloud