1 //===-- ManagerRegistry.h - Pluggable analyzer module registry --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the ManagerRegistry and Register* classes.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_ANALYSIS_MANAGER_REGISTRY_H
15 #define LLVM_CLANG_ANALYSIS_MANAGER_REGISTRY_H
17 #include "clang/Checker/PathSensitive/GRState.h"
21 /// ManagerRegistry - This class records manager creators registered at
22 /// runtime. The information is communicated to AnalysisManager through static
23 /// members. Better design is expected.
25 class ManagerRegistry
{
27 static StoreManagerCreator StoreMgrCreator
;
28 static ConstraintManagerCreator ConstraintMgrCreator
;
31 /// RegisterConstraintManager - This class is used to setup the constraint
32 /// manager of the static analyzer. The constructor takes a creator function
33 /// pointer for creating the constraint manager.
35 /// It is used like this:
37 /// class MyConstraintManager {};
38 /// ConstraintManager* CreateMyConstraintManager(GRStateManager& statemgr) {
39 /// return new MyConstraintManager(statemgr);
41 /// RegisterConstraintManager X(CreateMyConstraintManager);
43 class RegisterConstraintManager
{
45 RegisterConstraintManager(ConstraintManagerCreator CMC
) {
46 assert(ManagerRegistry::ConstraintMgrCreator
== 0
47 && "ConstraintMgrCreator already set!");
48 ManagerRegistry::ConstraintMgrCreator
= CMC
;