[PATCH] D49233: [analyzer] Create generic SMT Context class

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 25 05:49:19 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337914: [analyzer] Create generic SMT Context class (authored by mramalho, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49233?vs=156281&id=157243#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49233

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h
  cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp


Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h
===================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h
@@ -0,0 +1,30 @@
+//== SMTContext.h -----------------------------------------------*- 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 a SMT generic Context API, which will be the base class
+//  for every SMT solver context specific class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SMTCONTEXT_H
+#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SMTCONTEXT_H
+
+namespace clang {
+namespace ento {
+
+class SMTContext {
+public:
+  SMTContext() = default;
+  virtual ~SMTContext() = default;
+};
+
+} // namespace ento
+} // namespace clang
+
+#endif
Index: cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp
@@ -11,6 +11,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/SMTContext.h"
 
 #include "clang/Config/config.h"
 
@@ -63,19 +64,22 @@
   ~Z3Config() { Z3_del_config(Config); }
 }; // end class Z3Config
 
-class Z3Context {
-  Z3_context ZC_P;
-
+class Z3Context : public SMTContext {
 public:
   static Z3_context ZC;
 
-  Z3Context() : ZC_P(Z3_mk_context_rc(Z3Config().Config)) { ZC = ZC_P; }
+  Z3Context() : SMTContext() {
+    Context = Z3_mk_context_rc(Z3Config().Config);
+    ZC = Context;
+  }
 
   ~Z3Context() {
     Z3_del_context(ZC);
-    Z3_finalize_memory();
-    ZC_P = nullptr;
+    Context = nullptr;
   }
+
+protected:
+  Z3_context Context;
 }; // end class Z3Context
 
 class Z3Sort {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49233.157243.patch
Type: text/x-patch
Size: 2386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180725/3e6ec5f1/attachment.bin>


More information about the llvm-commits mailing list