]> granicus.if.org Git - clang/commitdiff
Got rid of the `Z3ConstraintManager` class
authorMikhail R. Gadelha <mikhail.ramalho@gmail.com>
Thu, 7 Feb 2019 03:18:10 +0000 (03:18 +0000)
committerMikhail R. Gadelha <mikhail.ramalho@gmail.com>
Thu, 7 Feb 2019 03:18:10 +0000 (03:18 +0000)
Now, instead of passing the reference to a shared_ptr, we pass the shared_ptr instead.

I've also removed the check if Z3 is present in CreateZ3ConstraintManager as this function already calls CreateZ3Solver that performs the exactly same check.

Differential Revision: https://reviews.llvm.org/D54976

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353371 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp

index 7e7ec1267beb488c952cf102ea7967eae8514f85..6819e6af86f2b339945e10cd5713562d6fb1ccfb 100644 (file)
@@ -26,12 +26,11 @@ namespace clang {
 namespace ento {
 
 class SMTConstraintManager : public clang::ento::SimpleConstraintManager {
-  SMTSolverRef &Solver;
+  mutable SMTSolverRef Solver = CreateZ3Solver();
 
 public:
-  SMTConstraintManager(clang::ento::SubEngine *SE, clang::ento::SValBuilder &SB,
-                       SMTSolverRef &S)
-      : SimpleConstraintManager(SE, SB), Solver(S) {}
+  SMTConstraintManager(clang::ento::SubEngine *SE, clang::ento::SValBuilder &SB)
+      : SimpleConstraintManager(SE, SB) {}
   virtual ~SMTConstraintManager() = default;
 
   //===------------------------------------------------------------------===//
index 934f56ed6d15f5e5b5e0bac0ec246d9186888962..73474cc9cd8c247d8028634645190ab756ebecf2 100644 (file)
@@ -814,14 +814,6 @@ public:
   }
 }; // end class Z3Solver
 
-class Z3ConstraintManager : public SMTConstraintManager {
-  SMTSolverRef Solver = CreateZ3Solver();
-
-public:
-  Z3ConstraintManager(SubEngine *SE, SValBuilder &SB)
-      : SMTConstraintManager(SE, SB, Solver) {}
-}; // end class Z3ConstraintManager
-
 } // end anonymous namespace
 
 #endif
@@ -839,12 +831,5 @@ SMTSolverRef clang::ento::CreateZ3Solver() {
 
 std::unique_ptr<ConstraintManager>
 ento::CreateZ3ConstraintManager(ProgramStateManager &StMgr, SubEngine *Eng) {
-#if CLANG_ANALYZER_WITH_Z3
-  return llvm::make_unique<Z3ConstraintManager>(Eng, StMgr.getSValBuilder());
-#else
-  llvm::report_fatal_error("Clang was not compiled with Z3 support, rebuild "
-                           "with -DCLANG_ANALYZER_ENABLE_Z3_SOLVER=ON",
-                           false);
-  return nullptr;
-#endif
+  return llvm::make_unique<SMTConstraintManager>(Eng, StMgr.getSValBuilder());
 }