summaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/StaticAnalyzer/Frontend')
-rw-r--r--include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h15
-rw-r--r--include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h10
-rw-r--r--include/clang/StaticAnalyzer/Frontend/FrontendActions.h2
-rw-r--r--include/clang/StaticAnalyzer/Frontend/ModelConsumer.h4
4 files changed, 25 insertions, 6 deletions
diff --git a/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h b/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
index a9dad6c5e9a29..59fbbc3ca80f9 100644
--- a/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
+++ b/include/clang/StaticAnalyzer/Frontend/AnalysisConsumer.h
@@ -17,6 +17,7 @@
#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/LLVM.h"
+#include <functional>
#include <memory>
namespace clang {
@@ -29,10 +30,24 @@ class CompilerInstance;
namespace ento {
class PathDiagnosticConsumer;
class CheckerManager;
+class CheckerRegistry;
class AnalysisASTConsumer : public ASTConsumer {
public:
virtual void AddDiagnosticConsumer(PathDiagnosticConsumer *Consumer) = 0;
+
+ /// This method allows registering statically linked custom checkers that are
+ /// not a part of the Clang tree. It employs the same mechanism that is used
+ /// by plugins.
+ ///
+ /// Example:
+ ///
+ /// Consumer->AddCheckerRegistrationFn([] (CheckerRegistry& Registry) {
+ /// Registry.addChecker<MyCustomChecker>("example.MyCustomChecker",
+ /// "Description");
+ /// });
+ virtual void
+ AddCheckerRegistrationFn(std::function<void(CheckerRegistry &)> Fn) = 0;
};
/// CreateAnalysisConsumer - Creates an ASTConsumer to run various code
diff --git a/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h b/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h
index 2985b7c117ef6..216a2359efba1 100644
--- a/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h
+++ b/include/clang/StaticAnalyzer/Frontend/CheckerRegistration.h
@@ -11,6 +11,7 @@
#define LLVM_CLANG_STATICANALYZER_FRONTEND_CHECKERREGISTRATION_H
#include "clang/Basic/LLVM.h"
+#include <functional>
#include <memory>
#include <string>
@@ -21,10 +22,13 @@ namespace clang {
namespace ento {
class CheckerManager;
+ class CheckerRegistry;
- std::unique_ptr<CheckerManager>
- createCheckerManager(AnalyzerOptions &opts, const LangOptions &langOpts,
- ArrayRef<std::string> plugins, DiagnosticsEngine &diags);
+ std::unique_ptr<CheckerManager> createCheckerManager(
+ AnalyzerOptions &opts, const LangOptions &langOpts,
+ ArrayRef<std::string> plugins,
+ ArrayRef<std::function<void(CheckerRegistry &)>> checkerRegistrationFns,
+ DiagnosticsEngine &diags);
} // end ento namespace
diff --git a/include/clang/StaticAnalyzer/Frontend/FrontendActions.h b/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
index e66d48b1be1dd..ba37b7f59a02d 100644
--- a/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
+++ b/include/clang/StaticAnalyzer/Frontend/FrontendActions.h
@@ -31,7 +31,7 @@ protected:
StringRef InFile) override;
};
-/// \brief Frontend action to parse model files.
+/// Frontend action to parse model files.
///
/// This frontend action is responsible for parsing model files. Model files can
/// not be parsed on their own, they rely on type information that is available
diff --git a/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h b/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
index 24f8042587f39..fa00ffd16553a 100644
--- a/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
+++ b/include/clang/StaticAnalyzer/Frontend/ModelConsumer.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// \brief This file implements clang::ento::ModelConsumer which is an
+/// This file implements clang::ento::ModelConsumer which is an
/// ASTConsumer for model files.
///
//===----------------------------------------------------------------------===//
@@ -25,7 +25,7 @@ class Stmt;
namespace ento {
-/// \brief ASTConsumer to consume model files' AST.
+/// ASTConsumer to consume model files' AST.
///
/// This consumer collects the bodies of function definitions into a StringMap
/// from a model file.