summaryrefslogtreecommitdiffstats
path: root/include/clang/Frontend/ManagerRegistry.h
blob: ecab67a3b67691e00c8b0a313c169bf7396d2fe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//===-- ManagerRegistry.h - Pluggable analyzer module registry --*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the ManagerRegistry and Register* classes.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_FRONTEND_MANAGER_REGISTRY_H
#define LLVM_CLANG_FRONTEND_MANAGER_REGISTRY_H

#include "clang/Analysis/PathSensitive/GRState.h"

namespace clang {

/// ManagerRegistry - This class records manager creators registered at
/// runtime. The information is communicated to AnalysisManager through static
/// members. Better design is expected.

class ManagerRegistry {
public:
  static StoreManagerCreator StoreMgrCreator;
  static ConstraintManagerCreator ConstraintMgrCreator;
};

/// RegisterConstraintManager - This class is used to setup the constraint
/// manager of the static analyzer. The constructor takes a creator function
/// pointer for creating the constraint manager.
///
/// It is used like this:
///
/// class MyConstraintManager {};
/// ConstraintManager* CreateMyConstraintManager(GRStateManager& statemgr) {
///  return new MyConstraintManager(statemgr);
/// }
/// RegisterConstraintManager X(CreateMyConstraintManager);

class RegisterConstraintManager {
public:
  RegisterConstraintManager(ConstraintManagerCreator CMC) {
    assert(ManagerRegistry::ConstraintMgrCreator == 0 
           && "ConstraintMgrCreator already set!");
    ManagerRegistry::ConstraintMgrCreator = CMC;
  }
};

}
#endif
OpenPOWER on IntegriCloud