• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- CheckerProvider.h - Static Analyzer Checkers Provider --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Defines the Static Analyzer Checker Provider.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_SA_CORE_CHECKERPROVIDER_H
15 #define LLVM_CLANG_SA_CORE_CHECKERPROVIDER_H
16 
17 #include "llvm/ADT/StringRef.h"
18 
19 namespace llvm {
20   class raw_ostream;
21 }
22 
23 namespace clang {
24 
25 namespace ento {
26   class CheckerManager;
27 
28 class CheckerOptInfo {
29   const char *Name;
30   bool Enable;
31   bool Claimed;
32 
33 public:
CheckerOptInfo(const char * name,bool enable)34   CheckerOptInfo(const char *name, bool enable)
35     : Name(name), Enable(enable), Claimed(false) { }
36 
getName()37   const char *getName() const { return Name; }
isEnabled()38   bool isEnabled() const { return Enable; }
isDisabled()39   bool isDisabled() const { return !isEnabled(); }
40 
isClaimed()41   bool isClaimed() const { return Claimed; }
isUnclaimed()42   bool isUnclaimed() const { return !isClaimed(); }
claim()43   void claim() { Claimed = true; }
44 };
45 
46 class CheckerProvider {
47 public:
48   virtual ~CheckerProvider();
49   virtual void registerCheckers(CheckerManager &checkerMgr,
50                           CheckerOptInfo *checkOpts, unsigned numCheckOpts) = 0;
51   virtual void printHelp(llvm::raw_ostream &OS) = 0;
52 };
53 
54 } // end ento namespace
55 
56 } // end clang namespace
57 
58 #endif
59