[cfe-commits] r86869 - in /cfe/trunk: include/clang/Analysis/ManagerRegistry.h lib/Analysis/ManagerRegistry.cpp

Chandler Carruth chandlerc at gmail.com
Wed Nov 11 13:43:37 CST 2009


Author: chandlerc
Date: Wed Nov 11 13:43:37 2009
New Revision: 86869

URL: http://llvm.org/viewvc/llvm-project?rev=86869&view=rev
Log:
After drinking caffeine, add the two files missing from the previous submit.
Sorry about that.

Added:
    cfe/trunk/include/clang/Analysis/ManagerRegistry.h
    cfe/trunk/lib/Analysis/ManagerRegistry.cpp

Added: cfe/trunk/include/clang/Analysis/ManagerRegistry.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/ManagerRegistry.h?rev=86869&view=auto

==============================================================================
--- cfe/trunk/include/clang/Analysis/ManagerRegistry.h (added)
+++ cfe/trunk/include/clang/Analysis/ManagerRegistry.h Wed Nov 11 13:43:37 2009
@@ -0,0 +1,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_ANALYSIS_MANAGER_REGISTRY_H
+#define LLVM_CLANG_ANALYSIS_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

Added: cfe/trunk/lib/Analysis/ManagerRegistry.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ManagerRegistry.cpp?rev=86869&view=auto

==============================================================================
--- cfe/trunk/lib/Analysis/ManagerRegistry.cpp (added)
+++ cfe/trunk/lib/Analysis/ManagerRegistry.cpp Wed Nov 11 13:43:37 2009
@@ -0,0 +1,20 @@
+//===- ManagerRegistry.cpp - Pluggble Analyzer module creators --*- 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 pluggable analyzer module creators.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Analysis/ManagerRegistry.h"
+
+using namespace clang;
+
+StoreManagerCreator ManagerRegistry::StoreMgrCreator = 0;
+
+ConstraintManagerCreator ManagerRegistry::ConstraintMgrCreator = 0;




More information about the cfe-commits mailing list