aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Core/CheckerProvider.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-14 18:13:31 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-14 18:13:31 +0000
commit43dee220252ef0b42c5f8a3bb1eca97f84f2565f (patch)
tree58da397a333119178a2aacb3564397dd1b01ea20 /include/clang/StaticAnalyzer/Core/CheckerProvider.h
parent5f83d6f36a7308eef21d87104fd70c421e854448 (diff)
[analyzer] Overhauling of the checker registration mechanism.
-Checkers will be defined in the tablegen file 'Checkers.td'. -Apart from checkers, we can define checker "packages" that will contain a collection of checkers. -Checkers can be enabled with -analyzer-checker=<name> and disabled with -analyzer-disable-checker=<name> e.g: Enable checkers from 'cocoa' and 'corefoundation' packages except the self-initialization checker: -analyzer-checker=cocoa -analyzer-checker=corefoundation -analyzer-disable-checker=cocoa.SelfInit -Introduces CheckerManager and CheckerProvider. CheckerProviders get the set of checker names to enable/disable and register them with the CheckerManager which will be the entry point for all checker-related functionality. Currently only the self-initialization checker takes advantage of the new mechanism. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/CheckerProvider.h')
-rw-r--r--include/clang/StaticAnalyzer/Core/CheckerProvider.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/include/clang/StaticAnalyzer/Core/CheckerProvider.h b/include/clang/StaticAnalyzer/Core/CheckerProvider.h
new file mode 100644
index 0000000000..414ad92b2a
--- /dev/null
+++ b/include/clang/StaticAnalyzer/Core/CheckerProvider.h
@@ -0,0 +1,54 @@
+//===--- CheckerProvider.h - Static Analyzer Checkers Provider --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines the Static Analyzer Checker Provider.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SA_CORE_CHECKERPROVIDER_H
+#define LLVM_CLANG_SA_CORE_CHECKERPROVIDER_H
+
+#include "llvm/ADT/StringRef.h"
+#include <vector>
+
+namespace clang {
+
+namespace ento {
+ class CheckerManager;
+
+class CheckerOptInfo {
+ const char *Name;
+ bool Enable;
+ bool Claimed;
+
+public:
+ CheckerOptInfo(const char *name, bool enable)
+ : Name(name), Enable(enable), Claimed(false) { }
+
+ const char *getName() const { return Name; }
+ bool isEnabled() const { return Enable; }
+ bool isDisabled() const { return !isEnabled(); }
+
+ bool isClaimed() const { return Claimed; }
+ bool isUnclaimed() const { return !isClaimed(); }
+ void claim() { Claimed = true; }
+};
+
+class CheckerProvider {
+public:
+ virtual ~CheckerProvider();
+ virtual void registerCheckers(CheckerManager &checkerMgr,
+ CheckerOptInfo *checkOpts, unsigned numCheckOpts) = 0;
+};
+
+} // end ento namespace
+
+} // end clang namespace
+
+#endif