/// "core.builtin", or the full name "core.builtin.NoReturnFunctionChecker".
class CheckerRegistry {
public:
- CheckerRegistry(ArrayRef<std::string> plugins, DiagnosticsEngine &diags,
- AnalyzerOptions &AnOpts, const LangOptions &LangOpts);
+ CheckerRegistry(
+ ArrayRef<std::string> plugins, DiagnosticsEngine &diags,
+ AnalyzerOptions &AnOpts, const LangOptions &LangOpts,
+ ArrayRef<std::function<void(CheckerRegistry &)>>
+ checkerRegistrationFns = {});
/// Initialization functions perform any necessary setup for a checker.
/// They should include a call to CheckerManager::registerChecker.
DiagnosticsEngine &diags) {
auto checkerMgr = llvm::make_unique<CheckerManager>(context, opts);
- CheckerRegistry allCheckers(plugins, diags, opts, context.getLangOpts());
-
- for (const auto &Fn : checkerRegistrationFns)
- Fn(allCheckers);
+ CheckerRegistry allCheckers(plugins, diags, opts, context.getLangOpts(),
+ checkerRegistrationFns);
allCheckers.initializeManager(*checkerMgr);
allCheckers.validateCheckerOptions();
return { it, it + size };
}
-CheckerRegistry::CheckerRegistry(ArrayRef<std::string> plugins,
- DiagnosticsEngine &diags,
- AnalyzerOptions &AnOpts,
- const LangOptions &LangOpts)
+CheckerRegistry::CheckerRegistry(
+ ArrayRef<std::string> plugins, DiagnosticsEngine &diags,
+ AnalyzerOptions &AnOpts, const LangOptions &LangOpts,
+ ArrayRef<std::function<void(CheckerRegistry &)>>
+ checkerRegistrationFns)
: Diags(diags), AnOpts(AnOpts), LangOpts(LangOpts) {
// Register builtin checkers.
registerPluginCheckers(*this);
}
+ // Register statically linked checkers, that aren't generated from the tblgen
+ // file, but rather passed their registry function as a parameter in
+ // checkerRegistrationFns.
+
+ for (const auto &Fn : checkerRegistrationFns)
+ Fn(*this);
+
// Sort checkers for efficient collection.
// FIXME: Alphabetical sort puts 'experimental' in the middle.
// Would it be better to name it '~experimental' or something else