about summary refs log tree commit diff homepage
path: root/include
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel.schemmel@comsys.rwth-aachen.de>2019-06-20 22:31:23 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2019-07-23 20:06:47 +0100
commitdf33de1a47eaff1b191d22f482af5d26162e6aa9 (patch)
treedb3f07ae551fcd2bd755d89ff59e485830839190 /include
parentf36dc9c60c41c2bcf7bc968d1deb782cb986cb2e (diff)
downloadklee-df33de1a47eaff1b191d22f482af5d26162e6aa9.tar.gz
Refactor ConstraintManager to more modern coding standards
Eliminates -Wdeprecated-copy warnings
Performed clang-format on touched file
Diffstat (limited to 'include')
-rw-r--r--include/klee/Constraints.h57
1 files changed, 25 insertions, 32 deletions
diff --git a/include/klee/Constraints.h b/include/klee/Constraints.h
index 87069f89..08077293 100644
--- a/include/klee/Constraints.h
+++ b/include/klee/Constraints.h
@@ -19,54 +19,47 @@
 namespace klee {
 
 class ExprVisitor;
-  
+
 class ConstraintManager {
 public:
-  typedef std::vector< ref<Expr> > constraints_ty;
-  typedef constraints_ty::iterator iterator;
-  typedef constraints_ty::const_iterator const_iterator;
+  using constraints_ty = std::vector<ref<Expr>>;
+  using iterator = constraints_ty::iterator;
+  using const_iterator = constraints_ty::const_iterator;
 
-  ConstraintManager() {}
+  ConstraintManager() = default;
+  ConstraintManager(const ConstraintManager &cs) = default;
+  ConstraintManager &operator=(const ConstraintManager &cs) = default;
+  ConstraintManager(ConstraintManager &&cs) = default;
+  ConstraintManager &operator=(ConstraintManager &&cs) = default;
 
   // create from constraints with no optimization
-  explicit
-  ConstraintManager(const std::vector< ref<Expr> > &_constraints) :
-    constraints(_constraints) {}
-
-  ConstraintManager(const ConstraintManager &cs) : constraints(cs.constraints) {}
-
-  typedef std::vector< ref<Expr> >::const_iterator constraint_iterator;
+  explicit ConstraintManager(const std::vector<ref<Expr>> &_constraints)
+      : constraints(_constraints) {}
 
-  // given a constraint which is known to be valid, attempt to 
+  // given a constraint which is known to be valid, attempt to
   // simplify the existing constraint set
   void simplifyForValidConstraint(ref<Expr> e);
 
   ref<Expr> simplifyExpr(ref<Expr> e) const;
 
   void addConstraint(ref<Expr> e);
-  
-  bool empty() const {
-    return constraints.empty();
-  }
-  ref<Expr> back() const {
-    return constraints.back();
-  }
-  constraint_iterator begin() const {
-    return constraints.begin();
-  }
-  constraint_iterator end() const {
-    return constraints.end();
-  }
-  size_t size() const {
-    return constraints.size();
-  }
+
+  bool empty() const noexcept { return constraints.empty(); }
+  ref<Expr> back() const { return constraints.back(); }
+  const_iterator begin() const { return constraints.cbegin(); }
+  const_iterator end() const { return constraints.cend(); }
+  std::size_t size() const noexcept { return constraints.size(); }
 
   bool operator==(const ConstraintManager &other) const {
     return constraints == other.constraints;
   }
-  
+
+  bool operator!=(const ConstraintManager &other) const {
+    return constraints != other.constraints;
+  }
+
 private:
-  std::vector< ref<Expr> > constraints;
+  std::vector<ref<Expr>> constraints;
 
   // returns true iff the constraints were modified
   bool rewriteConstraints(ExprVisitor &visitor);
@@ -74,6 +67,6 @@ private:
   void addConstraintInternal(ref<Expr> e);
 };
 
-}
+} // namespace klee
 
 #endif /* KLEE_CONSTRAINTS_H */